Originally posted by: salais
Hello all,
I am working on implementing a model for the TSPTW (Travelling salesman problem with time windows) and am having trouble accomplishing the following:
I have a distance array indexed with tuples if int i and int j as follows (according to the tsp example)
int N = 4;
range Nodes = 1..N;
tuple edge {int i; int j;}
setof(edge) Edges = {<i,j> | i,j in Nodes};
int dist
Edges = ...;
After these the array "dist" contains the appropriate values. Additionally, i have a vector of integers+ as a decision variable as follows:
range Vd = 2..(N+1);
dvar int+ S
Nodes in Vd;
The problem is when i try and define the objective function
minimize sum (i in Nodes) dist[<i, S
i]>;
However this yields a "cannot extract expression" error.
CP cannot extract expression: minimize sum(i in 1..4) dist[<i,S
(i)]>. MyModel.mod
What am I missing?
Also, seems like my last post was deleted for some reason. If this was because of violation of rules of the forum etc. please let me know so I can correct this.
#CPOptimizer#DecisionOptimization