help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Question about modeling in MathProg


From: aly
Subject: [Help-glpk] Question about modeling in MathProg
Date: Sat, 6 Mar 2010 13:42:15 +0300

Hi All,

I have 3 modeling questions about MathProg (GLPK). They might be simple, but I 
just wanna make sure. I'd appreciate any help:


1. Suppose we have a set of periods T. Also, there are two variables, x_t and 
y_t. Now, there is a constraint that is "x_(t-1) - x_t = y_t \for all t=2,..,T."

I'm thinking of defining it as:

"s.t. balance{t in 2..T}: x[t-1]-x[t]==y[t];", after defining the set T in the 
beginning by "set T;"; and the variables x_t and y_t by "var x{t in T}>=0;" and 
"var y{t in T}>=0;" respectively.


Is that right?


2. Continuing on the previous question, suppose another constraint for t=1 is 
"initial-x_t=y_t \for t=1.", where initial is a parameter.

Is it defined by "s.t. balance1: initial -x[1] == y[1];" after defining the 
parameter initial by "param initial;" ?



3. Suppose there are a variable z_tu, where the 2 indices t and u are defined 
on the set T, a parameter d_t, and a constraint "\sum_{u>t} z_{ut} = \sum_{u<t} 
z_{tu} + d_t \for all t \in T".

After defining the set T, variable z_tu and parameter d_t by "set T;", "var z{t 
in T, u in T}>=0;" and "param d{t in T};" respectively, I think of defining the 
constraint by "s.t. delivery{t in T} sum{u in T} z[u,t]==sum{u in 
T}z[t,u]+d[t];", but that might not be right!

Could you verify it for me, please?



Thanks a lot,

Aly




-- 
PhD Student
Vice President, Egyptian Student Association in North America, Georgia Tech 
Chapter

Rm. 407 Main Building
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology
765 Ferst Dr., NW
Atlanta, Georgia 30332-0205, USA








reply via email to

[Prev in Thread] Current Thread [Next in Thread]