Originally posted by: AsToN
Hi Alex,
first thanks for you quick help.
The topic in your second link (https://www.ibm.com/developerworks/community/forums/html/threadTopic?id=e7552283-246d-4702-9d8a-6fbf6d6cd90c&ps=25
is related to my problem but still a little different. Let me explain...
If I want to exploit sparsity with tuples in my problem then I would have to do something like this:
My data originally comes in such a form:
|
intPathID
|
intArcList
|
strArcList
|
fltPathDist
|
|
1
|
26 32 37 42 47
|
A6A7 A7B1 B1B2 B2B3 B3B4
|
117.52
|
|
2
|
26 32 37 43 82
|
A6A7 A7B1 B1B2 B2C3 C3B4
|
321.8
|
giving me a list of used arcs for each possible path.
Now I could rewrite my constraint in the form:
forall(a in setArcs)
sum(k in setOrders, p in setArcsInPaths[k][a]) x[k][p] - sum(v in setVehicles, r in setArcsInRoutes[v][a]) capacity[v] * y[v][r] <= 0;
In this case I could get rid of my indicator variables alpha[a][k][p] and beta[a][v][r] by summing over new sparse sets setArcsInPaths and setArcsInRoutes. For this to work I need to create or import those arrays of sets which is also proving tricky.
What I want is an array of sets like this:
|
arcID / pathID
|
1
|
2
|
3
|
4
|
5
|
|
1
|
4
|
10
|
15
|
5
|
6
|
|
2
|
1
|
6
|
11
|
16
|
|
|
3
|
31
|
61
|
86
|
|
|
|
4
|
136
|
241
|
316
|
366
|
396
|
|
5
|
416
|
696
|
|
|
|
Each row gives the set of paths which uses a specific arc. Then I know that I just have to sum over those paths without the need to create indicator variables.
Now I even have those arrays ready in excel/matlab but I am unable to import them into my model. Since each arc has a different number of associated paths (and that number could be huge) I can't simply import it via a command like:
{tuple} arrArcsInPaths[setArcs] = ...; (since I can't define {tuple} appropriately).
So I am instead thinking about how to construct those arrays of sets inside of CPLEX via an execute block.
Any better suggestions or hints of how to implement the described approaches?
#DecisionOptimization#OPLusingCPLEXOptimizer