Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

using ILOG script to add constraint

  • 1.  using ILOG script to add constraint

    Posted 01/09/09 08:24 PM

    Originally posted by: SystemAdmin


    [elham said:]

    Hello,
    I am very new to ILOG and I appreciate your help.

    in my cp model, I have a set of optional tasks (intervals). and I want to write a script to select a possible combination of tasks for execution each time. in other words I want to write a script that in a for loop it can add the constraints of (presence of particular tasks) to the model and solve the model.
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: using ILOG script to add constraint

    Posted 01/14/09 04:41 PM

    Originally posted by: SystemAdmin


    [afleischer said:]

    Hi,

    to do that I think you could use a main block and change the LB of the presence you want to set.

    For example

    using CP;

    dvar boolean p[1..10];
    dvar interval act[1..10] optional in 0..10;

    minimize sum(a in 1..10) presenceOf(act[a]);
    subject to
    {
    forall(a in 1..10) p[a]==presenceOf(act[a]);
    }

    execute
    {
    writeln(p);
    }

    main
    {
    thisOplModel.generate();
    for(var a=1;a<=10;a++)<br />{
    thisOplModel.p[a].LB=1;
    cp.solve();
    thisOplModel.postProcess();
    thisOplModel.p[a].LB=0;
    }

    gives

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


    Alex


    #DecisionOptimization
    #OPLusingCPOptimizer