-
Notifications
You must be signed in to change notification settings - Fork 6
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
Introduce optimization variable #97
Conversation
Looking at the transport tutorial, I noticed that it includes a variable like this
I.e, without constraints to indexsets. So I set out to make
|
Context for the latest commit: |
1409044
to
dd143c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm except for the point about the errors!
@@ -4,6 +4,9 @@ | |||
from .optimization.indexset import IndexSet as IndexSet | |||
from .optimization.scalar import Scalar as Scalar | |||
from .optimization.table import Table as Table | |||
|
|||
# TODO Is this really the name we want to use? | |||
from .optimization.variable import Variable as OptimizationVariable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring this for now, more something for daniel i think
1d5d5e2
to
5468b41
Compare
Thanks for the instructions and for catching this error! It was fixed in #115 and this branch rebased/reworked to accommodate these changes :) |
* Remove Never type hints from core; mypy complained in test file
5468b41
to
d9498b2
Compare
This PR introduces the next item of the message data model:
Variable
. It comes complete with everything the other items already have and only minor changes toColumn
that are required for this to work, so without further DRY improvements, this PR size is as small as it gets (for the remainingEquation
).Some questions and notes that come up while working on this:
Variable
of theiamc
category. This requires awkward naming conventions at times. I usually defaulted toOptimizationVariable
for this new one, but this leads to a table name ofoptimization_optimizationvariable
(because thedocs
table is built on themodel.__tablename__
-- which of course could be changed by overwriting the__tablename__
locally, and maybe that's preferable) and toOptimizationVariable
being importable fromixmp4.core
, which I'm not sure we like. Please let me know what you think.level
s andmarginal
s doVariable
s (andEquation
s, for that matter) have? At the moment, I'm assuming that everyKey
(one row of entries inVariable.data
) can have its ownlevel
andmarginal
, making those two just arbitrary columns inVariable.data
(though maybe we could limit them to beingfloat
s or so).Variable
s need to getdata
added to them manually via anadd()
function? Or is there data sort of filled in automatically by the gdx code? I don't think I remember lots ofvariable.create()
,variable.add_data()
functions from the westeros tutorials.Working on the transport tutorial, I noticed that I had completely forgotten about adding
variables = db.relationship()
in theRun
DB-table. I have even run migrations for these other PRs, but no error came up. I'm wondering if we even need theserelationship()
declarations at all.