Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  solution print problem

    Posted 12/18/14 05:34 AM

    Originally posted by: viva0521


    May I ask another question regarding the solution printing? I was trying to output my solution like this:

    execute{
      var ofile = new IloOplOutputFile("modelRun.txt");
      ofile.writeln("Solution:");
       for(var <i,j> in HWArcs)for(o in Ori)for( d in Dest) 
          if(y[<i,j>][o][d] > 0)
             writeln("<",i.fromnode,",",i.tonode,",",o,",",d,",","y[<i,j>][o][d],">");

    for(var <i,j> in RWArcs)for(o in Ori)for( d in Dest) 

          if(x[<i,j>][o][d] > 0)
             writeln("<",i.fromnode,",",i.tonode,",",o,",",d,",","x[<i,j>][o][d],">"); 
        
       ofile.writeln("Optimal objective value="+cplex.getObjValue());    
    }

     

    But it gave the error info: Scripting parser error: missing expression.  Also how can i add title for solution x and y,respectively?

    Would you kindly provide any idea? Thanks!

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: solution print problem

    Posted 12/18/14 04:52 PM

    Hi

    execute{
      var ofile = new IloOplOutputFile("modelRun.txt");
      ofile.writeln("Solution:");

    ofile.writeln("Solution: for y");
       for(var ij in HWArcs)for(o in Ori)for( d in Dest)
          if(y[ij][o][d] > 0)
             ofile.writeln("<",ij.fromnode,",",ij.tonode,",",o,",",d,",",y[ij][o][d],">");


       ofile.close();
    }

    should work better.

    You should not use

    for(var <i,j> in RWArcs)

    in the scripting part

     

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer