Once an equation is in the model, you can still selectively include some or all instances of an equation by making its specification conditional on some test condition:

# E.g. declare an equation

EQUATION AVDIST(ATRAD,R,T) “total miles traveled from depot to biorefinery”;

# Specify it subject to certain $-conditions

AVDIST(ATRAD,R,T)$(TFORC(T)AFEAS(ATRAD)(SwTesting=0))… AVMILES_D(ATRAD,R,T)=E= [equation RHS follows here];

This equation only occurs for T in the forecast horizon TFORC, for feasible members of ATRAD, and if the switch SwTesting is 0.

More simply, you could do something like the following to use the setting of SwTesting to turn an equation on and off.

AVDIST(ATRAD,R,T)$(SwTesting=0)… AVMILES_D(ATRAD,R,T)=E= [equation RHS follows here];

Note 1: Somewhat like functions or variables in strongly-typed programming languages, in GAMS equations must first be â€œdeclaredâ€ and then â€œspecified or defined.â€

This gives you the latitude to *declare* general equations and include them in your model, but to make the actual instance of the equations used be dependent on the specific conditions in the equation *specification*.

Note 2: Since the model is not really created until the SOLVE statement, you have the ability to redefine control-settings like SwTesting after the MODEL statement but before the SOLVE statement.

Note 3: Actually, the same approach can use $-conditions in an equation specification to selectively include or exclude particular portions of an equation at SOLVE time, depending on parameter values or set membership.

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Hossein

Sent: Tuesday, September 09, 2014 10:10 AM

To: gamsworld@googlegroups.com

Subject: How can some equations be removed from a model after the model statement?

How can some equations be removed from a model after the model statement?

For example, the model â€˜testâ€™ is defined as follows:

Model test /all/;

After that, we may need to remove the equation named â€˜eq1â€™ from this model.

Thanks in advance;

Hossein

–

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/d/optout.

–

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/d/optout.