Hello Daniele, sorry got it wrong.
param R; param T; set W; param r{W}; param d{W}; set Q{i in W} := {1-d[i]..T-1}; var x{i in W, Q[i]}, >= 0; maximize objective: sum{i in W, q in Q[i]} x[i,q]; s.t. constraint{t in {1..T}}: sum{i in W} sum{q in Q[i]} r[i] * x[i,q] <= R; data; set W := a b; param R := 10; param T := 5; param d := [a] 2 [b] 3; param r := [a] .5 [b] .7; end; Best regards Xypron -------- Original-Nachricht -------- > Datum: Thu, 28 Jun 2012 06:22:13 +0200 > Betreff: Re: [Help-glpk] help > Hello Daniele, > > the following model contains a constraint of the type you refer to. > Please, read glpk-4.47/doc/gmpl.pdf carefully. It is included in the > source distribution of GLPK available at > ftp://ftp.gnu.org/gnu/glpk/glpk-4.47.tar.gz > > param R; > param T; > param t; > set Q := { 1..T }; > set W; > param r{W}; > param d{W}; > var x{W,Q}, >= 0, <=10; > maximize objective: > sum{i in W, q in Q} x[i,q]; > s.t. constraint: > sum{i in W} sum{q in Q : q >= t-d[i] && q <= t-1} r[i] * x[i,q] <= R; > data; > set W := a b; > param R := 10; > param T := 5; > param t := 6; > param d := > [a] 2 > [b] 3; > param r := > [a] .5 > [b] .7; > end; > > Best regards > > Xypron > -------- Original-Nachricht -------- > > Datum: Wed, 27 Jun 2012 11:02:27 +0200 > > Betreff: Re: [Help-glpk] help > > > Re: [Help-glpk] help > > > > I have attached the image so it is clearer > > W is a set of tasks > > T is the set of the time allowed > > r (i) is the parameter of the requested resource the activity i-th > > d (i) is the duration of the i-th activity > > R is the parameter that represents the total resource available in the > > system > > X (i, q) is the variable > > > > Thanks > > > > > > 2012/6/27 glpk xypron <xypron.g...@gmx.de> > > > > > Hello Daniele, > > > > > > from your description it is unclear what you mean by t. > > > > > > Is t the run parameter of the summation or is it a parameter > controlling > > > the boundaries of the summation? It cannot be both. > > > > > > Please, write down your equation completely including the definition > of > > > the sets and parameters. Either send it in tex or append an image > file. > > > > > > Best regards > > > > > > Xypron > > > > > > -------- Original-Nachricht -------- > > > > Datum: Tue, 26 Jun 2012 23:46:10 +0200 > > > > Betreff: Re: [Help-glpk] help > > > > > > > Re: [Help-glpk] help > > > > > > > > r (i) is a parameter and represents the resource request from the > i-th > > > > activities by the system. > > > > The variable is x (i, t) where i is the index of the activities of > the > > > > whole W and t is the index of the time interval. > > > > R is the total available resource is not exceeded while d (i) is the > > > > duration of the i.th activity > > > > > > > > > > > > > > > > > > > > > > > >> On Tue, 26 Jun 2012, Daniele Micarelli wrote: > > > > >> > > > > >> I have to solve a linear programming problem with the language > and > > > I'm > > > > >>> planning mathprog > > > > >>> I have difficulty writing the following constraint: ΣΣ r (i) * > x > > (i, > > > > t) > > > > >>> <= R > > > > >>> where the first summation is true for all belonging to the W and > > the > > > > >>> second > > > > >>> summation has as its lower end t-d(i) and upper bound as t-1 > > > > >>> > > > > >> > > > > >> You've not made it clear what is a variable and what is not. > > > > >> If r and x are both variables, you are done. > > > > >> *Linear* programming does not involve products of variables. > > > > >> > > > > >> -- > > > > > > -- > > > NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! > > > Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a > > > > > -- > Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir > belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de > > _______________________________________________ > Help-glpk mailing list > Help-glpk@gnu.org > 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 _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk