Coverage for docs/source/examples/debug.py: 100%
17 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-23 21:28 -0400
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-23 21:28 -0400
1"Debug examples"
2from gpkit import Variable, Model, units
4x = Variable("x", "ft")
5x_min = Variable("x_min", 2, "ft")
6x_max = Variable("x_max", 1, "ft")
7y = Variable("y", "volts")
9m = Model(x/y, [x <= x_max, x >= x_min])
10m.debug()
12print("# Now let's try a model unsolvable with relaxed constants\n")
14m2 = Model(x, [x <= units("inch"), x >= units("yard")])
15m2.debug()
17print("# And one that's only unbounded\n")
19# the value of x_min was used up in the previous model!
20x_min = Variable("x_min", 2, "ft")
21m3 = Model(x/y, [x >= x_min])
22m3.debug()
24x_min = Variable("x_min", 2, "ft")
25m4 = Model(x, [x >= x_min])
26m4.debug()