[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: Fri, 07 Dec 2012 01:48:59 +0400

> This is a question about how GLPK/GMPL handles parameters populated
> with csv table data when executing statements.
> I have a parameter Stand_Type (dimension 3), and a set of sets
> pres{0..1}:
> pres[0] = 1,101,102
> pres[1]= 1,2,3,4,5,6
> Stand_Type is indexed by { i in stands, j in pres[ char_stand[i] ], t
> in 0..19 }, where char_stand[i] = 0 or 1.
> For a particular stand, say 314, char_stand[314]=0, thus in the
> statement:
>    sum { i in stands, j in pres[char_stand[i], t in 0..19 }
> Stand_Type[i,j,t],
> I would think Stand_Type[314,2,18] would never be called (since
> char_stand[314]=0 and 2 does not belong to pres[0]). However, this is
> not the case;  when building the model GLPK attempts to access
> Stand_Type[314,2,18]  while executing the above statement ( I know
> this because I get an out of domain error). Note: Stand_Type[314,2,18]
> does have an entry in the csv that populates the Stand_Type parameter
> and when I remove it, from the csv, I do not get the error.

It may happen that some fields are used to saturate index set(s), so
removing a record also removes the corresponding index.

> I'm curious as to why Stand_Type[314,2,18] is being called in the
> execution of the above statement when this combination of (i,j,t) is
> never referenced by the indexing expression.


Try to add the following statements before 'sum { i in stands,...'
for debugging:

   display stands, char_stand, pres;

   printf { i in stands, j in pres[char_stand[i]], t in 0..19 } 
       "%d,%d,%d\n", i, j, t;

I think that triplet "314,2,18" will be printed meaning that
Stand_Type[314,2,18] is referenced.

reply via email to

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