Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex cannot extract the expression

    Posted 06/18/20 10:31 AM

    Hello,

    I am trying to use CPLEX to build a transportation network, where arcs  are open so that commodities can be delivered on trucks from origin to destination with different start and end periods.

    I am getting a number of the same error with my code (constraints 2 and 4, the error is of the same nature for both constraints): OPL cannot extract expression. I am not sure how to fix this, I can only assume that OPL does not support my expressions of constraint. I would be very grateful for any help or advice, how I could make my constraints not so complex.

    I have attached the model, the data and an excel files that are needed to read in the data.

    I am only a beginner so I apologize for any mistakes. Please help.



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

    #DecisionOptimization


  • 2.  RE: Cplex cannot extract the expression

    Posted 06/18/20 12:19 PM
    Hi
    you have some a that do not belong to arcs.

    So can you change ct2 and ct4 into

    //ct2  
     forall (i in tnodes, v in Vehicle)    //number of incoming&outgoing arcs for each node is equal
           ct2:sum (a in Nplus[i]:a in arcs) y[v][a]==sum (a in Nminus[i]:a in arcs) y[v][a];​
    and

    //ct4  
    forall(d in demand,i in tnodes){
      ct4:if(i == d.Origin )sum(a in Nplus[i]:a in arcs)x[d][a] - sum(a in Nminus[i]:a in arcs)x[d][a]==dem[d];
        else if (i == d.Destination )sum(a in Nplus[i]:a in arcs)x[d][a] - sum(a in Nminus[i]:a in arcs)x[d][a]==-dem[d];
          else sum(a in Nplus[i]:a in arcs)x[d][a] - sum(a in Nminus[i]:a in arcs)x[d][a]==0;
    ?

    regards

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



  • 3.  RE: Cplex cannot extract the expression

    Posted 06/19/20 01:01 AM
    I think Alex's analysis is correct but the proposed solution is wrong. The problem is that in Nminus the arcs are stored with different order of fields, so if you get an arc <f,t> from Nminus then this arc is not in arcs. Instead the arc <t,f> is in arcs. And since y is indexed by values from arcs you have to use that index. So the constraint ct2 should be:
    forall (i in tnodes, v in Vehicle)    //number of incoming&outgoing arcs for each node is equal
      ct2:sum (a in Nplus[i]) y[v][a]==sum (<f,t> in Nminus[i]) y[v][<t,f>];


    ------------------------------
    Daniel Junglas
    ------------------------------