[Top][All Lists]

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

Re: [Help-glpk] Concatenate Parameter "Fields" Question

From: glpk xypron
Subject: Re: [Help-glpk] Concatenate Parameter "Fields" Question
Date: Fri, 31 Aug 2012 17:19:15 +0200

Hello Robert,

set DMD_t, dimen 4;
param Demand_t{DMD_t};
set DMD, dimen 3 := setof{(s, c, st, m) in DMD_t}(s, c & ", " & st, m);
param Demand{(s,cst,m) in DMD} := 
  sum{(s, c, st, m) in DMD_t: cst == c & ", " & st}Demand_t[s, c, st, m];
display DMD, Demand;
set DMD_t :=
p8,'Des Moines',IA,1;
param Demand_t :=
[p8,'Des Moines',IA,1]775;

Best regards

-------- Original-Nachricht --------
> Datum: Fri, 31 Aug 2012 00:45:44 -0500
> Betreff: [Help-glpk] Concatenate Parameter "Fields" Question

> I'm currently importing demand as a set of SKU(s), City(c ), State(s),
> TransMode(m) tuple parameters.  I'd like to eliminate a dimension by
> concatenating the City and State into one element.  I see how to do this for 
> a set:
> set LOC := setof{(s, c, st, m) in DMD_t}(c&", "&st);  #the set of valid
> City/State combination
> set DMD := setof{(s, c, st, m) in DMD_t}(s, c&", "&st, m);  #The demand
> set: SKU, City/State, Mode
> Where DMD_t is my temporary demand set of imported data with dimension 4,
> and DMD is the 3 dimension set I'd like to work with in the model.
> My question: Is there a similar construct for converting a 4-tuple
> parameter to a 3-tuple?
> That is, can I somehow convert:
> Parameter Demand_t[s, c, st, m] to Parameter Demand[s, l, m] by
> concatenating the city and state dimenstions.
> I realize I could concatenate the fields in my input data, but I'm curious
> if there is a way to accomplish this with parameter manipulation.  I'm new
> to glpk, so apologies in advance if this is a silly question.
> Thanks for your help,
> Rob

reply via email to

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