Skip to content

Instantly share code, notes, and snippets.

@sschnug
Last active September 2, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sschnug/d50e35ca5f0b5ea771f4c3f078d2efda to your computer and use it in GitHub Desktop.
Save sschnug/d50e35ca5f0b5ea771f4c3f078d2efda to your computer and use it in GitHub Desktop.
Example
from gurobipy import *
m = Model("model")
x = m.addVar(lb=0.0, name="x")
y = m.addVar(lb=0.0, name="y")
m.update()
obj = -x*x - y*y
m.setObjective(obj) # default: minimize
m.addConstr(x + y >= 1, "c0")
m.addConstr(x + y <= 1, "c1")
m.optimize()
# Output
# gurobipy.GurobiError: Objective Q not PSD (negative diagonal entry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment