Model declaration using files?

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Model declaration using files?

Post by Archiver »



Hi,

I am working on a really big model with a number of equations in
multiple gams files. I use these equations to construct multiple
models. When it comes to model declaration, it becomes very tedious to
write each and every equations in the "Model" statement.

I want to know whether it is possible to declare the Model statement
using filenames. For example, if I want to construct "DummyModel"
using equations from file1, file2 and file3, then is it possible to
write something like the following (or a similar approach):

Model DummyModel /file1, file2, file3/;

If you have suggestions similar to this, please let me know.

thanks,

Yogendra.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Model declaration using files?

Post by Archiver »



Yogendra,

You can declare a model in each of the separate files

In file 1: model submodel1 / all /;
In file 2: model submodel2 / all /;
etc.

and in the parent file combine the submodels wanted

model DummyModel / submodel1, submodel2, ... /;

Hope this helps!
Jan

Yogendra wrote:
> > Hi,
> >
> > I am working on a really big model with a number of equations in
> > multiple gams files. I use these equations to construct multiple
> > models. When it comes to model declaration, it becomes very tedious to
> > write each and every equations in the "Model" statement.
> >
> > I want to know whether it is possible to declare the Model statement
> > using filenames. For example, if I want to construct "DummyModel"
> > using equations from file1, file2 and file3, then is it possible to
> > write something like the following (or a similar approach):
> >
> > Model DummyModel /file1, file2, file3/;
> >
> > If you have suggestions similar to this, please let me know.
> >
> > thanks,
> >
> > Yogendra.
>> > >


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Model declaration using files?

Post by Archiver »


Thanks for the reply. It is partially successful!

It works only when the the declaration for the individual submodels is like:

in file1: model submodel1 /eqn1, eqn2,eqn2/;

If I declare the submodels as you have suggested, (i..e using Model submodel1 /all/), then there are compilation errors when I include more that one such submodels in my main mode. For the second submodel onwards it gives the following error:

"inserted model list items exists already"

My suspicion is that if I use /all/ to declare the submodels, it still includes all the equations and hence the error.

- Yogendra.



On Fri, Apr 24, 2009 at 11:14 AM, Jan-H. Jagla wrote:


Yogendra,

You can declare a model in each of the separate files

In file 1: model submodel1 / all /;
In file 2: model submodel2 / all /;
etc.

and in the parent file combine the submodels wanted

model DummyModel / submodel1, submodel2, ... /;

Hope this helps!
Jan

Yogendra wrote:
> Hi,
>
> I am working on a really big model with a number of equations in
> multiple gams files. I use these equations to construct multiple
> models. When it comes to model declaration, it becomes very tedious to
> write each and every equations in the "Model" statement.
>
> I want to know whether it is possible to declare the Model statement
> using filenames. For example, if I want to construct "DummyModel"
> using equations from file1, file2 and file3, then is it possible to
> write something like the following (or a similar approach):
>
> Model DummyModel /file1, file2, file3/;
>
> If you have suggestions similar to this, please let me know.
>
> thanks,
>
> Yogendra.
> >

--
Jan-H. Jagla mailto:jhjagla@gams.com
GAMS Development Corporation GAMS Software GmbH
1217 Potomac St. NW Eupener Str. 135-137
Washington DC, 20007, USA 50933 Cologne, Germany
Fon/Fax: +1 202 342-0180/1 Fon/Fax: +49 221 949-9170/1
http://www.gams.com http://www.gams.de




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Post Reply