Difference: VariablesInAMPL (7 vs. 8)

Revision 82011-09-16 - MichaelOSullivan

Line: 1 to 1
<-- Ready to Review -->

Variables in AMPL

Line: 63 to 63
  Note There are many attributes that may follow a variable declaration. They can be placed in any order and must be separated by either whitespace or commas.
var Percentage {INGREDIENTS} <= 0, >= 100;
var Production {SURFBOARDS} integer >= 0; 

Parameters as Bounds

To use parameters as bounds you first need to define the parameters, then use them when defining the variable, By using defaults you only need to define bounds when necessary:

param lb {FEEDS} default 0; # Could use -Infinity here
param ub {FEEDS} default Infinity;

var Amount {f in FEEDS} >= lb[f] <= ub[f]; # Amount[f] >= 0 for all f by default


param lb :=

param ub :=
  GRAIN 10

# The amount of grain is between 1 and 10, the amoun tof pasture is <= 6, all amounts are >= 0
 Return to top

Initial Values

This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback