Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Multiple Errors in TSP/VRP formulation

    Posted 01/21/14 05:23 PM

    Originally posted by: CMohr


    I am new to CPLEX  and am trying to become familiar with how it works and running into some road blocks.

    I'm trying to build and run a relatively simple Vehicle Routing Problem, using the similar TSP example project as a reference.  My model in a nutshell is as follows:

    Ive defined:

    A range of Nodes (Cities) from 1 to n
    tuple { i, j } to represent the edges (arcs from node i to j)
    float  c[ i, j ] to be referenced in a data file as an array of distances
    Binary decision variable x[ i, j ] = 1 if arc i to j is utilized, else 0

    My objective function is simply to minimize the sum of all c[ i, j ] * x[ i, j ] according to standard VRP constraints

    When I run the model there are 3 errors:

    1) Description Resource Path Location Type
    Tuple not found in "Edges": <1, 1>. CVRP Unknown OPL Problem Marker

    2) Description Resource Path Location Type

    Scripting runtime error: (in generate) Processing OPL model "ModelConstraints" failed.. ModelConstraints.mod /CVRP 108:0 C:\Users\cmohr1\opl\CVRP\ModelConstraints.mod OPL Problem Marker
     

    3) Description Resource Path Location Type

    Execution of "main" failed: "C:\Users\cmohr1\opl\CVRP\ModelConstraints.mod", line 108: generate: Processing OPL model "ModelConstraints" failed.. ModelConstraints.mod /CVRP 97:1-5 C:\Users\cmohr1\opl\CVRP\ModelConstraints.mod OPL Problem Marker

     

    For the first error, I am confused because there are 10 nodes and the model is symmetric so it expects 45 tuples (representing distances), which I have in the data file, and which would not include [1,1], [2,2], and so on.  

    I have no idea what errors 2 ad 3 mean, nor how to remedy them.

    Attached is the code for my .mod file and data file.  I also have another data file simply containing:

    subtours = {};

    I wrote the variables, model, and constraints.  I simply copied the execute and main script portions from the example TSP project and changed certain values to fit with my model because before doing that when I ran the model I got 54 error messages, most of them being "Cannot extract expression for..." and "tuple not found...".

    I am quite lost when trying to code this model and any help would be appreciated.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Multiple Errors in TSP/VRP formulation

    Posted 02/19/14 12:42 PM

    Originally posted by: HelloObamama


    Hi,

      The syntax errors listed above are mainly about how to use the quantifier "forall" and  the aggregator "sum". I corrected and attached the model and data file in the attachment. However, From the formulations, it seems like it is not a typical Vehicle Routing Problem or Capacitated Vehicle Routing Problem. The demand for each node is not given. The depot is not defined for the vehicle routing problem either (In my script, I used "0" as the depot, and the total number of cities to visit becomes n-1). Major revision on the model should be made to get it solved by CPLEX.   Thank you.

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Multiple Errors in TSP/VRP formulation

    Posted 01/11/18 06:53 PM

    Originally posted by: obumin


    Hi there, I am new to CPLEX as well,  I wrote a model however unfortunately it shows Syntax error. Altough I check three times I can not find the solution for the Syntax errror everything seems fine. May I kindly request you guys to check my model and return to me, I would appreciate a lot.

     

    Thanks,

      


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Multiple Errors in TSP/VRP formulation

    Posted 01/12/18 12:51 AM

    Hi,

    attached trial.mod works

     

    I commented

    //      forall (i in cities)
    //        demand1:
    //        sum (j in cities : j!=i) x[<i,j>] == v[<i,j>] ;

    since this does not make sense. j is the iterator of the sum and cannot index v!

    regards

    https://www.ibm.com/developerworks/community/forums/html/topic?id=1bf1f4de-b6fa-4375-a397-741e9239513e&ps=25


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Multiple Errors in TSP/VRP formulation

    Posted 01/12/18 03:55 PM

    Originally posted by: obumin


    Thank you Alex :)


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Multiple Errors in TSP/VRP formulation

    Posted 04/08/18 11:18 PM

    Originally posted by: HongPhuc123


    I am new to CPLEX  and am trying to become familiar with how it works and running into some road blocks.

    I'm trying to build and run a relatively 2 Echelon Vehicle Routing Problem, using the similar TSP example project as a reference.  My model in a nutshell is as follows:

    I defined:

    A range of first level [from depot (where trucks consolidate goods) to parking lot( where truck unload goods and then goods are loaded on motorbike)

    A range of second level [from parking lot (where truck unload goods and then goods are loaded on motorbike ) delivery to final customer.

    My objective function and Model is in Excel File

    Can anyone help me get out of this. I really appreciate it <3

    Please find my attach below

    I'm looking hearing from you , guys.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer