forked from Pyomo/pyomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating spy and py files; Suffixes, Scripts and Expressions need wor…
…k now
- Loading branch information
1 parent
eed9230
commit 2ea89ac
Showing
117 changed files
with
2,133 additions
and
2,021 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Assign_to_crossproduct.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.C = Set(model.A * model.B) | ||
model.C = Set(model.A * model.B) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Contain_crossproduct_subset.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.C = Set(within=model.A * model.B) | ||
model.C = Set(within=model.A * model.B) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_arcs_crossproduct.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.Arcs = Set(within=model.Nodes*model.Nodes) | ||
model.arcs = model.Nodes*model.Nodes |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_arcs_dimen.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.Arcs = Set(dimen=2) | ||
model.Arcs = Set(dimen=2) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_arcs_within.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.Arcs = Set(within=model.Nodes*model.Nodes) | ||
model.Arcs = Set(within=model.Nodes*model.Nodes) |
46 changes: 23 additions & 23 deletions
46
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_constraints_example.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
>>> from pyomo.environ import * | ||
>>> | ||
>>> model = AbstractModel() | ||
>>> | ||
>>> model.I=Set() | ||
>>> model.K=Set() | ||
>>> model.V=Set(model.K) | ||
>>> | ||
>>> def kv_init(model): | ||
>>> return ((k,v) for k in model.K for v in model.V[k]) | ||
>>> model.KV=Set(dimen=2, initialize=kv_init) | ||
>>> | ||
>>> model.a = Param(model.I, model.K) | ||
>>> | ||
>>> model.y = Var(model.I) | ||
>>> model.x = Var(model.I, model.KV) | ||
>>> | ||
>>> #include a constraint | ||
>>> #x[i,k,v] <= a[i,k]*y[i], for i in model.I, k in model.K, v in model.V[k] | ||
>>> | ||
>>> def c1Rule(model,i,k,v): | ||
>>> return model.x[i,k,v] <= model.a[i,k]*model.y[i] | ||
>>> model.c1 = Constraint(model.I,model.KV,rule=c1Rule) | ||
from pyomo.environ import * | ||
|
||
model = AbstractModel() | ||
|
||
model.I=Set() | ||
model.K=Set() | ||
model.V=Set(model.K) | ||
|
||
def kv_init(model): | ||
return ((k,v) for k in model.K for v in model.V[k]) | ||
model.KV=Set(dimen=2, initialize=kv_init) | ||
|
||
model.a = Param(model.I, model.K) | ||
|
||
model.y = Var(model.I) | ||
model.x = Var(model.I, model.KV) | ||
|
||
#include a constraint | ||
#x[i,k,v] <= a[i,k]*y[i], for i in model.I, k in model.K, v in model.V[k] | ||
|
||
def c1Rule(model,i,k,v): | ||
return model.x[i,k,v] <= model.a[i,k]*model.y[i] | ||
model.c1 = Constraint(model.I,model.KV,rule=c1Rule) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_nodes.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.Nodes = Set() | ||
model.Nodes = Set() |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Declare_set.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.A = Set() | ||
model.A = Set() |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Define_another_constraint.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.MyConstraint = Constraint(model.I,model.KV,rule=c1Rule) | ||
model.MyConstraint = Constraint(model.I,model.KV,rule=c1Rule) |
6 changes: 3 additions & 3 deletions
6
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Define_constraint_tuples.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
>>> def kv_init(model): | ||
>>> return ((k,v) for k in model.K for v in model.V[k]) | ||
>>> model.KV=Set(dimen=2, initialize=kv_init) | ||
def kv_init(model): | ||
return ((k,v) for k in model.K for v in model.V[k]) | ||
model.KV=Set(dimen=2, initialize=kv_init) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Initialize_python_sets.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.D = Set(initialize=['red', 'green', 'blue']) | ||
model.D = Set(initialize=['red', 'green', 'blue']) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Predefined_set_example.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.M = Set(within=NegativeIntegers) | ||
model.M = Set(within=NegativeIntegers) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_RangeSet_simple_sequence.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.G = RangeSet(1.5, 10, 3.5) | ||
model.G = RangeSet(1.5, 10, 3.5) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Restrict_to_crossproduct.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.K = Set(within=model.B * model.C) | ||
model.K = Set(within=model.B * model.C) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Set_cross_product.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.K = model.B * model.c | ||
model.K = model.B * model.C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.B = Set(dimen=2) | ||
model.B = Set(dimen=2) |
2 changes: 1 addition & 1 deletion
2
doc/OnlineDocs/getting_started/spyfiles/Spy4Sets_Set_initialize.spy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
>>> model.C = Set(initialize=DoubleA_init) | ||
model.C = Set(initialize=DoubleA_init) |
Oops, something went wrong.