Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

from gpkit import Variable, Model, SignomialsEnabled 

 

def gp_test_model(): 

x = Variable('x') 

y = Variable('y') 

 

a = Variable('a', 0.6, pr=10) 

b = Variable('b', 0.5, pr=10) 

 

constraints = [a * b * x + a * b * y <= 1, 

b * x / y + b * x * y + a*b**2 * x ** 2 <= 1] 

return Model((x * y) ** -1, constraints) 

 

 

def sp_test_model(): 

x = Variable('x') 

y = Variable('y') 

 

a = Variable('a', 0.6, pr=10) 

b = Variable('b', 0.5, pr=10) 

 

with SignomialsEnabled(): 

constraints = [a * b * x + a * b * y <= 1 + a*x**2 + 0.5*b*x*y, 

b * x / y + b * x * y + a*b**2 * x ** 2 <= 1] 

return Model((x * y) ** -1, constraints)