title: Using Gurobi in Python and adding variables
body: <p>I am trying to write my first Gurobi optimization code and this is where I am stuck with:</p>
  
  <p>I have the following dictionary for my first subscript:</p>
  
  <p>input <code>for k in range(1,11):
            i[k] = int(k)
        print i</code></p>
  
  <p>output <code>{1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10}</code></p>
  
  <p>And, I have the following dictionaries for my second subscript:</p>
  
  <pre><code>c_il = {1: 2, 2: 1, 3: 1, 4: 4, 5: 3, 6: 4, 7: 3, 8: 2, 9: 1, 10: 4}
  
  c_iu = {1: 3, 2: 2, 3: 2, 4: 5, 5: 4, 6: 5, 7: 4, 8: 3, 9: 2, 10: 5}
  </code></pre>
  
  <p>I am trying to create variables as following:</p>
  
  <pre><code>x = m.addVars(i, c_il, vtype=GRB.BINARY, name="x")
  x = m.addVars(i, c_iu, vtype=GRB.BINARY, name="x")
  </code></pre>
  
  <p>Apparently, it is not giving what I am looking for. What I am looking for is <code>x_(i),(c_il)</code> and <code>x_(i),(c_iu)</code>; ignore parenthesis.</p>
  
  <p>More clearly, the following is what I am trying to obtain by using dicts <code>i</code>, <code>c_il</code>, and <code>c_iu</code>:</p>
  
  <pre><code>{1: &lt;gurobi.Var x[1,2]&gt;,
   2: &lt;gurobi.Var x[2,1]&gt;,
   3: &lt;gurobi.Var x[3,1]&gt;,
   4: &lt;gurobi.Var x[4,5]&gt;,
   5: &lt;gurobi.Var x[5,3]&gt;,
   6: &lt;gurobi.Var x[6,4]&gt;,
   7: &lt;gurobi.Var x[7,3]&gt;,
   8: &lt;gurobi.Var x[8,2]&gt;,
   9: &lt;gurobi.Var x[9,1]&gt;,
   10: &lt;gurobi.Var x[10,4]&gt;,
   11: &lt;gurobi.Var x[1,3]&gt;,
   12: &lt;gurobi.Var x[2,2]&gt;,
   13: &lt;gurobi.Var x[3,2]&gt;,
   14: &lt;gurobi.Var x[4,5]&gt;,
   15: &lt;gurobi.Var x[5,4]&gt;,
   16: &lt;gurobi.Var x[6,5]&gt;,
   17: &lt;gurobi.Var x[7,4]&gt;,
   18: &lt;gurobi.Var x[8,3]&gt;,
   19: &lt;gurobi.Var x[9,2]&gt;,
   20: &lt;gurobi.Var x[10,5]&gt;}
  </code></pre>
  
  <p>Since I am using dictionaries everywhere, I want to keep it consistent by continuing to use dictionaries so that I can do multiplications and additions with my parameters which are all in dictionaries. Is there any way to create these variables with m.addVars or m.addVar?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: Modified to make it more clear.</p>