Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  solving a table constraint by ILOG CPO

    Posted 07/21/16 02:33 AM

    Originally posted by: FiFila


    Hi;

    I do not know how to implement the "table constraint" in "ILOG CPO".

    I have a smart table constraint for different attributes (Xi) in a table ( each Xi has an interval. column (2*i) shows lower bound of Xi and column (2*i+1) shows upper bounds of different Xi). (You can see it in the attachment). These attributes are resulted in output "y".

    For instance for row1: x0=(-ꝏ, 20], x1=(-ꝏ,10], y=1

    I want to know for instance: if  "x0=15" and "x1<10", what is amount of "y"?

    And vice versa: Is it feasible to x0=15 and x1<10 and y=1? 

    I do not know how to implement table constraint in ILOG CP.

    I would greatly appreciate it if you help me.

     

    Best regards

     


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: solving a table constraint by ILOG CPO

    Posted 07/22/16 11:16 AM

    Originally posted by: ChrisBr


    Hello,

    In CPO the table constraint is called "allowedAssignments".
    See IloAllowedAssignments  or allowedAssignments

    You can also have a look to "forbiddenAssignments".
    See IloForbiddenAssignments or forbiddenAssignments

    I hope this helps,

    Chris.


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: solving a table constraint by ILOG CPO

    Posted 07/22/16 12:49 PM

    Originally posted by: ChrisBr


    I complete my previous answer.
    "allowedAssignments" is appropriate when there is a small list of variables and a not too large list of values. In an other case, especially when there is some interval like (-infinity, 10], it is not possible to use such constraint.
    You need meta-constraints instead.
    For example, to state
        if  "x0=15" and "x1<10", "y should be 1"
    You will write
    in OPL
      (x[0]<20 && x[1]<10) <= (y==1);
    and in C++
      model.add(IloIfThen(env, (x[0]<20 && x[1]<10),(y==1)));

    See IloIfThen
    I hope this clarifies,
    Chris.


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: solving a table constraint by ILOG CPO

    Posted 07/22/16 01:42 PM

    Originally posted by: FiFila


    Thank Chris for your reply but there is only two more questions. 

    The number of "y" are very high for instance "y" could be "0","1","2","3", ....,"1000" and if I want to check all of possibilities of "y" it is not logical. What is your suggestion?

     

    Also, about your first answer would you please explain more about how to do this? I maybe can assign a number for each interval and as a result maybe table constraint could be useful.

    Best regards


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: solving a table constraint by ILOG CPO

    Posted 07/25/16 05:27 AM

    Originally posted by: PhilippeLaborie


    In the model of Chris, y does not need to be a boolean variable, it can be any integer variable, and you can do things like:

    model.add(IloIfThen(env, (x[0]<20 && x[1]<10),(y>10 && y<20)));

    This being said, depending on what this table represents, there may be more compact ways to model the constraint: 

    * Is the constraint always about 3 variables (x[0],x[1] and y) or can it involve more than 2 x[i] variables ?

    * Does fixing the values of all the variables x[i] results in a unique value for y ? (looking at your example, it does not seem to as for instance x[0]=30 and x[1]=30 results in two possible values {0,1} for y)

    * Is it not possible to define the constraint in a closed form by using the available algebraical expressions available in CPO (min, max, +-*/, ...) ?

     

     


    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: solving a table constraint by ILOG CPO

    Posted 07/25/16 01:05 PM

    Originally posted by: FiFila


    Hi Philippe;

    Thanks for your email. Answering your question: 

    This is only one small example.

    * No, my variables are not 3, they are more than 50 for every tables. (I have many of these tables). My output "y" is just one variable.

    *  Yes, with each pair of  certain amounts of Xi, y is unique.

    * Preferably, with "and" "or" is more better than "min" and "max". 

    Best regards

     

     


    #CPOptimizer
    #DecisionOptimization