help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] manipulating parameter indices


From: glpk xypron
Subject: Re: [Help-glpk] manipulating parameter indices
Date: Sat, 30 Jun 2012 06:59:27 +0200

Hello Kevin,

try the following:

set EFF, dimen 5;
set inputs := setof{(i,p,v,o,e) in EFF}i;
set process := setof{(i,p,v,o,e) in EFF}p;
set vintage := setof{(i,p,v,o,e) in EFF}v;
set outputs := setof{(i,p,v,o,e) in EFF}o;
set S := setof{(i,p,v,o,e) in EFF} (i,p,v,o);
param eff{(i,p,v,o) in S} := sum{(i,p,v,o,e) in EFF}e;
solve;
display eff;
data;
set EFF :=
# input     process        vintage output      efficieny
  coal      coal_pp        2015    electricity 0.4
  uranium   nuclear_pp     2015    electricity 0.4
  sunlight  passive_solar  2020    heat        0.6;
end;

Best regards

Xypron
-------- Original-Nachricht --------
> Datum: Fri, 29 Jun 2012 15:12:19 -0400
> Betreff: [Help-glpk] manipulating parameter indices

> Hello GLPK list,
> 
> Is there a method for collecting user-specified parameter indices into 
> an n-dimensional set?
> 
> I'm trying to reduce the amount of "knobs" I have to twiddle on a model 
> with which I'm working, and it dawned on my that I have a parameter 
> whose /indices/ contain valuable information that the rest of my model 
> could use.
> 
> For the sake of argument, this model has the notion of inputs, 
> processes, and outputs, where the processes convert inputs to outputs. 
> However, processes only operate on 1 or 2 inputs, and only create 1 or 2 
> outputs.  Thus, it would be highly beneficial to automatically create 
> sparse index sets, if for no other reason than helping to check my 
> typing ability.  Consider these 5 sets:
> 
> set periods :=  2015  2020  2025  2030 ;
> set vintage :=  2015  2020  2025  2030 ;
> 
> set inputs  :=  coal  oil  uranium  sunlight  gasoline  diesel
>                  electricity ;
> 
> set outputs :=  electricity  gasoline  diesel  heat  miles ;
> 
> set processes :=
>     coal_pp  diesel_pp  solar_pp   nuclear_pp  refinery
>     passive_solar  electric_heat  gas_car  diesel_car;
> 
> I might tie these together in my model through an efficiency parameter:
> 
> param  eff{i in inputs, p in process, v in vintage, o in outputs} :=
>    coal      coal_pp        2015  electricity       0.4
>    uranium   nuclear_pp     2015  electricity       0.4
>    sunlight  passive_solar  2020  heat              0.6
> ;
> 
> While it makes sense for a coal power plant to take coal as input, and 
> produce electricity, it does not makes sense for a diesel_car to take 
> take heat and produce sunlight.  Consequently, that combination does not 
> exist in the eff parameter indices.
> 
> Rather than create an explicit 3-dimensional set that I must manually 
> populate, only to turn around and manually specify the same set for each 
> index in the eff parameter indices, is it possible to harvest the 
> information contained in the parameter indices?  I might use this to 
> automatically generate the set of valid indices over which, say, the 
> usable life of each process might be:
> 
> param  usable_life {(p,v) in valid_processes} default 30 :=
>     coal_pp 2015   15
>     coal_pp 2020   17   # GLPK would ostensibly provide an error
>                         # message because the eff parameter does
>                         # not have the <coal_pp, 2017> tuple in
>                         # the (p,v) subset of it's indices.
> ;
> 
> Does this functionality exist in GLPK?  I know at least one other 
> modeling system that provides for it, so I'm hoping that I've just 
> missed something in the gmpl.pdf documentation.
> 
> Thanks,
> 
> Kevin
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a



reply via email to

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