-
Notifications
You must be signed in to change notification settings - Fork 518
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
Overhaul PyROS Preprocessor Subroutine and Subproblem Objects #3341
base: main
Are you sure you want to change the base?
Overhaul PyROS Preprocessor Subroutine and Subproblem Objects #3341
Conversation
That's it for updates post #3382. |
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.
I don't have anything that actually needs to be changed, just some stylistic suggestions. Overall it looks good.
m.con1 = Constraint(expr=m.x1 * m.u1 ** (0.5) - m.x2 * m.u1 <= 2) | ||
m.con2 = Constraint(expr=m.x1**2 - m.x2**2 * m.u1 == m.x3) |
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.
A suggestion that won't hold up this PR - it looks like you have a similar (if not exactly the same) model across multiple test suites. It is more maintainable to define a "model-creation" function that you can call so you don't have duplicate code.
m.con1 = Constraint(expr=m.x1 * m.u1 ** (0.5) - m.x2 * m.u1 <= 2) | ||
m.con2 = Constraint(expr=m.x1**2 - m.x2**2 * m.u1 == m.x3) | ||
|
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.
(An example of the repeat I mentioned above)
|
||
|
||
import logging | ||
import unittest |
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.
As a general note across all the tests - you probably want to do:
import pyomo.common.unittest as unittest
We have a lot of extra capabilities in addition to the standard unittest
offerings that are Pyomo-specific and generally helpful.
|
||
import logging | ||
import textwrap | ||
import unittest |
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.
As a general note across all the tests - you probably want to do:
import pyomo.common.unittest as unittest
We have a lot of extra capabilities in addition to the standard unittest
offerings that are Pyomo-specific and generally helpful.
|
||
import logging | ||
import time | ||
import unittest |
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.
As a general note across all the tests - you probably want to do:
import pyomo.common.unittest as unittest
We have a lot of extra capabilities in addition to the standard unittest
offerings that are Pyomo-specific and generally helpful.
param_var_data_list : list of VarData | ||
Variable data objects representing the main uncertain | ||
parameters. | ||
conlist : ConstraintList |
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.
The nit-pickiest of nit-picks: con_list
(because you use underscores in param_var_data_list
and auxiliary_var_list
)
Fixes #2964.
Summary/Motivation:
Driven by recent algorithmic developments of the PyROS preprocessor, this PR implements sweeping changes to the PyROS preprocessor subroutine and subproblem formulations/object structures.
Changes proposed in this PR:
Update PyROS as follows:
UncertaintySet
class and pre-implemented subclasses to facilitate changes to the subproblemsUncertaintySet.set_as_constraint
to make auxiliary uncertain parameters easier to trackCardinalitySet
andFactorModelSet
classesFactorModelSet
instances to those for whichpsi_mat
is full column rankIntersectionSet
core.expr.compare.assertExpressionsEqual
) for more precise model testingpoint_in_set
,set_as_constraint
TODO
ParameterizedQuadraticRepn
and corresponding expression walker #3324 merged) useParameterizedQuadraticRepnVisitor
in lieu ofgenerate_standard_repn
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: