-
Notifications
You must be signed in to change notification settings - Fork 41
Description
The documentation on Tight ConstraintSets states the following:
"Tight ConstraintSets will warn if any inequalities they contain are not tight (that is, the right side does not equal the left side) after solving. This is useful when you know that a constraint should be tight for a given model, but representing it as an equality would be non-convex."
This seems to suggest that the use of tight constraints (via the Tight() function) will not alter or otherwise interrupt a GPKit solution; however, I have recently discovered that this is not always the case.
While attempting to solve a model, I noticed that GPKit would throw an error only when a particular constraint had been specified as Tight(). Without the use of the Tight() function, GPKit was able to find a solution to the model.
The nature of the error message was somewhat befuddling: it appeared that when the constraint was specified as Tight, the program was no longer able to interpret one or more constant variables. The error read:
Traceback (most recent call last):
File "tight_error.py", line 63, in
tsol = m.solve(verbosity=1)
File "/Users/bicole/GitHub/gpkit/gpkit/constraints/prog_factories.py", line 132, in solvefn
self.program, progsolve = genfunction(self, **kwargs)
File "/Users/bicole/GitHub/gpkit/gpkit/constraints/prog_factories.py", line 88, in programfn
prog = program(self.cost, self, constants, **initargs)
File "/Users/bicole/GitHub/gpkit/gpkit/constraints/gp.py", line 95, in init
self.check_bounds(err_on_missing_bounds=True)
File "/Users/bicole/GitHub/gpkit/gpkit/constraints/gp.py", line 121, in check_bounds
for (v, b), x in missingbounds.items()))
gpkit.exceptions.UnboundedGP: m_3 has no lower bound.
Again, when the Tight() function is removed from the constraint, the model is able to find a solution without any issue.
I have attached a minimum working example for your review. The boolean variable toggleTight can be set to True to incite the issue.
Thanks in advance,
-Blake
tight_error.py.zip