Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Cplex OPL:eliminate some dvar in preprocessing

    Posted Sun October 04, 2020 07:46 AM
    Hello,
    I have a question regarding eliminating some invalid decision variable commbinations in the preprocessing.
    I have a 2-dimensional decision variable X indexed with [commodities][arcs].Please see the code below.The index "commodities" is based on the tuple "Data".The index "arcs" is based on the tuple "Arc".Both tuples "Data" and "Arc" are based on a tuple "TimeNode".
    I dont'want the program iterate all X combinations. I want to remove some of the decision variables in the preprocessing, by considering a condition where I compare Origin time in the Data tuple and FromNode time in the Arc tuple and if "Origin.time>FromNode.time", X equals 0,thus eliminated from iteration and not regarded. Thus, the size of the problem will be reduced and some memory saved. I made some examplary code below, with execute. If i have, for example, {Data} commodities= {<1 <1 3><2 8>>...}, 1 is an id, <1 3> - Origin with 1 as a starting node and 3 is a start time. I do not need the problem to regard all Xs earlier than start time 3.
    However, the execute does not work as X is a decision variable. What could I possibly do? Formulate the condition as a constraint? Thank you. I would appriciate any advice.

    tuple TimeNode {
    int node;
    int time;}
    {TimeNode} tnodes = { <n,t> | n in Nodes, t in Time };

    tuple Data{
    int id;
    TimeNode Origin;
    TimeNode Destination; }
    {Data} commodities= {<1 <1 3><2 8>>, <2 <2 5><3 10>>};

    tuple Arc {
    TimeNode FromNode
    TimeNode ToNode; }
    {Arc} arcs={<<i,s>,<j,e>> | <i,j> in st_arcs, s in Time , e in Time };

    dvar float+ x[commodities][arcs];

    execute {
    for(var c in commodities){
    for(var a in arcs){
    if(c.Origin.time>a.FromNode.time)
    x[c][a]=0;
    }
    }
    }
    "ERROR:Assignment to decision variable in "x # 0 # 0" not possible."

    ------------------------------

    Irina
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Cplex OPL:eliminate some dvar in preprocessing

    Posted Mon October 05, 2020 02:17 AM
    Same question at 

    https://stackoverflow.com/questions/64194036/cplex-opleliminate-some-dvar-in-preprocessing/64197614?r=SearchResults#64197614

    ------------------------------
    ALEX FLEISCHER
    ------------------------------