[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] How can I define bounds for a two dimensional variable e
From: |
glpk xypron |
Subject: |
Re: [Help-glpk] How can I define bounds for a two dimensional variable easily? |
Date: |
Thu, 26 Jan 2012 18:57:42 +0100 |
Hello Toni,
set P;
set T;
param ub{P};
var v{p in P, t in T}, <= ub[p];
maximize obj : sum{p in P, t in T} v[p,t];
solve;
display v;
data;
set P := power1, power2, power3;
set T := January, February, March;
param ub :=
[power1] 197
[power2] 217
[power3] 304;
end;
Please, read glpk-4.47/doc/glpk.pdf available in the source distribution of
GLPK at
ftp://ftp.gnu.org/gnu/glpk/glpk-4.47.tar.gz
Best regards
Xypron
-------- Original-Nachricht --------
> Datum: Tue, 24 Jan 2012 09:42:09 -0800 (PST)
> Betreff: [Help-glpk] How can I define bounds for a two dimensional variable
> easily?
>
> Hi there,
>
> i just recently startet to get used to GLPK and right now I can't find
> help
> in the wikibooks or manuals, so I try it here.
>
> I want to define constraints (especially upper bounds) for a two
> dimensional
> variable. In my case, the Variable is like that:
> power1 power2 power3 ....
> january
> february
> ...
>
> The specialty about this is the easy form of the constraint: one column
> its
> always the same number. Like that:
>
> power1 power2 power3 ....
> january c1 c2 c3
> february c1 c2 c3
> ...
>
> Is there an easy way to declare such a constraint in one line, or do I
> really have to make a table with an entry for each row and column?
>
> Thx,
> Raketenschnitzel
> --
> View this message in context:
> http://old.nabble.com/How-can-I-define-bounds-for-a-two-dimensional-variable-easily--tp33196373p33196373.html
> Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.
--
Follow me at http://twitter.com/#!/xypron
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de