Changeset 5744
 Timestamp:
 05/02/12 10:55:06 (3 years ago)
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

coopr.data.samples/trunk/coopr/data/samples/CooprGettingStarted/noiteration1.py
r5568 r5744 21 21 instance = model.create() 22 22 results = opt.solve(instance) 23 instance.load(results) 23 24 24 25 if instance.x[2].value == 0: 
coopr.doc/trunk/GettingStarted/current/pyomo.txt
r5543 r5744 1 2 1 == Pyomo Overview == 3 2 … … 414 413 == Sets == 415 414 415 === Declaration === 416 416 417 Sets can be declared using the +Set+ and +RangeSet+ functions or by 417 418 assigning set expressions. The simplest set declaration creates … … 493 494  494 495 496 === Operations === 497 495 498 Sets may also be created by assigning other Pyomo sets as in these examples that also 496 499 illustrate the set operators union, intersection, difference, and exclusiveor: … … 501 504 model.K = model.A  model.D # difference 502 505 model.L = model.A ^ model.D # exclusiveor 506  507 The crossproduct operator is the asterisk (*). For example, to assign 508 a set the cross product of two other sets, one could use 509  510 model.K = model.B * model.c 511  512 or to indicate the the members of a set are restricted to be 513 in the cross product of two other sets, one could use 514  515 model.K = Set(within=model.B * model.C) 503 516  504 517 
coopr.doc/trunk/GettingStarted/current/scripts.txt
r5689 r5744 303 303 ==== All Variables from a Python Script ==== 304 304 305 As with one variable, we assume that the model has been instantiated and solved and the results have been loded back into the instance object, then we can make 305 As with one variable, we assume that the model has been instantiated and solved and the results have been loded back into the instance object 306 using +instance.load(results)+, then we can make 306 307 use of the fact that the variable is a member of the instance object and its value can be accessed using its +value+ member. Assuming the 307 308 instance object has the name +instance+, the following code snippet displays all variables and their values:
Note: See TracChangeset
for help on using the changeset viewer.