convexengineering / gpkit

Geometric programming for engineers
http://gpkit.readthedocs.org
MIT License
206 stars 40 forks source link

GPkit #1565

Closed nikozara closed 2 years ago

nikozara commented 2 years ago

"Very simple problem: minimize x while keeping x greater than 1." from gpkit import Variable, Model

Decision variable

x = Variable("x")

Constraint

constraints = [x >= 1]

Objective (to minimize)

objective = x

Formulate the Model

m = Model(objective, constraints)

Solve the Model

sol = m.solve(verbosity=0)

print selected results

print("Optimal cost: %.4g" % sol["cost"]) print("Optimal x val: %.4g" % sol["variables"][x])

whoburg commented 2 years ago

Closing as possible mistakenly created ticket, please feel free to re-open if there's a specific issue to report.