Iβm trying to use mathematica to solve this linear integer program but I keep getting the input as the output.
I deleted like 9 lines of the constraints to make it fit to a page.
The Mathematica image posted is pretty much unusable. Post actual code.
posted in reply
FindMinimum[{
x10 + x14 + x18 + x112 + x116 + x20 + x24 + x28 + x212 + x216 +
x30 + x34 + x38 + x312 + x316 + x40 + x44 + x48 + x412 + x416 +
x50 + x54 + x58 + x512 + x516 + x60 + x64 + x68 + x612 + x616 +
x70 + x74 + x78 + x712 + x716 + y140 + y144 + y148 + y1412 + y150 +
y154 + y158 + y1512 + y250 + y254 + y258 + y2512 + y260 + y264 +
y268 + y2612 + y360 + y364 + y368 + y3612 + y370 + y374 + y378 +
y3712 + y470 + y474 + y478 + y4712,
x10 + x40 + x50 + x60 + x70 + y140 + y150 + y370 + y470 >= 1,
x10 + x20 + x50 + x60 + x70 + y140 + y150 + y250 + y260 >= 2,
x10 + x20 + x30 + x60 + x70 + y250 + y260 + y360 + y370 >= 2,
x10 + x20 + x30 + x40 + x70 + y130 + y360 + y370 + y470 >= 2,
x10 + x20 + x30 + x40 + x50 + y140 + y150 + y250 + y360 >= 2,
x20 + x30 + x40 + x50 + x60 + y150 + y250 + y260 + y360 >= 2,
x30 + x40 + x50 + x60 + x70 + y260 + y360 + y370 + y470 >= 1,
x40 + x44 + x10 + x14 + x50 + x54 + x60 + x64 + x70 + x74 + y140 +
y144 + y150 + y154 + y370 + y374 + y470 + y474 >= 1,
x10 + x14 + x50 + x54 + x24 + x20 + x60 + x64 + x70 + x74 + y140 +
y144 + y150 + y154 + y250 + y254 + y260 + y264 >= 3,
x10 + x14 + x24 + x20 + x30 + x34 + x70 + x74 + x60 + x64 + y250 +
y254 + y260 + y264 + y360 + y364 + y370 + y374 >= 3,
x10 + x70 + x74 + x14 + x24 + x20 + x30 + x34 + x40 + x44 + y140 +
y144 + y360 + y364 + y370 + y374 + y470 + y474 >= 3,
x10 + x24 + x20 + x30 + x34 + x40 + x44 + x50 + x54 + x14 + y140 +
y144 + y150 + y154 + y250 + y254 + y470 + y474 >= 3,
x20 + x24 + x30 + x34 + x40 + x44 + x50 + x54 + x60 + x64 + y150 +
y154 + y250 + y260 + y254 + y264 + y360 + y364 >= 3,
x30 + x34 + x40 + x44 + x50 + x54 + x60 + x64 + x70 + x74 + y260 +
y264 + y360 + y364 + y370 + y374 + y470 + y474 >= 1,
x44 + x48 + x14 + x18 + x54 + x58 + x64 + x68 + x74 + x78 + y140 +
y144 + y148 + y150 + y154 + y158 + y370 + y374 + y378 + y470 +
y474 + y478 >= 1,
x14 + x18 + x24 + x54 + x58 + x28 + x64 + x68 + x74 + x78 + y140 +
y144 + y148 + y150 + y154 + y158 + y250 + y254 + y258 + y260 +
y264 + y268 >= 7,
x14 + x18 + x24 + x28 + x34 + x38 + x74 + x78 + x64 + x68 + y250 +
y254 + y258 + y260 + y264 + y268 + y360 + y364 + y368 + y370 +
y374 + y378 >= 7,
x14 + x18 + x24 + x28 + x34 + x38 + x44 + x48 + x74 + x78 + y140 +
y144 + y148 + y360 + y364 + y368 + y370 + y374 + y378 + y470 +
y474 + y478 >= 7,
x24 + x28 + x34 + x38 + x44 + x48 + x54 + x58 + x14 + x18 + y140 +
y144 + y148 + y150 + y154 + y158 + y250 + y254 + y258 + y470 +
y474 + y478 >= 7,
x24 + x28 + x34 + x38 + x44 + x48 + x54 + x58 + x64 + x68 + y150 +
y154 + y158 + y260 + y250 + y254 + y258 + y264 + y268 + y360 +
y364 + y368 >= 7,
x34 + x38 + x44 + x48 + x54 + x58 + x64 + x68 + x74 + x78 + y260 +
y264 + y268 + y360 + y364 + y368 + y370 + y374 + y378 + y470 +
y474 + y478 >= 2,
x48 + x412 + x18 + x112 + x58 + x512 + x68 + x612 + x78 + x712 +
y144 + y148 + y1412 + y154 + y158 + y1512 + y374 + y378 + y3712 +
y474 + y478 + y4712 >= 2,
x18 + x58 + x512 + x112 + x28 + x212 + x68 + x612 + x78 + x712 +
y144 + y148 + y1412 + y154 + y158 + y1512 + y254 + y258 + y2512 +
y264 + y268 + y2612 >= 7,
x18 + x68 + x612 + x112 + x28 + x212 + x38 + x312 + x78 + x712 +
y254 + y258 + y2512 + y264 + y268 + y2612 + y364 + y368 + y3612 +
y374 + y378 + y3712 >= 7,
x18 + x112 + x28 + x212 + x38 + x312 + x48 + x412 + x78 + x712 +
y144 + y148 + y1412 + y364 + y368 + y3612 + y374 + y378 + y3712 +
y474 + y478 + y4712 >= 7,
x28 + x212 + x38 + x312 + x48 + x412 + x58 + x512 + x18 + x112 +
y144 + y148 + y1412 + y154 + y158 + y1512 + y254 + y258 + y2512 +
y474 + y478 + y4712 >= 7,
x28 + x212 + x38 + x312 + x48 + x412 + x58 + x512 + x68 + x612 +
y154 + y158 + y1512 + y254 + y258 + y2512 + y264 + y268 + y2612 +
y364 + y368 + y3612 >= 6,
x38 + x312 + x48 + x412 + x58 + x512 + x68 + x612 + x78 + x712 +
y264 + y268 + y2612 + y364 + y368 + y3612 + y374 + y378 + y3712 +
y474 + y478 + y4712 >= 3,
x412 + x416 + x112 + x512 + x612 + x712 + x116 + x516 + x616 +
x716 + y148 + y1412 + y158 + y1512 + y378 + y3712 + y478 +
y4712 >= 2,
x512 + x516 + x112 + x212 + x612 + x712 + x116 + x216 + x616 +
x716 + y148 + y1412 + y158 + y1512 + y258 + y2512 + y268 +
y2612 >= 6,
x612 + x616 + x112 + x212 + x312 + x712 + x116 + x216 + x316 +
x716 + y258 + y2512 + y268 + y2612 + y368 + y3612 + y378 +
y3712 >= 6,
x112 + x212 + x312 + x412 + x116 + x216 + x316 + x416 + x712 +
x716 + y148 + y1412 + y368 + y3612 + y378 + y3712 + y478 +
y4712 >= 6,
x212 + x312 + x412 + x512 + x216 + x316 + x416 + x516 + x112 +
x116 + y148 + y1412 + y158 + y1512 + y258 + y2512 + y478 +
y4712 >= 6,
x212 + x216 + x312 + x412 + x512 + x612 + x316 + x416 + x516 +
x616 + y158 + y1512 + y258 + y2512 + y268 + y2612 + y368 +
y3612 >= 4,
x312 + x316 + x412 + x512 + x612 + x712 + x416 + x516 + x616 +
x716 + y268 + y2612 + y368 + y3612 + y378 + y3712 + y478 +
y4712 >= 2,
x116 + x516 + x616 + x716 + x416 + y1412 + y1512 + y3712 + y4712 >=
2,
x116 + x216 + x616 + x716 + x516 + y1412 + y1512 + y2512 + y2612 >=
4,
x116 + x216 + x316 + x716 + x616 + y2512 + y2612 + y3612 + y3712 >=
4,
x116 + x216 + x316 + x416 + x716 + y1412 + y3612 + y3712 + y4712 >=
4,
x116 + x216 + x316 + x416 + x516 + y1412 + y1512 + y2512 + y4712 >=
4,
x216 + x316 + x416 + x516 + x616 + y1512 + y2512 + y2612 + y3612 >=
3,
x316 + x416 + x516 + x616 + x716 + y2612 + y3612 + y3712 + y4712 >=
1,
x10 \[Element] Integers, x14 \[Element] Integers,
x18 \[Element] Integers, x112 \[Element] Integers,
x116 \[Element] Integers, x20 \[Element] Integers,
x24 \[Element] Integers, x28 \[Element] Integers,
x212 \[Element] Integers, x216 \[Element] Integers,
x30 \[Element] Integers, x34 \[Element] Integers,
x38 \[Element] Integers, x312 \[Element] Integers,
x316 \[Element] Integers, x40 \[Element] Integers,
x44 \[Element] Integers, x48 \[Element] Integers,
x412 \[Element] Integers, x416 \[Element] Integers,
x50 \[Element] Integers, x54 \[Element] Integers,
x58 \[Element] Integers, x512 \[Element] Integers,
x516 \[Element] Integers, x60 \[Element] Integers,
x64 \[Element] Integers, x68 \[Element] Integers,
x612 \[Element] Integers, x616 \[Element] Integers,
x70 \[Element] Integers, x74 \[Element] Integers,
x78 \[Element] Integers, x712 \[Element] Integers,
x716 \[Element] Integers, y140 \[Element] Integers,
y144 \[Element] Integers, y148 \[Element] Integers,
y1412 \[Element] Integers, y150 \[Element] Integers,
y154 \[Element] Integers, y158 \[Element] Integers,
y1512 \[Element] Integers, y250 \[Element] Integers,
y254 \[Element] Integers, y258 \[Element] Integers,
y2512 \[Element] Integers, y260 \[Element] Integers,
y264 \[Element] Integers, y268 \[Element] Integers,
y2612 \[Element] Integers, y360 \[Element] Integers,
y364 \[Element] Integers, y368 \[Element] Integers,
y3612 \[Element] Integers, y370 \[Element] Integers,
y374 \[Element] Integers, y378 \[Element] Integers,
y3712 \[Element] Integers, y470 \[Element] Integers,
y474 \[Element] Integers, y478 \[Element] Integers,
y4712 \[Element] Integers},
{x10, x14, x18, x112, x116, x20, x24, x28, x212, x216, x30, x34, x38,
x312, x316, x40, x44, x48, x412, x416, x50, x54, x58, x512, x516,
x60, x64, x68, x612, x616, x70, x74, x78, x712, x716, y140, y144,
y148, y1412, y150, y154, y158, y1512, y250, y254, y258, y2512, y260,
y264, y268, y2612, y360, y364, y368, y3612, y370, y374, y378,
y3712, y470, y474, y478, y4712}]
I changed FindMinimum to NMinimize and got an error message
NMinimize::bcons: The following constraints are not valid: {x10+x40+x50+x60+x70+y140+y150+y370+y470>=1,x10+x20+x50+x60+x70+y140+y150+y250+y260>=2,x10+x20+x30+x60+x70+y250+y260+y360+y370>=2,x10+x20+x30+x40+x70+y130+y360+y370+y470>=2,x10+x20+x30+x40+x50+y140+y150+y250+y360>=2,<<41>>,x116\Integers,x20\Integers,x24\Integers,x28\Integers,<<55>>}. Constraints should be equalities, inequalities, or domain specifications involving the variables. >>
Perhaps thereβs variable in your constraints that not given in the list of variables at the end.
Thanks! Iβm pretty new, does that say where to look?
Check to see if y130 is an error.
Check to see if there might be one too few y140.
Check to see if there might be one too many y360.
Check to see if there might be one too few y470.
Each of those are just from counting how many times each variable appears.
If you decide to post more code - for such large samples please just attach notebook.
Attached updated code.
For some reason it says there there is no feasible answer, but for sure there is one if you have all variables as like 100. So iβm not sure whatβs wrong now..
updated below
Found a total of 15 with {
x10 β 0, x14 β 0, x18 β 0, x112 β 0, x116 β 1, x20 β 0,
x24 β 0, x28 β 1, x212 β 0, x216 β 1, x30 β 0, x34 β 0, x38 β 1, x312 β 0, x316 β 0, x40 β 0, x44 β 0, x48 β 0,
x412 β 0, x416 β 0, x50 β 0, x54 β 0, x58 β 0, x512 β 0, x516 β 0, x60 β 0, x64 β 0, x68 β 0, x612 β 0, x616 β 0,
x70 β 0, x74 β 0, x78 β 0, x712 β 0, x716 β 0, y140 β 1, y144 β 1, y148 β 1, y1412 β 1, y150 β 0, y154 β 0, y158 β 0,
y1512 β 0, y250 β 1, y254 β 0, y258 β 1, y2512 β 1, y260 β 0, y264 β 1, y268 β 0, y2612 β 0, y360 β 1, y364 β 0, y368 β 1,
y3612 β 1, y370 β 0, y374 β 0, y378 β 0, y3712 β 0, y470 β 0, y474 β 0, y478 β 0, y4712 β 0}
You can modify the range of each variable, but with a few small changes I didnβt find a smaller minimum.