-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When to use strings vs varkeys #668
Comments
I'm guessing for @bqpd to debug this it may be helpful to have the actual code to reproduce -- could we get a commit hash and a line of code to run? Understood that |
commit hash: Note: as described in #596 a line of |
Hmmm there are 4 different |
As kind of a MWE, I feel like one (or both) of the things I try below should work as intended. The dictionaries printed below In [1]: from gpkit import Variable, SignomialsEnabled, Model
In [2]: x = Variable('x')
In [3]: y = Variable('y')
In [4]: with SignomialsEnabled():
m = Model(x, [x + y >= 1, y <= 0.5], name='Air')
...:
In [5]: sol = m.localsolve()
Beginning signomial solve.
{y_Air: 1, x_Air: 1}
{y_Air: 0.5, x_Air: 0.5}
Solving took 2 GP solves and 0.0887 seconds.
Cost
----
0.5
Free Variables
--------------
x : 0.5
y : 0.5
Sensitivities
-------------
In [6]: m.localsolve(x0={x.varkeys.keys()[0]: 0.4})
Beginning signomial solve.
{x: 0.4, y_Air: 1, x_Air: 1}
{y_Air: 0.5, x_Air: 0.5}
Solving took 2 GP solves and 0.0396 seconds.
Cost
----
0.5
Free Variables
--------------
x : 0.5
y : 0.5
Sensitivities
-------------
Out[6]:
{'constants': {},
'cost': 0.50000000000000022,
'freevariables': {y_Air: 0.5, x_Air: 0.50000000000000022},
'sensitivities': {'constants': {},
'constraints': {'\n 1 <= 2*x_Air**0.5*y_Air**0.5\n y_Air <= 0.5': {'1 <= 2*x_Air**0.5*y_Air**0.5': {'1': 2.0,
'1 <= 2*x_Air**0.5*y_Air**0.5': 2.0,
'2*x_Air**0.5*y_Air**0.5': 2.0},
'y_Air <= 0.5': {'0.5': 1.0, 'overall': 1.0, 'y_Air': 1.0}}},
'la': array([ 1., 2., 1.]),
'nu': array([ 1., 2., 1.])},
'signomialstart': {x: 0.40000000000000002, y_Air: 1, x_Air: 1},
'variables': {y_Air: 0.5, x_Air: 0.50000000000000022}}
In [7]: m.localsolve(x0={'x':0.4})
Beginning signomial solve.
{y_Air: 1, x_Air: 1, 'x': 0.4}
{y_Air: 0.5, x_Air: 0.69692630281888834}
{y_Air: 0.5, x_Air: 0.51181272094965147}
{y_Air: 0.5, x_Air: 0.50006737019589742}
Solving took 4 GP solves and 0.0711 seconds.
Cost
----
0.5
Free Variables
--------------
x : 0.5
y : 0.5
|
This is not a solution, but a minor comment: |
Ah yes..whoops |
I believe I have resolved the pressing issue at hand ( simply removing the |
Things we'd like to document better related to this issue:
|
I believe preferred syntax is I'm wondering if we shouldn't start expecting strings in fewer places, so as to reduce confusion with named models like |
I have a large SP (some say the largest SP that GPkit has ever seen) that I want to solve, but unfortunately if I just let all initial values for negynomial vars be 1, the first solve returns primal infeasible and then the next (feasibility-finding) solve is unbounded (this probably deserves a ticket of its own in the future) and returns UNKNOWN. To circumvent this, up until now I have been solving my constituent models first and using their results as the
x0
dict. This doesn't to be working anymore because when I do the following innominal_math
:it prints out all the variables I thought I was giving in my x0. Any ideas?
A code excerpt to show what I'm doing:
The text was updated successfully, but these errors were encountered: