Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  add a Multidimensional arrays as variables

    Posted 12/12/17 07:20 AM

    Originally posted by: savant_ning


    I use cplex in python, and I want to add a Multidimensional arrays as variable; how can I do it?

    and the lb, ub, objective and the types how to add?

     


    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: add a Multidimensional arrays as variables

    Posted 12/12/17 10:16 AM

    Hi,

    have you had a look at foodmanu.py in

    CPLEX_Studio1271\cplex\examples\src\python

    ?

    regards


    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: add a Multidimensional arrays as variables

    Posted 12/17/17 03:33 AM

    Originally posted by: savant_ning


    yeah, thanks a lot

    I have learn about this code, and I have a question:

    if I need to multiple three variables, including two variables(both  binary) added in variables.add,  one is the constant number;

    How to write this linear_constraints.add function?

     

    like this:

    y = a * b *c

    a,b is variables and c is constant number.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: add a Multidimensional arrays as variables

    Posted 12/17/17 04:00 AM

    The product of two variables is not a linear term. Hence this is is not a linear constraint and you cannot use the linear_constraints interface to add constraints of this type. You have to use the quadratic_constraints interface instead.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: add a Multidimensional arrays as variables

    Posted 12/17/17 05:27 AM

    You may have a look at the example qcpex1.py

    in

    CPLEX_Studio128\python

    regards


    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: add a Multidimensional arrays as variables

    Posted 12/17/17 04:56 PM

    The product of a binary variable and another binary variable (or a binary variable and any bounded variable) can be linearized: https://orinanobworld.blogspot.com/2010/10/binary-variables-and-quadratic-terms.html.


    #DecisionOptimization
    #MathematicalProgramming-General