Coverage for docs\source\examples\unbounded.py: 0%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

9 statements  

1"Demonstrate a trivial unbounded variable" 

2from gpkit import Variable, Model 

3from gpkit.constraints.bounded import Bounded 

4 

5x = Variable("x") 

6 

7constraints = [x >= 1] 

8 

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"])