Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  docplex

    Posted 02/28/19 06:23 AM

    Originally posted by: ShaCplex


    Hi Alex,

    How to can i write quadratic function in docplex? please can u demonstrate it by a small example?

    I want to achieve something like this;

     

    target = 100

    for i in range(0,5):

    ( variable[i] - target ) ^2

    while in java, I was writing; (Ilocplex cplex = new Ilocplex ())

    cplex.square(cplex.diff(variable, target)

     

     

    Regards,

    shahul


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: docplex

    Posted 02/28/19 07:33 AM

    In docplex arithmetic operators are overloaded. So you should be able to just write

    (variable[i] - target) * (variable[i] - target)

    or

    variable[i] * variable[i] - 2 * variable[i] * target - target * target

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: docplex

    Posted 03/03/19 04:52 AM

    Originally posted by: ShaCplex


    Thanks daniel, that really helped!

     

    I found that we can even write (variable[i] - target)**2

     

     

     

     

    Thank you,

    shahul


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: docplex

    Posted 03/03/19 04:54 AM

    Originally posted by: ShaCplex


    Can I ask you is there any limitation to docplex? 

    Which one should I follow CPLEX python API or docplex? 

    Can almost all problems be modelled in both? I feel docplex is the complete package...

     

     

     

     

    Regards,

    shahul


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: docplex

    Posted 03/05/19 09:01 AM

    It depends on what you mean by "complete". docplex builds on or wraps around the Python CPLEX API. So it cannot do more than the Python CPLEX API.

    docplex does not support everything that is possible with the CPLEX Python API. On the other hand, many things are more convenient with docplex than they are with the CPLEX Python API. The main difference is that docplex provides an object oriented way of modeling (variables and constraints are objects, operators are overload for ease of building expressions etc.) while the CPLEX Python API is matrix based (a variable is just a column index, a constraint is just a row index).

    It depends on you which of the two approaches you feel more comfortable with.

    You can find some more details in short clarification and the links provided there.


    #CPLEXOptimizers
    #DecisionOptimization