Description
The task: design a brick s.t. 1. The base has an area of at least A square units 2. The volume is at least V cubic units 3. Length, width, and height are at least L, W, and H 4. The length and/or width will be fixed: this trumps L or W or A This contrived example serves to illustrate how varlist matching can be useful in MCP models. It's helpful to the solver to use positive minimum dimensions. minimum dims for our brick
Small Model of Type : MCP
Category : GAMS Model library
Main file : brick.gms
$title Brick design (BRICK,SEQ=437)
$ontext
The task: design a brick s.t.
1. The base has an area of at least A square units
2. The volume is at least V cubic units
3. Length, width, and height are at least L, W, and H
4. The length and/or width will be fixed: this trumps L or W or A
This contrived example serves to illustrate how varlist matching
can be useful in MCP models.
It's helpful to the solver to use positive minimum dimensions.
$offtext
* minimum dims for our brick
scalars
L 'min length' / 0.5 /
W 'min width' / 0.5 /
H 'min height' / 0.5 /
A 'min area' / 10 /
V 'min volume' / 30 /
;
variables
xL / LO [L] /
xW / LO [W] /
xH / LO [H] /
;
equations
Areq 'meet area requirement'
Vreq 'meet volume requirement'
;
Areq .. xL * xW =N= A;
Vreq .. xL * xW * xH =N= V;
model m / Vreq.xH, Areq : (xL|xW) /;
xL.fx = 5;
solve m using mcp;
* fixing both xL and xW essentially removes the area constraint
xW.fx = 3;
solve m using mcp;