Coverage for docs/source/examples/unbounded.py: 100%
9 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-07 22:15 -0500
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-07 22:15 -0500
1"Demonstrate a trivial unbounded variable"
2from gpkit import Variable, Model
3from gpkit.constraints.bounded import Bounded
5x = Variable("x")
7constraints = [x >= 1]
9m = Model(1/x, constraints) # MOSEK returns DUAL_INFEAS_CER on .solve()
10m = Model(1/x, Bounded(constraints))
11# by default, prints bounds warning during solve
12sol = m.solve(verbosity=0)
13print(sol.summary())
14# but they can also be accessed from the solution:
15assert (sol["boundedness"]["value near upper bound of 1e+30"]
16 == sol["boundedness"]["sensitive to upper bound of 1e+30"])