Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  using "logical or - ||" between each constraint

    Posted 01/11/13 10:20 AM

    Originally posted by: SystemAdmin


    is there a way using "logical or - ||" between each constraint which are constructed by forall stament. for example:
    x[1]=1 ||
    x[2]=1 ||
    x[3]=1 ||
    x[4]=1 ||

    how can i write these logical constraints by using forall?

    forall(i in 1..4)x[i]==1|| doesn't works...
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: using "logical or - ||" between each constraint

    Posted 01/14/13 04:56 AM

    Originally posted by: SystemAdmin


    You could use the sum operator to do specify that the sum of variables x in 1..4 that have value 1 should be at least one:

    sum(i in 1..4) (x[i] == 1) >= 1
    


    Since (x[i] == 1) is a boolean variable in 0..1 (0 meaning false, and 1 meaning true), this sum has an equivalent semantic to the disjunction of your example.

    Regards,
    Stefano
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: using "logical or - ||" between each constraint

    Posted 01/16/13 08:31 AM

    Originally posted by: davidoff


    If you are in a CP context, it is valid to write
    using CP;
    ...
    or(i in 1..4) x[i]==1
    


    And using CPLEX as the engine, the formulation of the previous post is valid. Note that if your variables are boolean, you have a native linear simplification :

    sum(i in 1..4) x[i] >=1
    


    David
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: using "logical or - ||" between each constraint

    Posted 01/27/13 06:02 AM

    Originally posted by: SystemAdmin


    if i change the constraints like:

    x[1][3][1]+x[3][2][1]=2||
    x[1][4][1]+x[4][2][1]=2||
    x[1][3][2]+x[3][2][2]=2||
    x[1][4][2]+x[4][2][2]=2||
    .
    .
    .
    how can i make these logical constraints in closed form?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer