Changeset 5744


Ignore:
Timestamp:
05/02/12 10:55:06 (2 years ago)
Author:
dlwoodr
Message:

Add cross product operators, emphasize loading solutions after solving in a script and correct the noiteration1.py example to include the load

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coopr.data.samples/trunk/coopr/data/samples/CooprGettingStarted/noiteration1.py

    r5568 r5744  
    2121instance = model.create() 
    2222results = opt.solve(instance) 
     23instance.load(results) 
    2324 
    2425if instance.x[2].value == 0: 
  • coopr.doc/trunk/GettingStarted/current/pyomo.txt

    r5543 r5744  
    1  
    21== Pyomo Overview  == 
    32 
     
    414413== Sets == 
    415414 
     415=== Declaration === 
     416 
    416417Sets can be declared using the +Set+ and +RangeSet+ functions or by 
    417418assigning set expressions.  The simplest set declaration creates 
     
    493494---- 
    494495 
     496=== Operations === 
     497 
    495498Sets may also be created by assigning other Pyomo sets as in these examples that also 
    496499illustrate the set operators union, intersection, difference, and exclusive-or: 
     
    501504model.K = model.A - model.D # difference 
    502505model.L = model.A ^ model.D # exclusive-or 
     506---- 
     507The cross-product operator is the asterisk (*). For example, to assign 
     508a set the cross product of two other sets, one could use 
     509---- 
     510model.K = model.B * model.c 
     511---- 
     512or to indicate the the members of a set are restricted to be 
     513in the cross product of two other sets, one could use 
     514---- 
     515model.K = Set(within=model.B * model.C) 
    503516---- 
    504517 
  • coopr.doc/trunk/GettingStarted/current/scripts.txt

    r5689 r5744  
    303303==== All Variables from a Python Script ==== 
    304304 
    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 
     305As with one variable, we assume that the model has been instantiated and solved and the results have been loded back into the instance object 
     306using +instance.load(results)+, then we can make 
    306307use 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 
    307308instance 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.