Changeset 5779


Ignore:
Timestamp:
May 15, 2012 3:56:15 PM (8 years ago)
Author:
dlwoodr
Message:

added info about getting solution status in a script; did a temporary fix of some formatting problems in pysp

Location:
coopr.doc/trunk/GettingStarted/current
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coopr.doc/trunk/GettingStarted/current/pyomo.txt

    r5773 r5779  
    433433* within = Set used for validation; it is a super-set of the set being declared.
    434434
    435 To create a set whose members will be two dimensional, use
     435One way to create a set whose members will be two dimensional is to use
     436the +dimen+ argument:
    436437----
    437438model.B = Set(dimen=2)
     
    515516model.K = Set(within=model.B * model.C)
    516517----
     518
     519The cross-product operator is the asterisk (*).
     520For example, to create a set that contains the cross-product
     521of sets A and B, use
     522----
     523model.C = Set(model.A * model.B)
     524----
     525to instead create a set that can contain a subset of the members of this
     526cross-product, use
     527----
     528model.C = Set(within=model.A * model.B)
     529----
     530
    517531
    518532=== Predefined Virtual Sets ===
  • coopr.doc/trunk/GettingStarted/current/pysp.txt

    r5583 r5779  
    2727Birge and Louveaux <<BirgeLouveauxBook>> make use of the example of a farmer
    2828who has 500 acres that can be planted in wheat, corn or sugar beets,
    29 at a per acre cost of $150, $230 and $260, respectively. The farmer
     29at a per acre cost of \$150, \$230 and \$260, respectively. The farmer
    3030needs to have at least 200 tons of wheat and 240 tons of corn to use as feed, but
    31 if enough is not grown, those crops can be purchased for $238 and $210, respectively.
    32 Corn and wheat grown in excess of the feed requirements can be sold for $170 and $150,
    33 respectively. A price of $36 per ton is guaranteed for the first 6000 tons grown by
    34 any farmer, but beets in excess of that are sold for $10 per ton. The yield
     31if enough is not grown, those crops can be purchased for \$238 and \$210, respectively.
     32Corn and wheat grown in excess of the feed requirements can be sold for \$170 and \$150,
     33respectively. A price of \$36 per ton is guaranteed for the first 6000 tons grown by
     34any farmer, but beets in excess of that are sold for \$10 per ton. The yield
    3535is 2.5, 3, and 20 tons per acre for wheat, corn and sugar beets, respectively.
    3636
  • coopr.doc/trunk/GettingStarted/current/scripts.txt

    r5744 r5779  
    419419----
    420420
     421=== Accessing Solver Status ===
     422
     423After a solve, the results object has a member +Solution.Status+ that contains the
     424solver status. The following snippet shows an example of access via a +print+ statement:
     425----
     426instance = model.create()
     427results = opt.solve(instance)
     428print "The solver returned a status of:"+str(results.Solution.Status)
     429----
     430
     431The use of the Python +str+ function to cast the value to a be string makes it
     432easy to test it. In particular, the value 'optimal' indicates that the
     433solver succeeded.
     434
    421435// vim:set syntax=asciidoc:
    422436
Note: See TracChangeset for help on using the changeset viewer.