Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  IlcActivity IlcIntervalVar getStartVariable()

    Posted 09/11/12 07:22 AM

    Originally posted by: mrmag


    Dear all,

    In an old version of cp optimizer and scheduler there was such a class IlcActivity. It had the function:

    getStartVariable()

    which returned an IlcIntVar so I could connect for example the start of an interval variable with the integer variable as

    IlcActivity act;
    IlcIntVar start;
    getManager().add(start==act.getStartVariable());

    The problem is that in the new version there is no IlcActivity but there is just a IlcIntervalVar which does not have getStartVariable() function. How can I connet the start of an interval varialbe with an integer variable?
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: IlcActivity IlcIntervalVar getStartVariable()

    Posted 09/11/12 08:00 AM

    Originally posted by: SystemAdmin


    Hello,
    First I think that you should design your model at the level of Concert (using Ilo objects instead of Ilc). This holds both for CP Optimizer (IloIntervalVar) and Scheduler (IloActivity).

    In CP Optimizer the notion of an interval variable is atomic an is not, like in Scheduler a composite of integer variables. But it is of course possible to mix interval variables and integer variables in the model. For that, a set of integer expressions are available, for instance IloStartOf(act,dval) that will represent the start value of interval variable act if it is present and value dval (0 if omitted) if the interval is absent. You can use this type of integer expression in the objective and/or to post constraints. For instance, you can still do:

    IloIntVar start ...;
    IloIntervalVar act ...;
    model.add(start == IloStartOf(act));

    This being said, unless there is some good reason for it, it is better to avoid creating those additional integer variables if you can directly write your model with the integer expressions or even better, directly with constraints on the interval variables.

    For instance for posting a precedence constraint, you should use:
    model.add(IloEndBeforeStart(env, act1, act2));

    Working with expressions like below would be less effective:
    model.add(IloEndOf(act1)<=IloStartOf(act2));

    And introducing additional integer variables would be even worse:
    model.add(end1 == IloEndOf(act1));
    model.add(start2 == IloStartOf(act2));
    model.add(end1 <= start2);

    Philippe
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: IlcActivity IlcIntervalVar getStartVariable()

    Posted 09/11/12 08:16 AM

    Originally posted by: mrmag


    Thank you Philippe for the prompt response!

    The brilliant issue of the IlcIntVar is that I can remove some values from it like

    IlcIntVar start…
    start.removeValue(2);

    IlcActivity act…
    getManager().add(start==act.getStartVariable());

    So, I can remove the some values where the job act can start. IloIntVar does not have such a method. Or even IloIntervalVar does not allow doing that. Is there any idea of doing that with IloIntVar or even just with IloIntervalVar?
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: IlcActivity IlcIntervalVar getStartVariable()

    Posted 09/11/12 09:31 AM

    Originally posted by: SystemAdmin


    Yes, there is a constraint for that in CP Optimizer, it is called IloForbidStart (see the documentation).
    Signature is:
    
    IloConstraint IloForbidStart(
    
    const IloEnv env, 
    
    const IloIntervalVar a, 
    
    const IloNumToNumStepFunction f)
    

    You need to build a step function f with a value 0 on the time windows where the activity cannot start.

    Philippe
    #CPOptimizer
    #DecisionOptimization