[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Unreferenced Out of Domain Error
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Unreferenced Out of Domain Error |
Date: |
Mon, 10 Dec 2012 22:07:36 +0400 |
> I don't think the error would come up unless you read in the data for
> the Stand_Type parameter from a file that contained an entry for (314,2,17).
References to parameter members do not depend on the parameter data;
they depend only on statements in which the parameter members are used.
The sum
sum{ i in stands, j in pres[char_stand[i]], t in 0..19 }
Stand_Type[i,j,t];
is computed by the mathprog translator literally as follows:
s := 0;
for i in stands do
for j in pres[char_stand[i]] do
for t in 0..19 do
s := s + Stand_Type[i,j,t];
If char_stand[314] = 0 and pres[0] = { 1, 101, 102 }, j *cannot* be
assigned 2, and therefore Stand_Type[314,2,17] *cannot* be referenced
on computing this sum.
>
> Andrew
>
> On 08/12/2012 5:56 AM, Andrew Makhorin wrote:
> >> Thanks for your response.
> >> I entered the debugging statement you suggested; the triplet
> >> (314,2,17) does not get printed, but an attempt is still made to
> >> access Stand_Type[314,2,17] when it gets to:
> >>
> >> sum { i in stands, j in pres[char_stand[i], t in 0..19 } Stand_Type[i,j,t].
> >>
> >> I don't know what to make of it.
> >>
> > I tried to reproduce the effect (see below). As you can see,
> > Stand_Type[314,2,17] is *not* referenced; otherwise, this would cause a
> > zero divide error. Please check your model and data more carefully;
> > maybe that parameter member is referenced somewhere else.
> >
> >
> > Andrew Makhorin
> >
> >
> > set stands;
> > set pres{0..1};
> > param char_stand{stands};
> >
> > display stands, pres, char_stand;
> >
> > param Stand_Type{i in stands, j in 1..1000, t in 0..19} :=
> > if i = 314 and j = 2 and t = 17 then 1 / 0 else 1;
> >
> > display sum{ i in stands, j in pres[char_stand[i]], t in 0..19 }
> > Stand_Type[i,j,t];
> >
> > data;
> >
> > set stands := 300, 314, 350;
> > set pres[0] := 1, 101, 102;
> > set pres[1] := 1, 2, 3, 4, 5, 6;
> > param char_stand := [300] 1, [314] 0, [350] 1;
> >
> > end;
> >
> > GLPSOL: GLPK LP/MIP Solver, v4.48
> > Parameter(s) specified in the command line:
> > --check -m test.mod --log test.log
> > Reading model section from test.mod...
> > Reading data section from test.mod...
> > 20 lines were read
> > Display statement at line 5
> > stands:
> > 300
> > 314
> > 350
> > pres[0]:
> > 1
> > 101
> > 102
> > pres[1]:
> > 1
> > 2
> > 3
> > 4
> > 5
> > 6
> > char_stand[300] = 1
> > char_stand[314] = 0
> > char_stand[350] = 1
> > Display statement at line 10
> > 300
> > Model has been successfully generated
> >
> >
> >
>
>