How to write a "for every x(i)" constraint?

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/IoIFCah2CIAJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi,

I use the following syntax:

subject to constraint{k in 1…N}: x _>= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson
\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/3s8mtlNt23IJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en._

Hi,

Thanks for the reply. I know that is the syntax for AMPL’s “for every” constraint. How would I input this type of constraint in GAMS?

You have to define this in under the “Equations” section of your model.

Thanks,
Jackson

On Wednesday, August 8, 2012 5:02:47 AM UTC-4, lkdo wrote:

Hi,

I use the following syntax:

subject to constraint{k in 1…N}: x _>= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson
\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/IUQDMXeDF8MJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en._

Hi
Just define a set i:

set i /1,2,3,4/

(you can replace 1,2,3,4 with anything you want). And then write the equation as

Eq(i)…
x(i)=l=10;

the above reads for each i in the set one equation:
x(1)= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/GhjvgE9HsTIJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thanks for the response.

I went ahead with what you said my constraint is:

Const1 … z(i) =l= y ;

And I’ve already defined the set i.

Now I get a new error that states: Uncontrolled set entered as constant.

both my z(i) and y are decision variables.

What am I doing wrong here?

Thanks,
Jackson
On Wednesday, August 8, 2012 10:08:58 AM UTC-4, TE wrote:

Hi
Just define a set i:

set i /1,2,3,4/

(you can replace 1,2,3,4 with anything you want). And then write the equation as

Eq(i)…
x(i)=l=10;

the above reads for each i in the set one equation:
x(1)= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/XPQ-c6uqaLMJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Jackson,
Write your constraint as follow,
Const1(i) … z(i) =l= y ;

\

Regards
Dileep Damayyawar


On 9 August 2012 01:57, Jackson wrote:

Thanks for the response.

I went ahead with what you said my constraint is:

Const1 … z(i) =l= y ;

And I’ve already defined the set i.

Now I get a new error that states: Uncontrolled set entered as constant.

both my z(i) and y are decision variables.

What am I doing wrong here?

Thanks,
Jackson
On Wednesday, August 8, 2012 10:08:58 AM UTC-4, TE wrote:

Hi
Just define a set i:

set i /1,2,3,4/

(you can replace 1,2,3,4 with anything you want). And then write the equation as

Eq(i)…
x(i)=l=10;

the above reads for each i in the set one equation:
x(1)= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/XPQ-c6uqaLMJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.







\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Dileep,

That did the trick, thanks for your help!

On Thursday, August 9, 2012 3:17:48 AM UTC-4, D.Dileep wrote:

Jackson,
Write your constraint as follow,
Const1(i) … z(i) =l= y ;

\

Regards
Dileep Damayyawar


On 9 August 2012 01:57, Jackson wrote:

Thanks for the response.

I went ahead with what you said my constraint is:

Const1 … z(i) =l= y ;

And I’ve already defined the set i.

Now I get a new error that states: Uncontrolled set entered as constant.

both my z(i) and y are decision variables.

What am I doing wrong here?

Thanks,
Jackson
On Wednesday, August 8, 2012 10:08:58 AM UTC-4, TE wrote:

Hi
Just define a set i:

set i /1,2,3,4/

(you can replace 1,2,3,4 with anything you want). And then write the equation as

Eq(i)…
x(i)=l=10;

the above reads for each i in the set one equation:
x(1)= 30;

It defines a set of N constraints that have similar structure.

best regards.

On Tuesday, 7 August 2012 23:46:28 UTC+2, Jackson wrote:

Hi,

I’m currently trying to figure out the syntax similar to “forall” in AMPL. I want to create a constraint that checks each x(i) in my model, how would I do this?

Thanks,
Jackson


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/XPQ-c6uqaLMJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.







\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/A3x356jPbxMJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.