Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Writing/Readig a LP model

    Posted 12/19/13 07:06 AM

    Originally posted by: MatteoDenitto


    Hi all,

    i'm new here and i hope this is the right place to post my question.

    I'm using Cplex to solve differents LP problems. Those problems differ only for the objective function they have to maximize, all the constraints in all the problems are the same. Due to this i thought to create a .lp file to load in order to speed up the resolution time. In few words my routine is:

    if not exist the .lp file{

    create .lp file

    }

    else {

    load .lp file

    update the objective function

    }

    solve the model

    The first time, when the model is created, the solver works well and all constraints are respected. But when i load and try to solve it, some constraints are broken.

    So i tried this:

    1. create a model
    2. solve it
    3. write it
    4. load it
    5. rewrite it
    6. solve it

    the solutions were different, in the loaded one some constraints were not respected. I watched the .lp file with a text editor and i noticed that in some constraints the order of the variables that partecipate in it were switched, keeping inalterate the sense of the constraint. An example: if the const the 1st time is A+B-C < 10 when i rewrite it the constraints became -C+A+B < 10.

    Has anyone solved this issue before? How can i face this situation?

    Thanks.

     

    p.s.

    i used Cplex in Matlab on windows 7. To write and load the model i used the writeModel() and loadModel() routines provided by Cplex.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Writing/Readig a LP model

    Posted 01/06/14 06:07 AM

    Does the problem persist if you store the model in a SAV file instead of an LP file?

    Also notice that you do not need to take the detour via the filesystem. You can just assign a new vector to cplex.Model.obj before calling cplex.solve(). If you change the objective function in that way then the next solve() will be done with respect to the updated objective function.


    #CPLEXOptimizers
    #DecisionOptimization