gams:define_several_independent_models_in_one_gams_file

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

gams:define_several_independent_models_in_one_gams_file [2007/12/18 11:07] Franz Nelissen |
gams:define_several_independent_models_in_one_gams_file [2008/06/18 12:57] support |
||
---|---|---|---|

Line 1: | Line 1: | ||

====== How do I define several independent models in one GAMS file? ====== | ====== How do I define several independent models in one GAMS file? ====== | ||

- | Q:// We'd like to split the model into three independent parts without having to write of each of the equations and variables three times.// | + | Q:// We'd like to split the model into three independent parts without having to write each of the equations and variables three times.// |

Section 9 of the GAMS User's Guide explains the syntax of a model statement. If you want to declare several independent models you can also use an extended syntax like below (this was introduced with distribution 22.1). | Section 9 of the GAMS User's Guide explains the syntax of a model statement. If you want to declare several independent models you can also use an extended syntax like below (this was introduced with distribution 22.1). | ||

Line 23: | Line 23: | ||

and for each independent model you just declare another model, which includes the basic model and the additions equation(s): | and for each independent model you just declare another model, which includes the basic model and the additions equation(s): | ||

<code> | <code> | ||

- | ''model nc1 /basic, nc_eq1/''; | + | model nc1 /basic, nc_eq1/; |

- | ''model nc2 /basic, nc_eq2/''; | + | model nc2 /basic, nc_eq2/; |

- | ''model nc3 /basic, nc_eq3/''; | + | model nc3 /basic, nc_eq3/; |

+ | </code> | ||

+ | Another example is: | ||

+ | <code> | ||

+ | $call '=gamslib 1'; | ||

+ | $include trnsport.gms | ||

+ | | ||

+ | model trans1 /cost/, | ||

+ | trans2 /supply, demand/, | ||

+ | transport2 /trans1, trans2/; | ||

+ | solve transport2 using lp minimizing z ; | ||

</code> | </code> |

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/define_several_independent_models_in_one_gams_file.txt · Last modified: 2008/06/18 12:57 by support