Python Matrix Example

You can also build optimization models in Python using dense and sparse matrices, much like you would in our MATLAB and R interfaces. We'll show an example that works through the same simple model from the first part of this section:

maximize x + y + 2 z    
subject to x + 2 y + 3 z <span>$</span>\leq<span>$</span> 4
  x + y     <span>$</span>\geq<span>$</span> 1
  x, y, z binary