[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Fwd: Defining a subset of a multi dimension set
From: |
Aly Megahed |
Subject: |
[Help-glpk] Fwd: Defining a subset of a multi dimension set |
Date: |
Fri, 1 Oct 2010 02:03:24 +0400 |
Hello Xypron,
Thanks for your help. That works, but I have a couple of questions/concerns:
1. When using the same idea to define a two-dimensional set, would it get all
combinations of the 2 indices, or only the combinations of these 2 indices that
are there in the corresponding input table?
So, for instance, continuing on my previous table with 4 indices, if I define a
set with 2 indices as follows:
set Facilities_Resources_IN_FacilityResourcePeriod, dimen 2;
table Facilities_Resources_IN_FacilityResourcePeriod_jrtt IN "ODBC"
'FileDSN=.\d2.dsn;READONLY=FALSE'
'SELECT DISTINCT FacilityID, ResourceID FROM TransformerTypePeriodResources' :
Facilities_Resources_IN_FacilityResourcePeriod <-[FacilityID, ResourceID];
Then, would that set have all combinations of FacilityID and ResourceID
independently, or just the combinations that were there in the table? The
latter is the needed one not the former, but I just wanna make sure that the
above syntax would make glpk get the latter! And if it does get the former, how
can I define a set that gets the latter?
2. Isn't there any other way that is less memory intensive? I mean, isn't there
a way to access 1 or 2 indices in a 3 indexed set, without defining and storing
a set for that??
I actually needed that (accessing an index in a multi-indexed set) in the
constraints, and when I used the method you described, I ran out of memory!!
Let me be more clear, for instance, one of my constraints is:
s.t. (i, r,t): sum(p) tres_iprt[i,p,r,t] * pq[i,p,t] <= tcap_irt[i,r,t]
Where I want it to be for every (i,r,t) for only the combinations of i,r,t
taken from a certain table. So, I defined a set for that (tcap_irt_set). Also,
the parameter tres_iprt[i,p,r,t] and the variable pq[i,p,t] are only defined on
for certain combinations (i,p,r,t) and (i,p,t) respectively. So, I defined 2
sets that are read from their corresponding tables (tres_iprt_set and
tcap_ipt_set respectively).
Finally, I had to use the idea you described to define a set that accesses the
p in either the tcap_ipt_set or tres_iprt_set (the data input is assumed to
guarantee that the combinations of (i,p,t) in tcap_ipt_set are the same
combinations found at tres_iprt_set, and those found at tcap_irt_set).
So, the constraint in glpk syntax looks like (all my constraints are very
similar to this one):
s.t. tcap_irttt{(i,r,t) in tcap_irt_set}: sum{p in Ptcap_ipt_set: (i,p,r,t) in
tres_iprt_set and (i,p,t) in tcap_ipt_set} tres_iprt[i,p,r,t] * pq[i,p,t] <=
tcap_irt[i,r,t];
Note that I'm doing all these set restrictions in order to not define
unnecessary zero variables/constraints, in order to not run out of memory (as
per an advise you told me earlier).
So, any idea on how to better deal with that issue, in order to handle memory
better?
Thanks a lot for all the help!
Aly
----- Original Message -----
From: "glpk xypron" <address@hidden>
To: address@hidden, address@hidden
Sent: Thursday, September 23, 2010 3:23:12 PM GMT -05:00 US/Canada Eastern
Subject: Re: Defining a subset of a multi dimension set
Hello Aly,
> set Facilities_IN_FacilityResourcePeriod, dimen 1;
> table Facilities_IN_FacilityResourcePeriod_jrtt IN "ODBC"
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
> 'TransformerTypePeriodResources' :
> Facilities_IN_FacilityResourcePeriod <-[FacilityID];
>
> But when the data were read, I get an error of "Duplicate Tuple 1
> Detected" which is expected since the same FacilitiID can be in multiple
> records
set Facilities_IN_FacilityResourcePeriod, dimen 1;
table Facilities_IN_FacilityResourcePeriod_jrtt IN "ODBC"
'FileDSN=.\d2.dsn;READONLY=FALSE'
'SELECT DISTINCT FacilityID FROM TransformerTypePeriodResources' :
Facilities_IN_FacilityResourcePeriod <-[FacilityID];
Best regards
Xypron
-------- Original-Nachricht --------
> Datum: Thu, 23 Sep 2010 07:38:35 -0400 (EDT)
> Von: address@hidden
> An: help-glpk <address@hidden>, glpk xypron <address@hidden>
> Betreff: Defining a subset of a multi dimension set
> Hi All,
>
> Suppose I have 3 sets, J, R and T for Facilities, Resources and Periods
> respectively and that each is well defined. And suppose there is a set of
> dimension 3 that was defined as follows:
>
>
> set FacilityResourcePeriod, dimen 3;
> table FacilityResourcePeriod_jrtt IN "ODBC"
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
> 'TransformerTypePeriodResources' :
> FacilityResourcePeriod <-[FacilityID, ResourceID, PeriodID];
>
>
> Note that the set FacilityResourcePeriod would not have all possible
> combinations of the elements of J, R and T (as the table its values are read
> from has only a subset of the combinations).
>
> What I would like to do is to define a set, that is a subset of J, and
> that only contains the Facilities that are in FacilityResourcePeriod. I tried
> to define it that way:
>
> set Facilities_IN_FacilityResourcePeriod, dimen 1;
> table Facilities_IN_FacilityResourcePeriod_jrtt IN "ODBC"
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
> 'TransformerTypePeriodResources' :
> Facilities_IN_FacilityResourcePeriod <-[FacilityID];
>
>
> But when the data were read, I get an error of "Duplicate Tuple 1
> Detected" which is expected since the same FacilitiID can be in multiple
> records
> (each with a different combination of ResourceID and PeriodID).
>
> So, how can I define such a set?
>
> Any help will be greatly appreciated!
>
> Aly
>
> --
>
> PhD Student
>
> Rm. 407 Main Building
> H. Milton Stewart School of Industrial and Systems Engineering
> Georgia Institute of Technology
> 765 Ferst Dr., NW
> Atlanta, Georgia 30332-0205, USA
>
--
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome
--
PhD Student
Rm. 407 Main Building
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology
765 Ferst Dr., NW
Atlanta, Georgia 30332-0205, USA
--
PhD Student
Rm. 407 Main Building
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology
765 Ferst Dr., NW
Atlanta, Georgia 30332-0205, USA
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-glpk] Fwd: Defining a subset of a multi dimension set,
Aly Megahed <=