Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Different Result from Different environments

    Posted 03/26/20 06:58 PM

    Originally posted by: Minoo


    I have a MIP which I used both the OPL and the C++ for solving it. I get different results from them. If there would not be any problem in the coding part, what other factors might affect to have this problem?

     

    Thanks for your help,


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Different Result from Different environments

    Posted 03/27/20 09:34 AM

    Even small differences, like the order that the variables or constraints are created, or the precision of the coefficients, can give different results. There can also be many different optimal solutions. You didn't describe how the results are different; are we talking about different within tolerances or something else? At any rate, one thing you can do is to give names to all of the variables and constraints and export the two models to LP format. If you compare the two LP files you should get an idea of what is different between the two models and this can give you some added insight.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Different Result from Different environments

    Posted 03/30/20 09:22 PM

    Originally posted by: Minoo


    I got the LP files. The coefficient of each decision variable is calculated differently, while the data is same. I have one 3D variable in my problem. Do you think it might be related to them? All data types are defined exactly same.

    The final results for decision variable and overall result of objective function are different.

    Thank you for your help.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Different Result from Different environments

    Posted 03/31/20 02:41 AM

    That most likely means that in C++ you do things differently than they are done in OPL. Order of statements may be different, intermediate results might get rounded, ...

    Can you try to create a minimal example (maybe restrict to one single constraint that differs in the LP file between C++ and OPL) and share that here? Then we may be able to spot what makes the difference.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Different Result from Different environments

    Posted 03/31/20 04:01 PM

    Originally posted by: Minoo


    This is part of my program that I think might produce problem.

     

    Thank you


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Different Result from Different environments

    Posted 04/01/20 04:28 AM

    We cannot tell what the problem may be because your test.cpp program does not compile at all. So we cannot run it here and produce the respective LP file.

    Please attach a code that is self-contained, can be compiled and run, and illustrates the problem. At least attach the LP file that is produced from the C++ code. Moreover, to allow comparison of the two models, you should name your variables in the C++ code in the same way they are named by OPL.


    #CPLEXOptimizers
    #DecisionOptimization