Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  A question about OPL CPLEX

    Posted 09/19/12 02:01 AM

    Originally posted by: Sambuddha


    Hi --
    I am running a linear program (using CPLEX as the solver); the linear program is coded up in OPL. However, after a run, I would like to
    see the values of some of the decision variables, and if the value is sufficiently high, I would like to round it up to 1, and then start another
    run. I.e. I would like to set the values of some of the decision variables to 1, and then the next run ought to have these dvars set.

    Is there a way to do this in OPL? I am aware that there is such a way in AMPL using the "let" command.

    Best,
    Sambuddha.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: A question about OPL CPLEX

    Posted 09/19/12 02:46 AM
    Hi,

    you can do that in OPL inside a main block. (flow control)

    The keyword is main.

    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: A question about OPL CPLEX

    Posted 09/19/12 02:19 PM

    Originally posted by: Sambuddha


    Hi I do know about the flow control via a main block but I couldn't get any reference for solving my problem, i.e. a version of the "let" command
    of AMPL in OPL. Do you know of any reference that I can check? Thanks in advance.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: A question about OPL CPLEX

    Posted 09/20/12 06:00 AM
    Hi

    I will give you a small example

    dvar float x in 0..20;
     dvar float y in 0..20;
     
     maximize 2*x+y;
     subject to
     {
       x+y<=20;
     }  
     
     execute
     {
      writeln("x=",x);
      writeln("y=",y);
     }   
     
     main
     {
       thisOplModel.generate();
       cplex.solve();
       thisOplModel.postProcess();
       thisOplModel.x.UB=1;
       thisOplModel.x.LB=1;
       cplex.solve();
       thisOplModel.postProcess();
     }
    


    regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: A question about OPL CPLEX

    Posted 09/20/12 07:16 AM

    Originally posted by: Sambuddha


    Hi Alex,

    Thanks a lot!

    Best,
    Sambuddha.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer