title: Linear programming using the spicy.optimize.linprog
body: <p>I’m trying to formulate and solve a linear programming problem using the <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html" rel="nofollow">spicy.optimize.linprog</a> function.</p>
  
  <p>I want to solve the function Ax = b subject to the following constraints:  </p>
  
  <pre><code># A                      b   
  -0.4866 x1 + 0.1632 x2 &lt; 0  
   0.3211 x1 + 0.5485 x2 &lt; 0  
  -0.5670 x1 + 0.1099 x2 &lt; 0   
  -0.1070 x1 + 0.0545 x2 = 1   
  -0.4379 x1 + 0.1465 x2 &lt; 0   
   0.0220 x1 + 0.7960 x2 &lt; 0  
  -0.3673 x1 - 0.0494 x2 &lt; 0  
  </code></pre>
  
  <p>I have as input an nx2 matrix <code>A</code> and nx1 matrix <code>b</code>.  The result should be the vectors x1 and x2.  Here's my input data.</p>
  
  <pre><code># Coefficients
  
  A = [[-0.4866, 0.1632],   
       [0.3211, 0.5485],   
       [-0.5670, 0.1099],   
       [-0.1070, 0.0545],   
       [-0.4379, 0.1465],   
       [0.0220, 0.7960],  
       [-0.3673, -0.0494]]  
  
  # Inequalities
  
  b = [0, 0, 0, -1, 0, 0, 0]
  </code></pre>
  
  <p>I think my problem is how to formulate <code>c</code>, the function the be minimized for input into the <code>linprog</code> function.</p>
  
  <pre><code>res = linprog(c, A, b)
  </code></pre>