title: Mixed Integer Program in Python
body: <p>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.</p>
  
  <pre><code>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]+" &lt;= 0")
  
  for v2 in range(var_2):
      for v3 in range(var_3):
          print("x"+digits[v2]+digits[v3]+" + "+"x" +digits[v2]+digits[v3]+" &lt;= 123")
  </code></pre>
  
  <p>CURRENT OUTPUT:</p>
  
  <pre><code>x001001001 - 20 z001001001 &lt;= 0
  x001001002 - 20 z001001002 &lt;= 0
  x001001003 - 20 z001001003 &lt;= 0
  x002001001 - 20 z002001001 &lt;= 0
  x002001002 - 20 z002001002 &lt;= 0
  x002001003 - 20 z002001003 &lt;= 0
  x001001 + x001001 &lt;= 123
  x001002 + x001002 &lt;= 123
  x001003 + x001003 &lt;= 123
  </code></pre>
  
  <p>My code is not producing what I want. Here is the output I want it to produce.</p>
  
  <pre><code>c1: x001001001 - 20 z001001001 &lt;= 0
  c2: x001001002 - 20 z001001002 &lt;= 0
  c3: x001001003 - 20 z001001003 &lt;= 0
  c4: x002001001 - 20 z002001001 &lt;= 0
  c5: x002001002 - 20 z002001002 &lt;= 0
  c6: x002001003 - 20 z002001003 &lt;= 0
  c7: x001001001 + x002001001 &lt;= 123
  c8: x001001002 + x002001002 &lt;= 123
  c9: x001001003 + x002001003 &lt;= 123
  </code></pre>
  
  <p>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.</p>
  
  <p>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</p>