Contitional equations in GAMS

Dear GAMS group,

I need help for a coding in GAMS

I would like to code conditional equations in my model.
A = B1 - C1 if B1-C1> B2-C2
A = B2 - C2 if B1-C1 B2-C2
A2… A = B2 - C2 if B1-C1< B2-C2
Thank you very much!!!

\

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Redwood,

The easiest solution is to define A as larger than both differences and then minimize your variable A (if A is entered in the objective function). Another is to cut the problem in smaller pieces, where e.g. A1 and A2 are introduced. In either case, the solution is strongly dependent on what you do with this variable A after this calculation.

Kind regards,
Henry

On Wednesday, February 27, 2013 3:34:23 PM UTC+1, Redwood wrote:

Dear GAMS group,

I need help for a coding in GAMS

I would like to code conditional equations in my model.
A = B1 - C1 if B1-C1> B2-C2
A = B2 - C2 if B1-C1 B2-C2
A2… A = B2 - C2 if B1-C1< B2-C2
Thank you very much!!!

\

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Redwood,

I hope the dollar operator can address the problem.

A1… A$(B1-C1 ge B2-C2) =e= B1 - C1;
A2… A $(B1-C1 le B2-C2)= e= B2 - C2;

Regards,
Yonas

On Wednesday, February 27, 2013 3:34:23 PM UTC+1, Redwood wrote:

Dear GAMS group,

I need help for a coding in GAMS

I would like to code conditional equations in my model.
A = B1 - C1 if B1-C1> B2-C2
A = B2 - C2 if B1-C1 B2-C2
A2… A = B2 - C2 if B1-C1< B2-C2
Thank you very much!!!

\

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Dear Yonas,

I hadn’t thought of that. Problem is your syntax only works when B1, B2, C1 and C2 are all either sets or parameters. The introducing an either-or variable (binary) and looking at this problem will hopefully help you out.

Kind regards,
Henry

On Wednesday, February 27, 2013 5:38:13 PM UTC+1, Yonas Gebrekiros wrote:

Dear Redwood,

I hope the dollar operator can address the problem.

A1… A$(B1-C1 ge B2-C2) =e= B1 - C1;
A2… A $(B1-C1 le B2-C2)= e= B2 - C2;

Regards,
Yonas

On Wednesday, February 27, 2013 3:34:23 PM UTC+1, Redwood wrote:

Dear GAMS group,

I need help for a coding in GAMS

I would like to code conditional equations in my model.
A = B1 - C1 if B1-C1> B2-C2
A = B2 - C2 if B1-C1 B2-C2
A2… A = B2 - C2 if B1-C1< B2-C2
Thank you very much!!!

\

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Seems I forgot the link:
https://groups.google.com/forum/?fromgroups=#!topic/gamsworld/xlmax6sKWw8[1-25-false]


On Wednesday, February 27, 2013 8:26:32 PM UTC+1, Henry JW Vermue wrote:

Dear Yonas,

I hadn’t thought of that. Problem is your syntax only works when B1, B2, C1 and C2 are all either sets or parameters. The introducing an either-or variable (binary) and looking at this problem will hopefully help you out.

Kind regards,
Henry

On Wednesday, February 27, 2013 5:38:13 PM UTC+1, Yonas Gebrekiros wrote:

Dear Redwood,

I hope the dollar operator can address the problem.

A1… A$(B1-C1 ge B2-C2) =e= B1 - C1;
A2… A $(B1-C1 le B2-C2)= e= B2 - C2;

Regards,
Yonas

On Wednesday, February 27, 2013 3:34:23 PM UTC+1, Redwood wrote:

Dear GAMS group,

I need help for a coding in GAMS

I would like to code conditional equations in my model.
A = B1 - C1 if B1-C1> B2-C2
A = B2 - C2 if B1-C1 B2-C2
A2… A = B2 - C2 if B1-C1< B2-C2
Thank you very much!!!

\

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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\