Originally posted by: DidacR
Hi Alex,
I am sending a reduced version of main{} with the basic elements.
Instead uf using the spreadsheet option. I am using a second text file as output.
********************************************************************
main{
thisOplModel.generate();
var EVS = thisOplModel;
var Locat= EVS.Locat;
var ofile = new IloOplOutputFile("EVS.txt",true);
var OpFile = new IloOplOutputFile("EVS_Locat.txt",true);
if(cplex.solve()){
var OpLocat = EVS.OpenLocat;
OpFile.writeln(OpLocat);
var Status = cplex.getCplexStatus()
ofile.writeln("Status =", Status );
var BestNode = cplex.getObjValue();
var BestInt = cplex.getBestObjValue();
if(Status == 1){
ofile.writeln("Optimal");}
else{
var RelGap = (Math.abs(BestNode-BestInt))/(1e-10+Math.abs(BestNode));
ofile.writeln("Optimallity Gap =",RelGap);
}
ofile.writeln(OpLocat);
ofile.writeln(BestInt);
ofile.writeln(BestNode);
}
********************************************************************
******************* dat file ************************
SheetConnection sheet("Locations.xls");
OpLocat to SheetWrite(sheet,"Sheet1!A1:A400");
***********************************************************
Thanks
#DecisionOptimization#OPLusingCPLEXOptimizer