help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Calculate model parameter in a for loop in GMPL


From: glpk xypron
Subject: Re: [Help-glpk] Calculate model parameter in a for loop in GMPL
Date: Sun, 05 Jun 2011 21:21:36 +0200

Hello Osman,

GMPL is a functional programming language, see
http://en.wikipedia.org/wiki/Functional_programming

Hence parameters are not calculated in loops.

Please, have a look at the manual doc/gmpl.pdf and the 
examples directory provided with GLPK. Both are available in the
source distribution available at:
ftp://ftp.gnu.org/gnu/glpk/glpk-4.45.tar.gz

>  forall{d in D}: s[g[d]] = s[g[d]]+1;
This statement simply created 20 constraints which require
0 == 1.

Best regards

Xypron


-------- Original-Nachricht --------
> Datum: Sat, 04 Jun 2011 15:55:21 -0400
> Betreff: [Help-glpk] Calculate model parameter in a for loop in GMPL

> Hi All,
> 
> How can I calculate a model parameter in a for loop in GMPL? I tried the
> code below but id did not work.
> 
> set T := 1..10;
> set D := 1..20;
> 
> param s{T} := 0;
> param g{D} := trunc(Uniform(1, 11));
> 
> # compute the size
>  forall{d in D}: s[g[d]] = s[g[d]]+1;
> 
> 
> After the for loop the value of the s[] parameter is still zero for all
> indices.
> 
> 
> Osman Y. Ozaltin
> PhD Candidate
> 1048 Benedum Hall
> Department of Industrial Engineering
> University of Pittsburgh
> Pittsburgh PA 15261
> URL. www.pitt.edu/~oyo1
> E-mail. address@hidden
> Phone. 724-234-8490
> 
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



reply via email to

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