Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only

How to multiply two binary decision variables

  • 1.  How to multiply two binary decision variables

    Posted 05/27/19 06:20 AM

    Hi,

     

    at

    https://www.ibm.com/developerworks/community/forums/html/topic?id=aa9aa3db-4fbc-4209-a767-5b5e54902cbd&ps=25

     

    I explained how to multiply a decision variable with a binary decision variable but I may have not been explicit enough for when we multiply two binary decision variables:

     

    1) With CPO we can write

     

    using CP;

    dvar boolean x;
    dvar boolean y;
     
     dvar boolean xy; // x times y
     
     subject to
     {
      xy==x * y; // We can write that with CPO but not with CPLEX
     
     }

    2) We can linearize

     

    dvar boolean x;
     dvar boolean y;
     
     dvar boolean xy; // x times y
     
     subject to
     {
     // xy==x * y; // We can write that with CPO but not with CPLEX
     xy<=x;
     xy<=y;
     xy>=x+y-1;
     }

    3) We can rely on logical constraints:

     

    dvar boolean x;
     dvar boolean y;
     
     dvar boolean xy; // x times y
     
     subject to
     {
     // xy==x * y; // We can write that with CPO but not with CPLEX
     xy==(x==1)&&(y==1);
     }

    regards

     

    PS:

     

    Many how to with OPL at https://www.linkedin.com/pulse/how-opl-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer