I have been learning about linear programming
using python and GLPK and was hoping that someone might be able to point me
towards a reference to learn how to develop variable bounds that are endogenous
to other structural variables (preferably using these programs, not only am I
new to linear programming, but I am relatively new to computer programming)? I
am initially interested in cases where the endogenous relationship is between
structural variables. I am able to write the code for constraints when
they are exogenous, but am having trouble writing the code for a constraint
when a structural variable is limited by another structural variable. If it is
helpful, I have included a simplified
example below (not code, just the concept).
The example I am working with is to minimize
the costs associated with production of widgets over two years, assuming that
you can choose to produce from 2 factories with costs (capital and operating)
that
decrease through time. Both capital and
operating costs increase linearly with production (cost per unit * number of
units = total cost). At the start,
neither factor exists, so you need to add capacity to meet widget demand. Each
factory has a total production capacity
limit and you can add capacity at different times. For instance, you can build
40% of total
capacity in year 1, and then the remaining 60% in year 2. Since
capital/operating costs decline in year
2, you build the remaining 60% at lower cost (operating costs are related to
the year of construction, so the operating costs in year 2 will be different
for the 40% and 60%). In year 2, you can also decide to back-off production at
the 40% of the factory built in year 1 and produce only from the 60% built in
year 2 (and thus not incur the operating costs from the 40%). However, the
capital costs are amortized, so
if you decide to build anything in the first year, you will incur capital costs
in the second year.
How you allocate the operating costs in year 2
therefore depends on your decisions in year 1.
The maximum production from capacity added in the first year is limited
by the production capacity installed in year 1.
So my minimization function looks something like (for brevity, I wrote
the equation for only 1 factory and only for year 2):
Minimize:
TC2 = X1*Cap1 + X1y2*OP1 y2 + X2*(Cap2
+ OP2)
Subject
to:
P2 = X1y2 + X2 (Total production in year 2 is production of widgets using
capacity installed in year ) 0 <= P2 <= D2 (Total widgets produced
in year 2 must equal demand in year 2, where demand is exogenously determined)0
<= X1y2 + X2 <= C2 (Total production
must be less than factor capacity)0<= X1 y2 < = X1Production in year 2 from
capacity added in
year 1 is limited by capacity added in year 1 (where the capacity added in year
is equal to the number of widgets produced)
Variable Descriptions:
P2
= Total widget production
D2
= Widget demand in year 2
C2
= Production capacity in year 2
X1
=
# of widgets produced using capacity installed in year 1
Cap1
=
Capital costs associated with capacity installed in year 1
OP1 y2 = Operating costs associated with capacity
installed in year 1
X2
= # of widgets produced using
capacity installed in year 2
Cap1
=
Capital costs associated with capacity installed in year 2
OP2 = Operating costs associated with capacity
installed in year 2
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk