Originally posted by: sapopt
Hello,
I found some code here: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.ide.help/examples/html/opl/models/TravelingSalesmanProblem/tsp.mod.html
for solving a classic TSP. I understand the subtour elimination constraints, the model, etc. I'm altering the model for a modified TSP, and I feel fine with that.
My question is about feeding in data. In particular, the linked .mod file contains these lines:
024:
// Cities
025:
int n = ...;
026:
range Cities = 1..n;
027:
028:
// Edges -- sparse set
029:
tuple edge {
int i;
int j;}
030:
setof(edge) Edges = {<i,j> |
ordered i,j
in Cities};
031:
int dist[Edges] = ...;
I'm trying to understand how I should feed in the data.
In my .DAT file, I've tried a trivial (fully connected) 2-node example:
n=2;
dist =[0,1,1,0];
and I've tried:
n=2;
dist ={0,1,1,0};
I know this question is quite basic, but what would a proper input format look like in the .DAT file? The mix of tuple, setof, and ordered has gotten me a bit mixed up.
Best regards,
sapopt
#DecisionOptimization#OPLusingCPLEXOptimizer