Complex Combinatorial sort VBA/Macro

4petris

New Member
Joined
Oct 29, 2017
Messages
5
Hi everyone,

I have a tricky task :) Let me clarify that step by step below.

Input
  • table with 5 columns
  • columns are: combination, place1, place2, place3, income
  • column combination represents a number of each combination (combination of 3 places)
  • place1, 2, 3 are basically points where a car needs to go
  • income says how much we get paid to drive in a specific combination (way)
e.g. we can say that combination #6 brings 13628.40 income and the car needs to go through places A, O & M.

First of all, I need to find out the way how I specify: Let's say that formula will go from combination 1 to 197. We currently know that all combinations are sort from the biggest price to the lowest one.

Secondly, I need to set up the rule saying, once you drove through a specific place, DO NOT drive through that point again.
e.g. We take the combination #1 F, A, O and we know that cannot drive again to those points. So a formula looks for other combinations the next possible combination is #1 3 since M, K, N do not match with previous combination F, A, O. Now we have already 6 places where the car cannot drive anymore. F, A, O, M, K, N. Then the next available combination is E, I, J. And it goes like that until it does not have all possible combinations found.

We can say that all found combinations are below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]combination[/TD]
[TD]place1[/TD]
[TD]place2[/TD]
[TD]place3[/TD]
[TD]income[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]F[/TD]
[TD]A[/TD]
[TD]O[/TD]
[TD]16556[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]M[/TD]
[TD]K[/TD]
[TD]N[/TD]
[TD]12126[/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]E[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]10610[/TD]
[/TR]
[TR]
[TD]74[/TD]
[TD]Q[/TD]
[TD]T[/TD]
[TD]R[/TD]
[TD]5500[/TD]
[/TR]
[TR]
[TD]93[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]C[/TD]
[TD]4695[/TD]
[/TR]
</tbody>[/TABLE]

TOTAL Income is 49549. This result is based on the fact, that formula goes from combination #1 to #1 97 where biggest incomes are first. What if the table is sort in a different way? How many combinations can be there? 197 factorial? How can find the best distribution in order to get the highest income value?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
The number of combinations to test should be manageable, because of the constraints about not visiting the same location twice.

But a question first ...

Your result shows the income for five trips = 15 locations, but you actually have 20 locations (A, B ... T).

Do you need to visit all 20 locations (in which case there will necessarily be at least one duplicate)?

Or are you looking to maximise the income for a general N trips, minimising the number of duplicates, where N in this case happens to be 5?
 
Upvote 0
Here's how I would do it.

1. Write code that starts with a forward compatibility list for each node (combo) (i.e., node 13 is on the list for 1; node 1 is not on the list for 13).

2. Then do a depth-first search starting with node 1 to get all sequences that start from there (i.e., traverse the entire tree having node 1 as its root) and capture the total income for each. When you arrive at node 13 from node 1, for example, the next choice must be common to the lists for both nodes; when you arrive at the third, the next choice must be common to all three. At each leaf node, backtrack to the next higher node that offers a different path than you have taken so far.

3. Repeat step 2 for every other node as the starting point.

My sense is that each tree winnows quickly, so there are a reasonable number of leaf nodes. That makes it doable in finite time, but the code would take (me at least) a day or more to write.

Sounds like a fun problem for someone that has the time.
 
Last edited:
Upvote 0
Here's some rows of the compatibility list:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][td="bgcolor:#C0C0C0"]
I​
[/td][td="bgcolor:#C0C0C0"]
J​
[/td][td="bgcolor:#C0C0C0"]
K​
[/td][td="bgcolor:#C0C0C0"]
L​
[/td][td="bgcolor:#C0C0C0"]
M​
[/td][td="bgcolor:#C0C0C0"]
N​
[/td][td="bgcolor:#C0C0C0"]
O​
[/td][td="bgcolor:#C0C0C0"]
P​
[/td][td="bgcolor:#C0C0C0"]
Q​
[/td][td="bgcolor:#C0C0C0"]
R​
[/td][td="bgcolor:#C0C0C0"]
S​
[/td][td="bgcolor:#C0C0C0"]
T​
[/td][td="bgcolor:#C0C0C0"]
U​
[/td][td="bgcolor:#C0C0C0"]
V​
[/td][td="bgcolor:#C0C0C0"]
W​
[/td][td="bgcolor:#C0C0C0"]
X​
[/td][td="bgcolor:#C0C0C0"]
Y​
[/td][td="bgcolor:#C0C0C0"]
Z​
[/td][td="bgcolor:#C0C0C0"]
AA​
[/td][td="bgcolor:#C0C0C0"]
AB​
[/td][td="bgcolor:#C0C0C0"]
AC​
[/td][td="bgcolor:#C0C0C0"]
AD​
[/td][td="bgcolor:#C0C0C0"]
AE​
[/td][td="bgcolor:#C0C0C0"]
AF​
[/td][td="bgcolor:#C0C0C0"]
AG​
[/td][td="bgcolor:#C0C0C0"]
AH​
[/td][td="bgcolor:#C0C0C0"]
AI​
[/td][td="bgcolor:#C0C0C0"]
AJ​
[/td][td="bgcolor:#C0C0C0"]
AK​
[/td][td="bgcolor:#C0C0C0"]
AL​
[/td][td="bgcolor:#C0C0C0"]
AM​
[/td][td="bgcolor:#C0C0C0"]
AN​
[/td][td="bgcolor:#C0C0C0"]
AO​
[/td][td="bgcolor:#C0C0C0"]
AP​
[/td][td="bgcolor:#C0C0C0"]
AQ​
[/td][td="bgcolor:#C0C0C0"]
AR​
[/td][td="bgcolor:#C0C0C0"]
AS​
[/td][td="bgcolor:#C0C0C0"]
AT​
[/td][td="bgcolor:#C0C0C0"]
AU​
[/td][td="bgcolor:#C0C0C0"]
AV​
[/td][td="bgcolor:#C0C0C0"]
AW​
[/td][td="bgcolor:#C0C0C0"]
AX​
[/td][td="bgcolor:#C0C0C0"]
AY​
[/td][td="bgcolor:#C0C0C0"]
AZ​
[/td][td="bgcolor:#C0C0C0"]
BA​
[/td][td="bgcolor:#C0C0C0"]
BB​
[/td][td="bgcolor:#C0C0C0"]
BC​
[/td][td="bgcolor:#C0C0C0"]
BD​
[/td][td="bgcolor:#C0C0C0"]
BE​
[/td][td="bgcolor:#C0C0C0"]
BF​
[/td][td="bgcolor:#C0C0C0"]
BG​
[/td][td="bgcolor:#C0C0C0"]
BH​
[/td][td="bgcolor:#C0C0C0"]
BI​
[/td][td="bgcolor:#C0C0C0"]
BJ​
[/td][td="bgcolor:#C0C0C0"]
BK​
[/td][td="bgcolor:#C0C0C0"]
BL​
[/td][td="bgcolor:#C0C0C0"]
BM​
[/td][td="bgcolor:#C0C0C0"]
BN​
[/td][td="bgcolor:#C0C0C0"]
BO​
[/td][td="bgcolor:#C0C0C0"]
BP​
[/td][td="bgcolor:#C0C0C0"]
BQ​
[/td][td="bgcolor:#C0C0C0"]
BR​
[/td][td="bgcolor:#C0C0C0"]
BS​
[/td][td="bgcolor:#C0C0C0"]
BT​
[/td][td="bgcolor:#C0C0C0"]
BU​
[/td][td="bgcolor:#C0C0C0"]
BV​
[/td][td="bgcolor:#C0C0C0"]
BW​
[/td][td="bgcolor:#C0C0C0"]
BX​
[/td][td="bgcolor:#C0C0C0"]
BY​
[/td][td="bgcolor:#C0C0C0"]
BZ​
[/td][td="bgcolor:#C0C0C0"]
CA​
[/td][td="bgcolor:#C0C0C0"]
CB​
[/td][td="bgcolor:#C0C0C0"]
CC​
[/td][td="bgcolor:#C0C0C0"]
CD​
[/td][td="bgcolor:#C0C0C0"]
CE​
[/td][td="bgcolor:#C0C0C0"]
CF​
[/td][td="bgcolor:#C0C0C0"]
CG​
[/td][td="bgcolor:#C0C0C0"]
CH​
[/td][td="bgcolor:#C0C0C0"]
CI​
[/td][td="bgcolor:#C0C0C0"]
CJ​
[/td][td="bgcolor:#C0C0C0"]
CK​
[/td][td="bgcolor:#C0C0C0"]
CL​
[/td][td="bgcolor:#C0C0C0"]
CM​
[/td][td="bgcolor:#C0C0C0"]
CN​
[/td][td="bgcolor:#C0C0C0"]
CO​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td="bgcolor:#F3F3F3"]
Node
[/td][td="bgcolor:#F3F3F3"]
Loca
[/td][td="bgcolor:#F3F3F3"]
Loc2
[/td][td="bgcolor:#F3F3F3"]
Loc3
[/td][td="bgcolor:#F3F3F3"]
Value
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td]
1​
[/td][td]
F​
[/td][td]
A​
[/td][td]
O​
[/td][td]
16,566.87​
[/td][td][/td][td]
13​
[/td][td]
15​
[/td][td]
19​
[/td][td]
22​
[/td][td]
24​
[/td][td]
31​
[/td][td]
35​
[/td][td]
39​
[/td][td]
42​
[/td][td]
46​
[/td][td]
47​
[/td][td]
53​
[/td][td]
57​
[/td][td]
59​
[/td][td]
66​
[/td][td]
67​
[/td][td]
68​
[/td][td]
70​
[/td][td]
73​
[/td][td]
74​
[/td][td]
76​
[/td][td]
80​
[/td][td]
81​
[/td][td]
83​
[/td][td]
93​
[/td][td]
102​
[/td][td]
107​
[/td][td]
108​
[/td][td]
110​
[/td][td]
112​
[/td][td]
114​
[/td][td]
120​
[/td][td]
125​
[/td][td]
126​
[/td][td]
127​
[/td][td]
131​
[/td][td]
133​
[/td][td]
135​
[/td][td]
137​
[/td][td]
144​
[/td][td]
149​
[/td][td]
150​
[/td][td]
151​
[/td][td]
159​
[/td][td]
160​
[/td][td]
161​
[/td][td]
164​
[/td][td]
165​
[/td][td]
169​
[/td][td]
172​
[/td][td]
174​
[/td][td]
177​
[/td][td]
178​
[/td][td]
179​
[/td][td]
187​
[/td][td]
189​
[/td][td]
193​
[/td][td]
196​
[/td][td]
197​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td]
13​
[/td][td]
M​
[/td][td]
K​
[/td][td]
N​
[/td][td]
12,126.41​
[/td][td][/td][td]
14​
[/td][td]
17​
[/td][td="bgcolor:#99FF99"]
19​
[/td][td]
20​
[/td][td]
23​
[/td][td]
25​
[/td][td]
26​
[/td][td]
28​
[/td][td]
29​
[/td][td]
38​
[/td][td="bgcolor:#99FF99"]
42​
[/td][td]
43​
[/td][td]
45​
[/td][td]
49​
[/td][td]
50​
[/td][td]
56​
[/td][td]
58​
[/td][td="bgcolor:#99FF99"]
59​
[/td][td]
72​
[/td][td="bgcolor:#99FF99"]
74​
[/td][td]
75​
[/td][td]
77​
[/td][td="bgcolor:#99FF99"]
83​
[/td][td]
84​
[/td][td]
85​
[/td][td]
86​
[/td][td]
87​
[/td][td]
90​
[/td][td]
92​
[/td][td="bgcolor:#99FF99"]
93​
[/td][td]
94​
[/td][td]
97​
[/td][td]
98​
[/td][td]
99​
[/td][td]
100​
[/td][td]
101​
[/td][td="bgcolor:#99FF99"]
102​
[/td][td]
103​
[/td][td]
104​
[/td][td]
105​
[/td][td]
106​
[/td][td]
109​
[/td][td="bgcolor:#99FF99"]
110​
[/td][td]
115​
[/td][td]
116​
[/td][td]
117​
[/td][td]
118​
[/td][td]
119​
[/td][td="bgcolor:#99FF99"]
120​
[/td][td]
121​
[/td][td]
122​
[/td][td]
129​
[/td][td]
130​
[/td][td]
132​
[/td][td]
134​
[/td][td="bgcolor:#99FF99"]
135​
[/td][td]
136​
[/td][td]
138​
[/td][td]
139​
[/td][td]
140​
[/td][td]
141​
[/td][td]
145​
[/td][td="bgcolor:#99FF99"]
150​
[/td][td]
152​
[/td][td]
154​
[/td][td]
155​
[/td][td]
156​
[/td][td]
158​
[/td][td="bgcolor:#99FF99"]
159​
[/td][td="bgcolor:#99FF99"]
165​
[/td][td]
168​
[/td][td="bgcolor:#99FF99"]
169​
[/td][td]
171​
[/td][td]
173​
[/td][td]
176​
[/td][td="bgcolor:#99FF99"]
178​
[/td][td]
180​
[/td][td]
181​
[/td][td]
182​
[/td][td]
183​
[/td][td]
184​
[/td][td]
186​
[/td][td]
190​
[/td][td]
192​
[/td][td]
194​
[/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td]
19​
[/td][td]
E​
[/td][td]
I​
[/td][td]
J​
[/td][td]
10,610.69​
[/td][td][/td][td]
20​
[/td][td]
21​
[/td][td]
25​
[/td][td]
26​
[/td][td]
27​
[/td][td]
30​
[/td][td]
32​
[/td][td]
33​
[/td][td]
36​
[/td][td]
37​
[/td][td]
44​
[/td][td]
45​
[/td][td]
47​
[/td][td]
48​
[/td][td]
51​
[/td][td]
52​
[/td][td]
54​
[/td][td]
56​
[/td][td]
57​
[/td][td]
58​
[/td][td]
61​
[/td][td]
62​
[/td][td]
63​
[/td][td]
64​
[/td][td]
65​
[/td][td]
69​
[/td][td="bgcolor:#99FF99"]
74​
[/td][td]
75​
[/td][td]
76​
[/td][td]
77​
[/td][td]
78​
[/td][td]
82​
[/td][td]
84​
[/td][td]
86​
[/td][td]
87​
[/td][td]
89​
[/td][td]
90​
[/td][td]
91​
[/td][td="bgcolor:#99FF99"]
93​
[/td][td]
96​
[/td][td]
98​
[/td][td]
99​
[/td][td]
105​
[/td][td]
109​
[/td][td]
114​
[/td][td]
115​
[/td][td]
116​
[/td][td]
121​
[/td][td]
124​
[/td][td]
125​
[/td][td]
127​
[/td][td]
128​
[/td][td]
129​
[/td][td]
130​
[/td][td]
131​
[/td][td]
132​
[/td][td]
137​
[/td][td]
138​
[/td][td]
139​
[/td][td]
140​
[/td][td]
142​
[/td][td]
148​
[/td][td]
149​
[/td][td]
151​
[/td][td]
153​
[/td][td]
155​
[/td][td]
158​
[/td][td="bgcolor:#99FF99"]
159​
[/td][td]
160​
[/td][td]
162​
[/td][td]
167​
[/td][td]
168​
[/td][td]
171​
[/td][td]
175​
[/td][td]
179​
[/td][td]
180​
[/td][td]
183​
[/td][td]
184​
[/td][td]
185​
[/td][td]
186​
[/td][td]
188​
[/td][td]
189​
[/td][td]
191​
[/td][td]
193​
[/td][td]
194​
[/td][td]
195​
[/td][td]
197​
[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
75​
[/td][td]
74​
[/td][td]
Q​
[/td][td]
T​
[/td][td]
R​
[/td][td]
5,550.24​
[/td][td][/td][td]
75​
[/td][td]
79​
[/td][td]
81​
[/td][td]
82​
[/td][td]
83​
[/td][td]
85​
[/td][td]
88​
[/td][td]
89​
[/td][td]
90​
[/td][td]
91​
[/td][td="bgcolor:#99FF99"]
93​
[/td][td]
94​
[/td][td]
95​
[/td][td]
96​
[/td][td]
100​
[/td][td]
101​
[/td][td]
102​
[/td][td]
103​
[/td][td]
104​
[/td][td]
105​
[/td][td]
106​
[/td][td]
107​
[/td][td]
108​
[/td][td]
109​
[/td][td]
110​
[/td][td]
111​
[/td][td]
112​
[/td][td]
113​
[/td][td]
114​
[/td][td]
118​
[/td][td]
120​
[/td][td]
121​
[/td][td]
122​
[/td][td]
123​
[/td][td]
126​
[/td][td]
127​
[/td][td]
129​
[/td][td]
130​
[/td][td]
131​
[/td][td]
133​
[/td][td]
134​
[/td][td]
135​
[/td][td]
136​
[/td][td]
138​
[/td][td]
139​
[/td][td]
141​
[/td][td]
143​
[/td][td]
144​
[/td][td]
145​
[/td][td]
146​
[/td][td]
147​
[/td][td]
148​
[/td][td]
149​
[/td][td]
150​
[/td][td]
152​
[/td][td]
153​
[/td][td]
154​
[/td][td]
156​
[/td][td]
157​
[/td][td]
158​
[/td][td]
160​
[/td][td]
161​
[/td][td]
163​
[/td][td]
164​
[/td][td]
166​
[/td][td]
170​
[/td][td]
172​
[/td][td]
173​
[/td][td]
174​
[/td][td]
175​
[/td][td]
176​
[/td][td]
177​
[/td][td]
181​
[/td][td]
182​
[/td][td]
183​
[/td][td]
188​
[/td][td]
192​
[/td][td]
194​
[/td][td]
195​
[/td][td]
196​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
94​
[/td][td]
93​
[/td][td]
G​
[/td][td]
H​
[/td][td]
C​
[/td][td]
4,695.31​
[/td][td][/td][td]
94​
[/td][td]
95​
[/td][td]
97​
[/td][td]
98​
[/td][td]
99​
[/td][td]
100​
[/td][td]
101​
[/td][td]
106​
[/td][td]
107​
[/td][td]
108​
[/td][td]
109​
[/td][td]
110​
[/td][td]
111​
[/td][td]
113​
[/td][td]
115​
[/td][td]
116​
[/td][td]
117​
[/td][td]
118​
[/td][td]
119​
[/td][td]
122​
[/td][td]
123​
[/td][td]
124​
[/td][td]
125​
[/td][td]
126​
[/td][td]
128​
[/td][td]
132​
[/td][td]
133​
[/td][td]
136​
[/td][td]
137​
[/td][td]
138​
[/td][td]
140​
[/td][td]
142​
[/td][td]
143​
[/td][td]
144​
[/td][td]
145​
[/td][td]
146​
[/td][td]
147​
[/td][td]
148​
[/td][td]
149​
[/td][td]
151​
[/td][td]
152​
[/td][td]
154​
[/td][td]
155​
[/td][td]
157​
[/td][td]
159​
[/td][td]
162​
[/td][td]
163​
[/td][td]
165​
[/td][td]
166​
[/td][td]
167​
[/td][td]
168​
[/td][td]
169​
[/td][td]
170​
[/td][td]
172​
[/td][td]
176​
[/td][td]
178​
[/td][td]
180​
[/td][td]
181​
[/td][td]
185​
[/td][td]
186​
[/td][td]
187​
[/td][td]
188​
[/td][td]
189​
[/td][td]
190​
[/td][td]
191​
[/td][td]
193​
[/td][td]
194​
[/td][td]
195​
[/td][td]
197​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


The highlights on row 13 are the choices available after node 1 > node 13, and on row 19 the choices available after node 1 > node 13 > node 19.
 
Upvote 0
Hello Stephen,

I am sorry, I did not clarify that. I do not need to visit all 20 locations, the main idea is to find the biggest total income regardless on how many locations is visited. Thank you.

The number of combinations to test should be manageable, because of the constraints about not visiting the same location twice.

But a question first ...

Your result shows the income for five trips = 15 locations, but you actually have 20 locations (A, B ... T).

Do you need to visit all 20 locations (in which case there will necessarily be at least one duplicate)?

Or are you looking to maximise the income for a general N trips, minimising the number of duplicates, where N in this case happens to be 5?
 
Upvote 0
Hi shg,

Thank you for your input, it's a good overview and actually interesting idea how to approach this problem :) However, do you think it can be solver somehow e.g. imagine that node are sort in a different way it means that node 1 will be changed to number 6 not combination F, A, O will not be anymore marked as node 1 but as node 6, just an example. Because now I have all nodes sort by the highest value but it is not mandatory it can be sort however. It can be also said that it does not matter how it is sort but I am looking for the best sort which will lead to getting the biggest total income (value) :)

I know I have been actually struggling with this problem for a week but unfortunately, I am not so skillful in Excel in order to figure it out :(

Here's some rows of the compatibility list:

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #C0C0C0"][/TD]
[TD="bgcolor: #C0C0C0"]
A​
[/TD]
[TD="bgcolor: #C0C0C0"]
B​
[/TD]
[TD="bgcolor: #C0C0C0"]
C​
[/TD]
[TD="bgcolor: #C0C0C0"]
D​
[/TD]
[TD="bgcolor: #C0C0C0"]
E​
[/TD]
[TD="bgcolor: #C0C0C0"]
F​
[/TD]
[TD="bgcolor: #C0C0C0"]
G​
[/TD]
[TD="bgcolor: #C0C0C0"]
H​
[/TD]
[TD="bgcolor: #C0C0C0"]
I​
[/TD]
[TD="bgcolor: #C0C0C0"]
J​
[/TD]
[TD="bgcolor: #C0C0C0"]
K​
[/TD]
[TD="bgcolor: #C0C0C0"]
L​
[/TD]
[TD="bgcolor: #C0C0C0"]
M​
[/TD]
[TD="bgcolor: #C0C0C0"]
N​
[/TD]
[TD="bgcolor: #C0C0C0"]
O​
[/TD]
[TD="bgcolor: #C0C0C0"]
P​
[/TD]
[TD="bgcolor: #C0C0C0"]
Q​
[/TD]
[TD="bgcolor: #C0C0C0"]
R​
[/TD]
[TD="bgcolor: #C0C0C0"]
S​
[/TD]
[TD="bgcolor: #C0C0C0"]
T​
[/TD]
[TD="bgcolor: #C0C0C0"]
U​
[/TD]
[TD="bgcolor: #C0C0C0"]
V​
[/TD]
[TD="bgcolor: #C0C0C0"]
W​
[/TD]
[TD="bgcolor: #C0C0C0"]
X​
[/TD]
[TD="bgcolor: #C0C0C0"]
Y​
[/TD]
[TD="bgcolor: #C0C0C0"]
Z​
[/TD]
[TD="bgcolor: #C0C0C0"]
AA​
[/TD]
[TD="bgcolor: #C0C0C0"]
AB​
[/TD]
[TD="bgcolor: #C0C0C0"]
AC​
[/TD]
[TD="bgcolor: #C0C0C0"]
AD​
[/TD]
[TD="bgcolor: #C0C0C0"]
AE​
[/TD]
[TD="bgcolor: #C0C0C0"]
AF​
[/TD]
[TD="bgcolor: #C0C0C0"]
AG​
[/TD]
[TD="bgcolor: #C0C0C0"]
AH​
[/TD]
[TD="bgcolor: #C0C0C0"]
AI​
[/TD]
[TD="bgcolor: #C0C0C0"]
AJ​
[/TD]
[TD="bgcolor: #C0C0C0"]
AK​
[/TD]
[TD="bgcolor: #C0C0C0"]
AL​
[/TD]
[TD="bgcolor: #C0C0C0"]
AM​
[/TD]
[TD="bgcolor: #C0C0C0"]
AN​
[/TD]
[TD="bgcolor: #C0C0C0"]
AO​
[/TD]
[TD="bgcolor: #C0C0C0"]
AP​
[/TD]
[TD="bgcolor: #C0C0C0"]
AQ​
[/TD]
[TD="bgcolor: #C0C0C0"]
AR​
[/TD]
[TD="bgcolor: #C0C0C0"]
AS​
[/TD]
[TD="bgcolor: #C0C0C0"]
AT​
[/TD]
[TD="bgcolor: #C0C0C0"]
AU​
[/TD]
[TD="bgcolor: #C0C0C0"]
AV​
[/TD]
[TD="bgcolor: #C0C0C0"]
AW​
[/TD]
[TD="bgcolor: #C0C0C0"]
AX​
[/TD]
[TD="bgcolor: #C0C0C0"]
AY​
[/TD]
[TD="bgcolor: #C0C0C0"]
AZ​
[/TD]
[TD="bgcolor: #C0C0C0"]
BA​
[/TD]
[TD="bgcolor: #C0C0C0"]
BB​
[/TD]
[TD="bgcolor: #C0C0C0"]
BC​
[/TD]
[TD="bgcolor: #C0C0C0"]
BD​
[/TD]
[TD="bgcolor: #C0C0C0"]
BE​
[/TD]
[TD="bgcolor: #C0C0C0"]
BF​
[/TD]
[TD="bgcolor: #C0C0C0"]
BG​
[/TD]
[TD="bgcolor: #C0C0C0"]
BH​
[/TD]
[TD="bgcolor: #C0C0C0"]
BI​
[/TD]
[TD="bgcolor: #C0C0C0"]
BJ​
[/TD]
[TD="bgcolor: #C0C0C0"]
BK​
[/TD]
[TD="bgcolor: #C0C0C0"]
BL​
[/TD]
[TD="bgcolor: #C0C0C0"]
BM​
[/TD]
[TD="bgcolor: #C0C0C0"]
BN​
[/TD]
[TD="bgcolor: #C0C0C0"]
BO​
[/TD]
[TD="bgcolor: #C0C0C0"]
BP​
[/TD]
[TD="bgcolor: #C0C0C0"]
BQ​
[/TD]
[TD="bgcolor: #C0C0C0"]
BR​
[/TD]
[TD="bgcolor: #C0C0C0"]
BS​
[/TD]
[TD="bgcolor: #C0C0C0"]
BT​
[/TD]
[TD="bgcolor: #C0C0C0"]
BU​
[/TD]
[TD="bgcolor: #C0C0C0"]
BV​
[/TD]
[TD="bgcolor: #C0C0C0"]
BW​
[/TD]
[TD="bgcolor: #C0C0C0"]
BX​
[/TD]
[TD="bgcolor: #C0C0C0"]
BY​
[/TD]
[TD="bgcolor: #C0C0C0"]
BZ​
[/TD]
[TD="bgcolor: #C0C0C0"]
CA​
[/TD]
[TD="bgcolor: #C0C0C0"]
CB​
[/TD]
[TD="bgcolor: #C0C0C0"]
CC​
[/TD]
[TD="bgcolor: #C0C0C0"]
CD​
[/TD]
[TD="bgcolor: #C0C0C0"]
CE​
[/TD]
[TD="bgcolor: #C0C0C0"]
CF​
[/TD]
[TD="bgcolor: #C0C0C0"]
CG​
[/TD]
[TD="bgcolor: #C0C0C0"]
CH​
[/TD]
[TD="bgcolor: #C0C0C0"]
CI​
[/TD]
[TD="bgcolor: #C0C0C0"]
CJ​
[/TD]
[TD="bgcolor: #C0C0C0"]
CK​
[/TD]
[TD="bgcolor: #C0C0C0"]
CL​
[/TD]
[TD="bgcolor: #C0C0C0"]
CM​
[/TD]
[TD="bgcolor: #C0C0C0"]
CN​
[/TD]
[TD="bgcolor: #C0C0C0"]
CO​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
1​
[/TD]
[TD="bgcolor: #F3F3F3"]
Node
[/TD]
[TD="bgcolor: #F3F3F3"]
Loca
[/TD]
[TD="bgcolor: #F3F3F3"]
Loc2
[/TD]
[TD="bgcolor: #F3F3F3"]
Loc3
[/TD]
[TD="bgcolor: #F3F3F3"]
Value
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
2​
[/TD]
[TD]
1​
[/TD]
[TD]
F​
[/TD]
[TD]
A​
[/TD]
[TD]
O​
[/TD]
[TD]
16,566.87​
[/TD]
[TD][/TD]
[TD]
13​
[/TD]
[TD]
15​
[/TD]
[TD]
19​
[/TD]
[TD]
22​
[/TD]
[TD]
24​
[/TD]
[TD]
31​
[/TD]
[TD]
35​
[/TD]
[TD]
39​
[/TD]
[TD]
42​
[/TD]
[TD]
46​
[/TD]
[TD]
47​
[/TD]
[TD]
53​
[/TD]
[TD]
57​
[/TD]
[TD]
59​
[/TD]
[TD]
66​
[/TD]
[TD]
67​
[/TD]
[TD]
68​
[/TD]
[TD]
70​
[/TD]
[TD]
73​
[/TD]
[TD]
74​
[/TD]
[TD]
76​
[/TD]
[TD]
80​
[/TD]
[TD]
81​
[/TD]
[TD]
83​
[/TD]
[TD]
93​
[/TD]
[TD]
102​
[/TD]
[TD]
107​
[/TD]
[TD]
108​
[/TD]
[TD]
110​
[/TD]
[TD]
112​
[/TD]
[TD]
114​
[/TD]
[TD]
120​
[/TD]
[TD]
125​
[/TD]
[TD]
126​
[/TD]
[TD]
127​
[/TD]
[TD]
131​
[/TD]
[TD]
133​
[/TD]
[TD]
135​
[/TD]
[TD]
137​
[/TD]
[TD]
144​
[/TD]
[TD]
149​
[/TD]
[TD]
150​
[/TD]
[TD]
151​
[/TD]
[TD]
159​
[/TD]
[TD]
160​
[/TD]
[TD]
161​
[/TD]
[TD]
164​
[/TD]
[TD]
165​
[/TD]
[TD]
169​
[/TD]
[TD]
172​
[/TD]
[TD]
174​
[/TD]
[TD]
177​
[/TD]
[TD]
178​
[/TD]
[TD]
179​
[/TD]
[TD]
187​
[/TD]
[TD]
189​
[/TD]
[TD]
193​
[/TD]
[TD]
196​
[/TD]
[TD]
197​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
14​
[/TD]
[TD]
13​
[/TD]
[TD]
M​
[/TD]
[TD]
K​
[/TD]
[TD]
N​
[/TD]
[TD]
12,126.41​
[/TD]
[TD][/TD]
[TD]
14​
[/TD]
[TD]
17​
[/TD]
[TD="bgcolor: #99FF99"]
19​
[/TD]
[TD]
20​
[/TD]
[TD]
23​
[/TD]
[TD]
25​
[/TD]
[TD]
26​
[/TD]
[TD]
28​
[/TD]
[TD]
29​
[/TD]
[TD]
38​
[/TD]
[TD="bgcolor: #99FF99"]
42​
[/TD]
[TD]
43​
[/TD]
[TD]
45​
[/TD]
[TD]
49​
[/TD]
[TD]
50​
[/TD]
[TD]
56​
[/TD]
[TD]
58​
[/TD]
[TD="bgcolor: #99FF99"]
59​
[/TD]
[TD]
72​
[/TD]
[TD="bgcolor: #99FF99"]
74​
[/TD]
[TD]
75​
[/TD]
[TD]
77​
[/TD]
[TD="bgcolor: #99FF99"]
83​
[/TD]
[TD]
84​
[/TD]
[TD]
85​
[/TD]
[TD]
86​
[/TD]
[TD]
87​
[/TD]
[TD]
90​
[/TD]
[TD]
92​
[/TD]
[TD="bgcolor: #99FF99"]
93​
[/TD]
[TD]
94​
[/TD]
[TD]
97​
[/TD]
[TD]
98​
[/TD]
[TD]
99​
[/TD]
[TD]
100​
[/TD]
[TD]
101​
[/TD]
[TD="bgcolor: #99FF99"]
102​
[/TD]
[TD]
103​
[/TD]
[TD]
104​
[/TD]
[TD]
105​
[/TD]
[TD]
106​
[/TD]
[TD]
109​
[/TD]
[TD="bgcolor: #99FF99"]
110​
[/TD]
[TD]
115​
[/TD]
[TD]
116​
[/TD]
[TD]
117​
[/TD]
[TD]
118​
[/TD]
[TD]
119​
[/TD]
[TD="bgcolor: #99FF99"]
120​
[/TD]
[TD]
121​
[/TD]
[TD]
122​
[/TD]
[TD]
129​
[/TD]
[TD]
130​
[/TD]
[TD]
132​
[/TD]
[TD]
134​
[/TD]
[TD="bgcolor: #99FF99"]
135​
[/TD]
[TD]
136​
[/TD]
[TD]
138​
[/TD]
[TD]
139​
[/TD]
[TD]
140​
[/TD]
[TD]
141​
[/TD]
[TD]
145​
[/TD]
[TD="bgcolor: #99FF99"]
150​
[/TD]
[TD]
152​
[/TD]
[TD]
154​
[/TD]
[TD]
155​
[/TD]
[TD]
156​
[/TD]
[TD]
158​
[/TD]
[TD="bgcolor: #99FF99"]
159​
[/TD]
[TD="bgcolor: #99FF99"]
165​
[/TD]
[TD]
168​
[/TD]
[TD="bgcolor: #99FF99"]
169​
[/TD]
[TD]
171​
[/TD]
[TD]
173​
[/TD]
[TD]
176​
[/TD]
[TD="bgcolor: #99FF99"]
178​
[/TD]
[TD]
180​
[/TD]
[TD]
181​
[/TD]
[TD]
182​
[/TD]
[TD]
183​
[/TD]
[TD]
184​
[/TD]
[TD]
186​
[/TD]
[TD]
190​
[/TD]
[TD]
192​
[/TD]
[TD]
194​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
20​
[/TD]
[TD]
19​
[/TD]
[TD]
E​
[/TD]
[TD]
I​
[/TD]
[TD]
J​
[/TD]
[TD]
10,610.69​
[/TD]
[TD][/TD]
[TD]
20​
[/TD]
[TD]
21​
[/TD]
[TD]
25​
[/TD]
[TD]
26​
[/TD]
[TD]
27​
[/TD]
[TD]
30​
[/TD]
[TD]
32​
[/TD]
[TD]
33​
[/TD]
[TD]
36​
[/TD]
[TD]
37​
[/TD]
[TD]
44​
[/TD]
[TD]
45​
[/TD]
[TD]
47​
[/TD]
[TD]
48​
[/TD]
[TD]
51​
[/TD]
[TD]
52​
[/TD]
[TD]
54​
[/TD]
[TD]
56​
[/TD]
[TD]
57​
[/TD]
[TD]
58​
[/TD]
[TD]
61​
[/TD]
[TD]
62​
[/TD]
[TD]
63​
[/TD]
[TD]
64​
[/TD]
[TD]
65​
[/TD]
[TD]
69​
[/TD]
[TD="bgcolor: #99FF99"]
74​
[/TD]
[TD]
75​
[/TD]
[TD]
76​
[/TD]
[TD]
77​
[/TD]
[TD]
78​
[/TD]
[TD]
82​
[/TD]
[TD]
84​
[/TD]
[TD]
86​
[/TD]
[TD]
87​
[/TD]
[TD]
89​
[/TD]
[TD]
90​
[/TD]
[TD]
91​
[/TD]
[TD="bgcolor: #99FF99"]
93​
[/TD]
[TD]
96​
[/TD]
[TD]
98​
[/TD]
[TD]
99​
[/TD]
[TD]
105​
[/TD]
[TD]
109​
[/TD]
[TD]
114​
[/TD]
[TD]
115​
[/TD]
[TD]
116​
[/TD]
[TD]
121​
[/TD]
[TD]
124​
[/TD]
[TD]
125​
[/TD]
[TD]
127​
[/TD]
[TD]
128​
[/TD]
[TD]
129​
[/TD]
[TD]
130​
[/TD]
[TD]
131​
[/TD]
[TD]
132​
[/TD]
[TD]
137​
[/TD]
[TD]
138​
[/TD]
[TD]
139​
[/TD]
[TD]
140​
[/TD]
[TD]
142​
[/TD]
[TD]
148​
[/TD]
[TD]
149​
[/TD]
[TD]
151​
[/TD]
[TD]
153​
[/TD]
[TD]
155​
[/TD]
[TD]
158​
[/TD]
[TD="bgcolor: #99FF99"]
159​
[/TD]
[TD]
160​
[/TD]
[TD]
162​
[/TD]
[TD]
167​
[/TD]
[TD]
168​
[/TD]
[TD]
171​
[/TD]
[TD]
175​
[/TD]
[TD]
179​
[/TD]
[TD]
180​
[/TD]
[TD]
183​
[/TD]
[TD]
184​
[/TD]
[TD]
185​
[/TD]
[TD]
186​
[/TD]
[TD]
188​
[/TD]
[TD]
189​
[/TD]
[TD]
191​
[/TD]
[TD]
193​
[/TD]
[TD]
194​
[/TD]
[TD]
195​
[/TD]
[TD]
197​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
75​
[/TD]
[TD]
74​
[/TD]
[TD]
Q​
[/TD]
[TD]
T​
[/TD]
[TD]
R​
[/TD]
[TD]
5,550.24​
[/TD]
[TD][/TD]
[TD]
75​
[/TD]
[TD]
79​
[/TD]
[TD]
81​
[/TD]
[TD]
82​
[/TD]
[TD]
83​
[/TD]
[TD]
85​
[/TD]
[TD]
88​
[/TD]
[TD]
89​
[/TD]
[TD]
90​
[/TD]
[TD]
91​
[/TD]
[TD="bgcolor: #99FF99"]
93​
[/TD]
[TD]
94​
[/TD]
[TD]
95​
[/TD]
[TD]
96​
[/TD]
[TD]
100​
[/TD]
[TD]
101​
[/TD]
[TD]
102​
[/TD]
[TD]
103​
[/TD]
[TD]
104​
[/TD]
[TD]
105​
[/TD]
[TD]
106​
[/TD]
[TD]
107​
[/TD]
[TD]
108​
[/TD]
[TD]
109​
[/TD]
[TD]
110​
[/TD]
[TD]
111​
[/TD]
[TD]
112​
[/TD]
[TD]
113​
[/TD]
[TD]
114​
[/TD]
[TD]
118​
[/TD]
[TD]
120​
[/TD]
[TD]
121​
[/TD]
[TD]
122​
[/TD]
[TD]
123​
[/TD]
[TD]
126​
[/TD]
[TD]
127​
[/TD]
[TD]
129​
[/TD]
[TD]
130​
[/TD]
[TD]
131​
[/TD]
[TD]
133​
[/TD]
[TD]
134​
[/TD]
[TD]
135​
[/TD]
[TD]
136​
[/TD]
[TD]
138​
[/TD]
[TD]
139​
[/TD]
[TD]
141​
[/TD]
[TD]
143​
[/TD]
[TD]
144​
[/TD]
[TD]
145​
[/TD]
[TD]
146​
[/TD]
[TD]
147​
[/TD]
[TD]
148​
[/TD]
[TD]
149​
[/TD]
[TD]
150​
[/TD]
[TD]
152​
[/TD]
[TD]
153​
[/TD]
[TD]
154​
[/TD]
[TD]
156​
[/TD]
[TD]
157​
[/TD]
[TD]
158​
[/TD]
[TD]
160​
[/TD]
[TD]
161​
[/TD]
[TD]
163​
[/TD]
[TD]
164​
[/TD]
[TD]
166​
[/TD]
[TD]
170​
[/TD]
[TD]
172​
[/TD]
[TD]
173​
[/TD]
[TD]
174​
[/TD]
[TD]
175​
[/TD]
[TD]
176​
[/TD]
[TD]
177​
[/TD]
[TD]
181​
[/TD]
[TD]
182​
[/TD]
[TD]
183​
[/TD]
[TD]
188​
[/TD]
[TD]
192​
[/TD]
[TD]
194​
[/TD]
[TD]
195​
[/TD]
[TD]
196​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
94​
[/TD]
[TD]
93​
[/TD]
[TD]
G​
[/TD]
[TD]
H​
[/TD]
[TD]
C​
[/TD]
[TD]
4,695.31​
[/TD]
[TD][/TD]
[TD]
94​
[/TD]
[TD]
95​
[/TD]
[TD]
97​
[/TD]
[TD]
98​
[/TD]
[TD]
99​
[/TD]
[TD]
100​
[/TD]
[TD]
101​
[/TD]
[TD]
106​
[/TD]
[TD]
107​
[/TD]
[TD]
108​
[/TD]
[TD]
109​
[/TD]
[TD]
110​
[/TD]
[TD]
111​
[/TD]
[TD]
113​
[/TD]
[TD]
115​
[/TD]
[TD]
116​
[/TD]
[TD]
117​
[/TD]
[TD]
118​
[/TD]
[TD]
119​
[/TD]
[TD]
122​
[/TD]
[TD]
123​
[/TD]
[TD]
124​
[/TD]
[TD]
125​
[/TD]
[TD]
126​
[/TD]
[TD]
128​
[/TD]
[TD]
132​
[/TD]
[TD]
133​
[/TD]
[TD]
136​
[/TD]
[TD]
137​
[/TD]
[TD]
138​
[/TD]
[TD]
140​
[/TD]
[TD]
142​
[/TD]
[TD]
143​
[/TD]
[TD]
144​
[/TD]
[TD]
145​
[/TD]
[TD]
146​
[/TD]
[TD]
147​
[/TD]
[TD]
148​
[/TD]
[TD]
149​
[/TD]
[TD]
151​
[/TD]
[TD]
152​
[/TD]
[TD]
154​
[/TD]
[TD]
155​
[/TD]
[TD]
157​
[/TD]
[TD]
159​
[/TD]
[TD]
162​
[/TD]
[TD]
163​
[/TD]
[TD]
165​
[/TD]
[TD]
166​
[/TD]
[TD]
167​
[/TD]
[TD]
168​
[/TD]
[TD]
169​
[/TD]
[TD]
170​
[/TD]
[TD]
172​
[/TD]
[TD]
176​
[/TD]
[TD]
178​
[/TD]
[TD]
180​
[/TD]
[TD]
181​
[/TD]
[TD]
185​
[/TD]
[TD]
186​
[/TD]
[TD]
187​
[/TD]
[TD]
188​
[/TD]
[TD]
189​
[/TD]
[TD]
190​
[/TD]
[TD]
191​
[/TD]
[TD]
193​
[/TD]
[TD]
194​
[/TD]
[TD]
195​
[/TD]
[TD]
197​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


The highlights on row 13 are the choices available after node 1 > node 13, and on row 19 the choices available after node 1 > node 13 > node 19.
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...005-complex-combinatorial-sort-vba-macro.html

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Using a Boolean tree, along shg's lines, it doesn't matter how your data is sorted:

Workbook: https://app.box.com/s/1j9osr2lbobb1sml21ujjnpo0wtttbnj

Code:
Dim vIncome As Variant
Dim dMax As Double
Dim lCombination() As Long, lOptimum() As Long, lNoRoutes As Long, lNoTrips As Long
Dim bPossible() As Boolean
Dim bCompatible() As Boolean
Sub Test()

    Dim lNoPlaces  As Long, i As Long, j As Long, k As Long, m As Long
    Dim vRoutes As Variant
        
    vRoutes = [Routes]
    vIncome = [Income]
    lNoRoutes = UBound(vRoutes)
    lNoPlaces = UBound(vRoutes, 2)
    lNoTrips = [N]
    ReDim bPossible(1 To lNoRoutes, 1 To lNoRoutes)
    ReDim bCompatible(1 To lNoTrips, 1 To lNoRoutes)
    ReDim lCombination(1 To lNoTrips)
    ReDim lOptimum(1 To lNoTrips)
    dMax = 0
    
    For i = 1 To lNoRoutes
        For j = i To lNoRoutes
            For k = 1 To lNoPlaces
                For m = 1 To lNoPlaces
                    If vRoutes(i, k) = vRoutes(j, m) Then GoTo Fail
                Next m
            Next k
        bPossible(i, j) = True
Fail:
        Next j
    Next i

    Select Case lNoTrips
    Case 1
        dMax = Application.Max(vIncome)
        lOptimum(1) = Application.Match(dMax, vIncome, 0)
    Case Is > 1
        For i = 1 To lNoRoutes
            For j = 1 To lNoRoutes
                bCompatible(1, j) = bPossible(i, j)
            Next j
            lCombination(1) = i
            Call GetPossibles(i, 2)
        Next i
    End Select
    
    With Range("N7")
        .Resize(2, 8).ClearContents
        If dMax > 0 Then
            .Resize(, lNoTrips).Value = lOptimum
            .Offset(1).Value = dMax
        Else
            MsgBox "No Solutions"
        End If
    End With

End Sub
Sub GetPossibles(lStart As Long, lIteration As Long)
    
    Dim i As Long, j As Long
    Dim dAmount As Double
    
    For i = lStart + 1 To lNoRoutes
        bCompatible(lIteration, i) = bCompatible(lIteration - 1, i) And bPossible(lStart, i)
    Next i
    For i = lStart + 1 To lNoRoutes
        If bCompatible(lIteration, i) Then
            lCombination(lIteration) = i
            If lIteration = lNoTrips Then
                dAmount = 0
                For j = 1 To lNoTrips
                    dAmount = dAmount + vIncome(lCombination(j), 1)
                Next j
                If dAmount > dMax Then
                    lOptimum = lCombination
                    dMax = dAmount
                End If
            Else
                Call GetPossibles(i, lIteration + 1)
            End If
        End If
    Next i
    
End Sub
 
Upvote 0
Routes: =G2:I198 {=MATCH(B2:D198,Locations,)}
Locations: K2:K21
N: = N6
Income: =E2:E198


Book1
ABCDEFGHIJKLMNOPQR
1COMBOPLACE1PLACE2PLACE3IncomeRoutesLocations
21FAO16,566.876115A
32FAP16,462.116116B
43AOK14,773.8911511C
54FAN14,465.606114D
65AOP14,000.7011516EN5
76AOM13,628.4011513FSolution113197493
87AEO13,380.021515GSum49,549.52
98FEA13,175.27651H
109FAM13,042.106113I
1110AOQ12,907.6211517J
1211AMN12,651.0211314K
1312AON12,580.3311514L
1413MKN12,126.41131114M
1514FQP12,005.7861716N
1615IMK11,646.2291311O
1716AEM11,339.191513P
1817FEQ11,266.036517Q
1918AMJ11,026.9311310R
2019EIJ10,610.695910S
2120FAT10,546.796120T
2221etcetcetc10,509.38
Sheet1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top