help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Question about modeling in MathProg


From: glpk xypron
Subject: Re: [Help-glpk] Question about modeling in MathProg
Date: Sat, 06 Mar 2010 17:56:09 +0100

-------- Original-Nachricht --------
> Datum: Sat, 6 Mar 2010 13:42:15 +0300
> Von: address@hidden
> An: address@hidden
> Betreff: [Help-glpk] Question about modeling in MathProg

> 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.

set T := {1..10};
var x{T};
var y{T};
s.t. balance{t in T : t >= 2}: x[t-1]-x[t]==y[t];
display balance;
end;

> 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;" ?

param initial;
s.t. balance1: initial -x[1] == y[1];

> 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?

s.t. delivery{t in T} : sum{u in T: u > t}z[u,t]
==sum{u in T: u < t}z[t,u]+d[t];

Best regards

Xypron

-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser




reply via email to

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