Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  cplex cannot extract expression

    Posted 02/17/17 11:22 AM

    Originally posted by: ushham


    Hi,

    I am trying to use CPLEX to optimize the positions of vertices so that preset edges between some vertices become horizontal, vertical, or diagonal.

    I am getting a number of the same error with my code: OPL cannot extract expression. I am not sure how to fix this. I would be very grateful for any help.

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

    I am only a beginner so I apologize for silly mistakes.

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: cplex cannot extract expression

    Posted 02/17/17 12:27 PM

    Hi

    you have out of bounds. You should be sure that the index are right.

    With

    dexpr int  bend_weight= sum(i in edgenumber:edgelist[i].beginstation in edgenumber && edgelist[i].endstation in edgenumber )
     (gamma[1][edgelist[i].beginstation][edgelist[i].endstation]+gamma[3][edgelist[i].beginstation][edgelist[i].endstation]);
    minimize bend_weight;

    subject to{


    forall(i in edgenumber:edgelist[i].beginstation in edgenumber && edgelist[i].endstation in edgenumber ){

        sum(j in 1..3)
        gamma[j][edgelist[i].beginstation][edgelist[i].endstation]==1;

    your model could work better

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: cplex cannot extract expression

    Posted 02/18/17 09:40 AM

    Originally posted by: ushham


    Thank you very much. That removes the errors.

    I have also fixed a few other problems, such as initializing tuples and setting new variables, but I have caused another "cannot extract expression" problem in another part of the code. I would be very grateful if you could please see where the problem is coming from now. Thank you very much.

    I have attached the new model below. The rest should be the same as above.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: cplex cannot extract expression

    Posted 02/18/17 10:41 AM

    Hi,

    again you have some out of bounds.

    If you add some such as i in betarange, your model will work better

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: cplex cannot extract expression

    Posted 02/19/17 02:40 PM

    Originally posted by: ushham


    Thank you, sorry I should have spotted that one!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: cplex cannot extract expression

    Posted 02/19/17 04:46 PM

    Originally posted by: ushham


    Hi Again Alex,

    I am sorry I have another question!

    I have been trying to create a model that takes a graph and  draws the edges in horizontal, vertical or diagonal directions, while minimizing the

    acuteness of bends between edges and how much the graph shape is changed by the model.

    In the constraint section of the model I have gotten the part which directs the edges to the required directions to work, but the bend constraint is proving to be difficult.

    I think my problem may stem from defining a decision variable, called delta_bend (change in bend), from the decision variable dir, that is defined in the forall above.

    I would be very grateful if it would be possible for you to have a look and let me know how I could improve this.

    The model runs but non of my dvars return any solutions what so ever.

    Thanks again.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer