Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Can Cplex self-optimize

  • 1.  Can Cplex self-optimize

    Posted 07/28/10 11:45 PM

    Originally posted by: gyhuang


    Hello
    I am now using java+cplex. I have a problem with many decision variables. Suppose it takes time N. Now I fix some of the decision variables by simply cplex.addEq(). I assume the running time will be reduced if cplex can figure out the decision variable is reduced. However, running time remains the same. That means, Cplex will not reduce decision variables. Adding equations will not reduce time.
    Is there a function that I can call which can self-optimize the problem before cplex.solve()?
    Many Thanks.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Can Cplex self-optimize

    Posted 07/28/10 11:58 PM

    Originally posted by: SystemAdmin


    MIP performance is not as easy as one might think. Typically you would assume that by fixing some variables (thereby making the problem smaller) the solving time goes down. This will be true on average. For example, if you have 1000 different MIP models, and on each of them you fix 10% of the variables, you will certainly see a reduction in solve time in the arithmetic and geometric means over all models. But this does not necessarily mean that the solving time is reduced on every individual model. For a single model, basically everything can happen. For example, it might be that your fixings are already implied by other constraints, bounds, and integrality conditions. If this is the case and the presolving algorithms of CPLEX are able to find this, then adding your fixing explicitly will not change anything. But even if you are actually decreasing the size of the model by fixing variables that CPLEX is not able to fix itself during presolve, it can still be the case that it does not help solving performance. In rare situations, in can even increase the solving time, just by bad luck.
    Hope this helps,

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Can Cplex self-optimize

    Posted 07/29/10 12:03 AM

    Originally posted by: gyhuang


    But, even if I fix every decision variable, the cplex still takes time to solve it, similar time compared with initial case. Is this normal?
    Thanks.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Can Cplex self-optimize

    Posted 07/29/10 01:17 PM

    Originally posted by: SystemAdmin


    How much time is spent constructing the model versus solving it? It may be the case that both your original model and the model with variables fixed by equalities solve very quickly, but the model generation time dominates the run time.

    To help figure this out, could you post the log from your run?

    Philip Starhill
    CPLEX Research Engineer
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Can Cplex self-optimize

    Posted 08/01/10 02:45 PM

    Originally posted by: gyhuang


    Hi
    I have attached the files.
    Code file is simply how I get time. I get the time difference before and after cplex.solve(). The outputs are for two cases: with variable, and without variable. I then get the time difference as cplex's working time.

    "Without variable" means I constraints all the variables to some fixed value.

    I also attach the log file for these two cases.

    It seems that the presolve time (in log file) is included in the time difference I get, is this correct?

    "sRSR" and "RSR" are two algorithms I am running. Each one should have similar setting (not exactly the same) for the two cases

    What puzzles me most is that it takes longer for RSR when there is no variable. The only explanation is that, when I have no variable (fix variables), presolve time dominates. But when I dont directly fix variables, the real solving time matters. So, introduce fixed variables will larger presolve time. Therefore, I really can not use my method to get calculation time.

    What do you think? What is the proper way to know the exact solving time, exclude the presolve time?

    Thanks.
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Can Cplex self-optimize

    Posted 08/01/10 02:46 PM

    Originally posted by: gyhuang


    sorry I forgot the attachements.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Can Cplex self-optimize

    Posted 08/01/10 02:55 PM

    Originally posted by: gyhuang


    running time with variables
    Experiment: sRSR:10:0.0:3000:0:16.706
    Experiment: RSR:10:0.0:3000:0:5.442
    Experiment: sRSR:10:0.05:3000:0:13.988
    Experiment: RSR:10:0.05:3000:0:5.392
    Experiment: sRSR:10:0.1:3000:0:14.4
    Experiment: RSR:10:0.1:3000:0:5.46
    Experiment: sRSR:10:0.15:3000:0:14.105
    Experiment: RSR:10:0.15:3000:0:5.538
    Experiment: sRSR:10:0.2:3000:0:13.377
    Experiment: RSR:10:0.2:3000:0:5.5
    Experiment: sRSR:10:0.0:3000:1:16.162
    Experiment: RSR:10:0.0:3000:1:5.526
    Experiment: sRSR:10:0.05:3000:1:16.407
    Experiment: RSR:10:0.05:3000:1:5.52
    Experiment: sRSR:10:0.1:3000:1:16.047
    Experiment: RSR:10:0.1:3000:1:5.574
    Experiment: sRSR:10:0.15:3000:1:16.635
    Experiment: RSR:10:0.15:3000:1:5.496
    Experiment: sRSR:10:0.2:3000:1:15.661
    Experiment: RSR:10:0.2:3000:1:5.504
    Experiment: sRSR:10:0.0:3000:2:18.365
    =====================
    running time without variables
    Experiment: sRSR:10:0.0:3000:0:14.688
    Experiment: RSR:10:0.0:3000:0:15.95
    Experiment: sRSR:10:0.05:3000:0:14.541
    Experiment: RSR:10:0.05:3000:0:15.605
    Experiment: sRSR:10:0.1:3000:0:14.533
    Experiment: RSR:10:0.1:3000:0:15.682
    Experiment: sRSR:10:0.15:3000:0:14.581
    Experiment: RSR:10:0.15:3000:0:15.801
    Experiment: sRSR:10:0.2:3000:0:14.561
    Experiment: RSR:10:0.2:3000:0:15.803
    Experiment: sRSR:10:0.0:3000:1:14.505
    Experiment: RSR:10:0.0:3000:1:15.531
    Experiment: sRSR:10:0.05:3000:1:14.349
    Experiment: RSR:10:0.05:3000:1:15.553
    Experiment: sRSR:10:0.1:3000:1:14.371
    Experiment: RSR:10:0.1:3000:1:15.591
    Experiment: sRSR:10:0.15:3000:1:14.325
    Experiment: RSR:10:0.15:3000:1:15.615
    Experiment: sRSR:10:0.2:3000:1:14.366
    Experiment: RSR:10:0.2:3000:1:15.553
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Can Cplex self-optimize

    Posted 08/01/10 02:56 PM

    Originally posted by: gyhuang


    log files
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Can Cplex self-optimize

    Posted 08/01/10 02:56 PM

    Originally posted by: gyhuang


    log files
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Can Cplex self-optimize

    Posted 08/01/10 03:46 PM

    Originally posted by: SystemAdmin


    Your output does not match the logs, so something funny must be going on in your code (somewhere other than the snippet you posted). For the "without variables" runs, both algorithms produce models that the CPLEX presolver solves in under five seconds ("all rows and columns eliminated"). Unless CPLEX is spending about 10 seconds or so extracting the models, the run times in your print statements are inconsistent -- but if CPLEX does need 10 seconds to extract the model, then why are the "RSR" results in the "with variables" run consistent with just the presolve time?

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Can Cplex self-optimize

    Posted 08/01/10 07:08 PM

    Originally posted by: gyhuang


    That code is the only place I print out the time. The adjacent sRSR and RSR always have exact settings. sRSR is supposed to have more time.

    What puzzles us most is why RSR have running time similar with presolve time when there is variable, but sRSR is not.

    It seems to me that fixing variables (eliminate them by code) actually introduces more presolve time. For example, if you look at running time with variable, you can see sRSR is about 10 mins more (they have similar presolve time), that's the really running time difference.

    Can I confirm that the presolve time is actually included in the solving time I printed out?

    Thanks.
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Can Cplex self-optimize

    Posted 08/16/10 11:48 AM

    Originally posted by: SystemAdmin


    Your log files show that presolve times are similar in either case. Moreover, the presolve time in the "without variables" case is way different from the solving times you report for this case.
    Can you try to run the models through the interactive optimizer and see what that gives? I.e., before solving a model call cplex.exportModel("name.sav") to store the model in file name.sav. Then use the interactive optimizer and see if the timings are still that big.
    #CPLEXOptimizers
    #DecisionOptimization