Originally posted by: BKRORC
Hello ,
There is a problem.
Set a variable but model did not use new value. where is the problem?
Varible name is CozulecekOptionId
here is my .dat file and .not .cs file
/*********************************************
* OPL 12.2 Data
* Authors: Serkan Ulukaya, Yunus Emre Koc
* Creation: Aug, 2010
*********************************************/
DBConnection db("oledb","SERKAN/denem/Planlama/temaoltp");
CozulecekOptionId = 65;//model use 65 always.But I want to set a new varible and mosel use it.
SKUBazindaVeriler from DBRead(db,"SELECT RTRIM(CAST(OptionRef AS CHAR(20))), RTRIM(CAST(UrunRef AS CHAR(10))), Sablon, MinKoliIci FROM Planlama.BA.tb_KisitUrun WHERE CozulecekOptionId = ? ")(CozulecekOptionId);
OPTIONBazindaVeriler from DBRead(db,"SELECT RTRIM(CAST(OptionRef AS CHAR(20))), MaxBrutAsorti, MinBrutAsorti,RTRIM(CAST(CozulecekOptionID AS CHAR(20))) FROM Planlama.BA.tb_KisitOption WHERE CozulecekOptionId = ? ")(CozulecekOptionId);
Sonuc to DBUpdate(db,"INSERT INTO Planlama.BA.tb_SonucAraTablo (OptionRef,UrunRef,KoliIciAdet,CozulecekOptionID) VALUES(?,?,?,?)");
********************************************
*********************************************
private int RunBedenAnaliz(int Id , string ILogFileName)
{
int status = 127;
const string DATADIR = @"C:\ILOG\Asorti_2Basamakli\";
try
{
OplFactory oplF = new OplFactory();
OplErrorHandler handler = oplF.CreateOplErrorHandler(Console.Out);
OplModelSource modelSource = oplF.CreateOplModelSource(DATADIR + ILogFileName+".mod");
OplSettings settings = oplF.CreateOplSettings(handler);
OplModelDefinition def = oplF.CreateOplModelDefinition(modelSource, settings);
CP cplex = oplF.CreateCP();
OplModel opl = oplF.CreateOplModel(def, cplex);
OplDataSource dataSource = oplF.CreateOplDataSource(DATADIR + ILogFileName+".dat");
opl.AddDataSource(dataSource);
OplDataElements dataElements = opl.MakeDataElements();
dataElements.SetElement(dataElements.MakeElement("CozulecekOptionId", Id));//I set varible here
//dataElements.AddElement(dataElements.MakeElement("CozulecekOptionId", Id));
opl.Generate();
if (cplex.Solve())
{
opl.PostProcess();
//opl.PrintSolution(Console.Out);
status = 0;
}
else
{
status = 1;
}
oplF.End();
}
catch (IloException ex)
{
status = 2;
}
catch (System.Exception ex)
{
status = 3;
}
return status;
}
#DecisionOptimization#OPLusingCPLEXOptimizer