Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Concert - Reading model from LP file, solving, displaying variable values

  • 1.  Concert - Reading model from LP file, solving, displaying variable values

    Posted Wed December 07, 2011 04:41 PM

    Originally posted by: LuisdelaTorre


    I'm using Concert (through Java). I want to read a model from an .lp file, solve it, and display the values of the optimal variables. I'm not sure how to get the variable values from the model imported into Concert. Normally when I write a model entirely in Concert, I can do this with something like

    IloNumVar x = cplex.numVar(0,1);
    cplex.solve();
    cplex.getValue(x);
    


    but I'm not sure what object to call getValue on when I read the model from an LP file instead of creating it myself.

    Thanks!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Concert - Reading model from LP file, solving, displaying variable values

    Posted Wed December 07, 2011 05:23 PM

    Originally posted by: SystemAdmin


    The idea is to use the IloLPMatrix object which gets populated after the call to the importModel() function. For simply displaying the values of the optimal variables, you could refer to the LPex2.java example which comes with the distribution (under the <CPLEX_Studioxxx>\cplex\examples\src\java folder). Please find it attached with this message as well.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Concert - Reading model from LP file, solving, displaying variable values

    Posted Wed December 07, 2011 05:55 PM

    Originally posted by: LuisdelaTorre


    Thanks! Simple. I forget to look at the included examples for basic operations.
    #CPLEXOptimizers
    #DecisionOptimization