Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to retrieve cplex interval decision variables using doopl

    Posted 11/09/22 03:19 PM
    Hello, 

    I have written a cplex model to do scheduling optimization. But it seems not possible to export the results of the interval variables - the copy paste method was not working ( I could not select multiple rows in the Tabular Grid.) The excel export is not working because my version is only 12.10. 
    So I resort to doopl in python. Could you please help me on how to write the code to generate the tables in cplex ? so that i can use opl.get_table() in python ? 

    My codes look like the following: 



    using CP;

    tuple Workcenter {string name; int cap;}
    tuple Alt {string po; string wc;}

    {Workcenter} WCs = ...;
    {string} PONames = ...;
    {Alt} Alts = ...;

    int Duration [t in PONames] = ...;

    tuple Precedence {
    string pre;
    string post;
    };

    {Precedence} Precedences = ...;

    int ReleaseDate[t in PONames] = ...;
    int DueDate [t in PONames] = ...;
    float Weight [t in PONames] = ...;

    //Create the production order interval variables
    dvar interval itvs[t in PONames] size Duration[t];
    //Create the alternative resource, i.e., workcenter interval variables
    dvar interval alt[a in Alts] optional;

    minimize max(t in PONames)
    (Weight[t] * maxl(0, endOf(itvs[t])-DueDate[t]) + lengthOf(itvs[t]) );

    subject to {
    //Add the precendence constraints
    forall(p in Precedences)
    endBeforeStart(itvs[p.pre], itvs[p.post]);

    //start after the release date
    forall(t in PONames)
    ReleaseDate[t] <= startOf(itvs[t]);

    }

    Thanks!

    ------------------------------
    Quan Long
    ------------------------------

    #DecisionOptimization


  • 2.  RE: how to retrieve cplex interval decision variables using doopl

    Posted 11/10/22 01:18 AM
    Hi,

    after doopl solve you can get tuple sets from OPL so what I would do is

    1) In your OPL model turn the intervals into tuple sets (Do that in OPL postprocessing)
    2) Get this tuple set from OPL in the python part

    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------