Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

One set of interval variables mixed of "optional" and "must present"

  • 1.  One set of interval variables mixed of "optional" and "must present"

    Posted Sun January 29, 2017 06:15 PM

    Originally posted by: AndyHam


    Dear IBM,

    I have one set of interval variables: some of them must be present and some of them are optional.
    How can I model the mix? Is there syntax something like below?

          dvar interval itvJobs[j in JobList]  (j.type=="Return" --> Optional)  (j.type=="Pkup" --> Present);

    Best Regards,

    Andy


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: One set of interval variables mixed of "optional" and "must present"

    Posted Mon January 30, 2017 03:30 AM

    Originally posted by: PhilippeLaborie


    Hi Andy,

    Yes there is a syntax for that, you can write:

    dvar interval itvJobs[j in JobList]  optional(j.type=="Return");

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: One set of interval variables mixed of "optional" and "must present"

    Posted Mon January 30, 2017 03:41 AM

    Originally posted by: PhilippeLaborie


    I forgot to add that another way to do that is just to define all interval variables optional and post 'presenceOf' constraints on the present ones:

    dvar interval itvJobs[j in JobList]  optional;
    ...
    subject to {
      forall(j in JobList: j.type=="Pkup") {
        presenceOf(itvJobs[j]);
      }
    };
    

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 4.  Re: One set of interval variables mixed of "optional" and "must present"

    Posted Mon January 30, 2017 06:34 AM

    Originally posted by: AndyHam


    Big thanks!
    Also, controlling the presence status inside "Subject to" gives me more flexibility.
    I tested it. It worked beautifully.
    There seems to be always WAY in CP ^^
    Have a great day!


    #DecisionOptimization
    #OPLusingCPOptimizer