I have a scalar defined ‘x’ that takes a random value and a dynamic set defined.
x = uniformInt(min,max); …random value assigned to the scalar
set a / 1 * 100 /; …maximum set size
set i(a); …set i defined as subset of a
i(a) = ord(a) <= x; …the subset size is restricted to the random value
When a new variable is defined d(i) I get an error message “Assigned set used as domain”
Is there any way around this?
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Abhay
Define d over the original set i and then use afterwards d(a).
Cheers
Renger
\
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
Info@modelworks.ch
blog.modelworks.ch
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Abhay Lidbe
Sent: Mittwoch, 26. Februar 2014 03:25
To: gamsworld@googlegroups.com
Subject: Using scalar value to define a set size
I have a scalar defined ‘x’ that takes a random value and a dynamic set defined.
x = uniformInt(min,max); …random value assigned to the scalar
set a / 1 * 100 /; …maximum set size
set i(a); …set i defined as subset of a
i(a) = ord(a) <= x; …the subset size is restricted to the random value
When a new variable is defined d(i) I get an error message “Assigned set used as domain”
Is there any way around this?
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
Abhay,
Like Renger mentioned, you could declare variable d over the static superset, but use it over the dynamic subset i. This is a common technique well worth learning and using.
For example:
variable d(a);
someEqu … v =e= sum{i(a), d(a)};
otherEqu(i(a))… d(a) =L= sum{j, B(a,j)};
-Steve
On Tue, Feb 25, 2014 at 9:25 PM, Abhay Lidbe wrote:
I have a scalar defined ‘x’ that takes a random value and a dynamic set defined.
x = uniformInt(min,max); …random value assigned to the scalar
set a / 1 * 100 /; …maximum set size
set i(a); …set i defined as subset of a
i(a) = ord(a) <= x; …the subset size is restricted to the random value
When a new variable is defined d(i) I get an error message “Assigned set used as domain”
Is there any way around this?
\
Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com