Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Sequence-dependent setup activities SAMPLE in JAVA

    Posted 10/25/12 08:51 AM

    Originally posted by: SystemAdmin


    Hi all, I need to translate in JAVA the sequence-dependent acitivities C++ sample

    In particular I have troubles understanding how to translate the statement

    model.add(IloLengthOf(setup[i])==setupDuration[typei][IloTypeOfNext(machine,coveri],last));
    Can anybody help me?

    THANKS a lot

    IloEnv env;
    IloModel model(env);
    IloInt m = ...; // Number of types { 0, 1, ..., m-1 }

    IloInt n = ...; // Number of activities on the machine
    IloIntervalVarArray act (env, n); // Activities on the machine
    IloIntervalVarArray setup(env, n); // Setup activities on the machine
    IloIntervalVarArray cover(env, n); // Covering activities on the machine
    IloIntArray type (env, n); // Activity types

    // ...
    for (IloInt i=0; i<n; ++i) {
    act [i] = ...;
    type [i] = ...;
    cover[i] = IloIntervalVar(env);
    setup[i] = IloIntervalVar(env);
    IloIntervalVarArray dec(env); dec.add(act[i]); dec.add(setup[i]);
    model.add(IloSpan(env, cover[i], dec));
    model.add(IloEndBeforeStart(env, act[i], setup[i]));
    }

    IloIntervalSequenceVar machine(env, cover, type);
    model.add(IloNoOverlap(env, machine)); // Setup activities

    IloIntArray2 setupDuration(env, m);
    IloInt last = m; // Type of next for the last activity on the machine
    for (IloInt ti=0; ti<m; ++ti) {
    setupDurationti= IloIntArray(env, m+1);
    for (IloInt tj=0; tj<m; ++tj)
    setupDurationtitj = ...; // Length of setup activity between types ti and tj
    setupDurationtilast = 0; // Length of last setup activity
    }
    for (IloInt i=0; i<n; ++i)
    model.add(IloLengthOf(setup[i])==setupDuration[typei][IloTypeOfNext(machine,coveri],last));
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Sequence-dependent setup activities SAMPLE in JAVA

    Posted 10/25/12 09:09 AM

    Originally posted by: rdumeur


    Dear Alessandro,

    You need to use the element constraint to index the setupDuration sub-array.
    
    cp.add(cp.eq(cp.lengthOf(setup[i]), cp.element(setupDuration[type[i]], cp.typeOfNext(machine,cover[i],last))));
    


    I hope this helps.

    Cheers,
    #CPOptimizer
    #DecisionOptimization