-
Notifications
You must be signed in to change notification settings - Fork 526
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
Integrate new Set rewrite into Pyomo #1319
Changes from 74 commits
5e312d2
7fde844
a4fc1a2
d689d9f
719caea
b59f79d
2db0bd9
983c663
25c7d46
ec40b68
89d794a
f57e0e9
f5e79b7
0bd4d2a
096a9ef
6d7537c
5007efc
2c526b0
45bebbc
5531dbe
7b7e9e3
a69657a
0ca6a67
05f3abe
5c4363b
0789100
26dc604
3632ef2
11a0a9e
1925e8b
e26d7bf
a423e5a
7925500
d725f38
59856f1
e2b09d8
1021e85
3f4bacf
b636253
e4ca8d9
c69121b
862901c
5464a53
c4e38db
bb17d16
b84b088
cdaba06
f87e0b1
df24669
3eb65bf
2cad904
7aa3987
655c8f4
1f1b21d
ca3308b
089cb1c
a6164a2
c1812ee
cf7dd4c
21682d9
a8db3c0
14be3ec
b308ce9
7fafbe4
0dd8dad
ea230bd
07c1336
5d9003e
e08319c
5e10b90
490cbdc
1182dc2
b2c406b
cc3c924
754c43c
ed07907
bf89dae
dc8095f
c1ff124
350784c
2838805
a0d54b9
9b5b439
185cfbf
a47ae0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import pyomo.kernel as pmo | ||
import pyomo.environ as pe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm hoping to keep pyomo.kernel as self contained as possible until the two modeling layers are compatible. Is this import necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, for this example., yes: |
||
|
||
# | ||
# Continuous variables | ||
# | ||
|
||
v = pmo.variable() | ||
|
||
v = pmo.variable(domain=pmo.Reals) | ||
v = pmo.variable(domain=pe.Reals) | ||
|
||
v = pmo.variable(domain=pmo.NonNegativeReals, | ||
v = pmo.variable(domain=pe.NonNegativeReals, | ||
ub=10) | ||
|
||
v = pmo.variable(domain_type=pmo.RealSet, | ||
|
@@ -22,11 +23,11 @@ | |
# Discrete variables | ||
# | ||
|
||
v = pmo.variable(domain=pmo.Binary) | ||
v = pmo.variable(domain=pe.Binary) | ||
|
||
v = pmo.variable(domain=pmo.Integers) | ||
v = pmo.variable(domain=pe.Integers) | ||
|
||
v = pmo.variable(domain=pmo.NonNegativeIntegers, | ||
v = pmo.variable(domain=pe.NonNegativeIntegers, | ||
ub=10) | ||
|
||
v = pmo.variable(domain_type=pmo.IntegerSet, | ||
|
@@ -59,11 +60,11 @@ | |
assert v.ub == 20 | ||
|
||
# set the domain (always overwrites bounds, even if infinite) | ||
v.domain = pmo.Reals | ||
v.domain = pe.Reals | ||
assert v.lb == None | ||
assert v.ub == None | ||
assert v.domain_type == pmo.RealSet | ||
v.domain = pmo.Binary | ||
v.domain = pe.Binary | ||
assert v.lb == 0 | ||
assert v.ub == 1 | ||
assert v.domain_type == pmo.IntegerSet | ||
|
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.
Having the "size" listed twice here is a little confusing for "singleton" sets. I realize that they are referring to two different things but because they are being called the same name it's not obvious which value would get returned if I asked for the length of the set.
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 agree that it is confusing. I am open to options for renaming the table entry (the header should probably remain the same for consistency with other IndexedComponents)