Coverage for docs/source/examples/ 100%

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 


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) 


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