help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] [Fwd: creating subsets from other sets with numeric clau


From: Andrew Makhorin
Subject: Re: [Help-glpk] [Fwd: creating subsets from other sets with numeric clauses]
Date: Tue, 04 Mar 2014 18:16:15 +0400

> I am trying the create a subset based on content of a data set in GMPL.

> Using the assign,mod in examples directory – 

> param c{i in I, j in J}, >= 0;
> 
> /* cost of allocating task j to agent i */
> 
> param d {(i,j) in I cross J: c[i,j]=12} := c[i,j];
> 
> display d;
> 
> set E := {(i,j) in I cross J: d[i,j]>0};
> 
> display E;

> getting;
> 
> Display statement at line 33
> 
> d[1,4] = 12
> 
> d[2,1] = 12
> 
> d[4,5] = 12
> 
> d[5,7] = 12
> 
> Display statement at line 35
> 
> assign.mod:35: d[1,1] out of domain
> 
> MathProg model processing error

> Parameter d is created correctly, but set E is not!  What is the correct
> way of creating such subsets based on parameter clause(s)?

d[i,j] is defined over a subset of IxJ, so you cannot use it in a
condition like d[i,j] > 0 for all (i,j) in IxJ (see the 'out of domain'
error message).

To define E you need to define a domain of d, e.g.

set D := {i in I, j in J: c[i,j] = 12}

param d{(i,j) in D} := c[i,j]

set E := {(i,j) in D: d[i,j] > 0}





reply via email to

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