I have a MIP Problem that I need to output in Python. See the following attempt so far. I just need few suggestions that would point me in the right direction.
digits = [("00"+str(x))[-3:] for x in range(1, 10)]
var_1 = 2
var_2 = 1
var_3 = 3
LHS = [5,6,7]
RHS = [100,200,300]
count = 1
for v1 in range(var_1):
for v2 in range(var_2):
for v3 in range(var_3):
print("x"+digits[v1]+digits[v2]+digits[v3]+" - 20 z"+digits[v1]+digits[v2]+digits[v3]+" <= 0")
for v2 in range(var_2):
for v3 in range(var_3):
print("x"+digits[v2]+digits[v3]+" + "+"x" +digits[v2]+digits[v3]+" <= 123")
CURRENT OUTPUT:
x001001001 - 20 z001001001 <= 0
x001001002 - 20 z001001002 <= 0
x001001003 - 20 z001001003 <= 0
x002001001 - 20 z002001001 <= 0
x002001002 - 20 z002001002 <= 0
x002001003 - 20 z002001003 <= 0
x001001 + x001001 <= 123
x001002 + x001002 <= 123
x001003 + x001003 <= 123
My code is not producing what I want. Here is the output I want it to produce.
c1: x001001001 - 20 z001001001 <= 0
c2: x001001002 - 20 z001001002 <= 0
c3: x001001003 - 20 z001001003 <= 0
c4: x002001001 - 20 z002001001 <= 0
c5: x002001002 - 20 z002001002 <= 0
c6: x002001003 - 20 z002001003 <= 0
c7: x001001001 + x002001001 <= 123
c8: x001001002 + x002001002 <= 123
c9: x001001003 + x002001003 <= 123
Any help would be appreciated. Any modules that I need to use to make it simpler to code would be helpful as well. There are many more lines of codes that I have with different combinations of order of those digits within, but if I can get decent knowledge then I should be able to do it.
I also want to be able to print this output to a text file. What would be the easiest way to do so? Any suggestions? Thanks
c#:'s to the beginning of the output?