Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem with Boolean variable

    Posted 02/05/15 05:24 AM

    Originally posted by: Ujfaaz


    Hi everyone,

    I'm relatively new at OPL and Cplex. I'm trying to build my first Supply Chain model. I have a Boolean variable, which indicates if an activity/process is in a specific site or not.

    dvar int open[Sites][Act] in 0..1;
    

    I have 2 Sites and 5 different Activities. So this variable is for example:

    [[1, 0, 1, 0, 0]
     [0, 1, 0, 1, 1]]
    

    Now i want to model another Boolean variable, which shows me the last activity produces at each site. All activities before should also have a 1.

     for this example it should be:

    [[1, 1, 1, 0, 0]
     [1, 1, 1, 1, 1]]
    

    How can I model this second Boolean variable. Which constraint should I use?

    Thanks for your help.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Problem with Boolean variable

    Posted 02/05/15 07:10 AM

    Hi

    range Sites=1..2;

    range Acts=1..5;

     

    int opendata[Sites][Acts]=

    [[1,0, 1, 0 ,0],[0, 1, 0, 1, 1]];

     

    dvar boolean open[Sites][Acts];

    dvar boolean x[Sites][Acts];

     

    subject to

    {

    forall(i in Sites,j in Acts) open[i][j]==opendata[i][j];

     

    forall(i in Sites,j in Acts) open[i][j]<=x[i][j];

     

    forall(i in Sites,j in Acts:j!=1) x[i][j]-x[i][j-1]<= open[i][j-1];

     

    }

     

    execute

    {

    writeln(open);

     

    writeln(x);

    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Problem with Boolean variable

    Posted 02/05/15 07:56 AM

    Originally posted by: Ujfaaz


    Many Thanks! It works excellent.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer