Skip to main content
Solved

Create library for combining multiple math programs?

  • Mar 6, 2025 6:57 PM UTC
  • 1 reply
  • 66 views

I have multiple math programs, each related to a different energy supply sector.. I want to keep their development and version control independent. Is making them into libraries a reasonable way to combine these otherwise independent math programs?

 

Best answer by Chris Kuip

Hi Michael,

Yes that is a good way to combine multiple modeling applications.

Besides taking care of version control per library, 
you need to make a choice for your mathematical program(s):
* Do you want to combine all your variables and constraints into one mathematical program, or 
* do you want to keep a separate mathematical program per library?

When you want to combine them to one large mathematical program, you can declare a mathematical program in you main model,and
then use AllConstraints and AllVariables which include also the variables and constraints in your libraries.

When you want to keep a mathematical program per library, you can select the variables and constraints in that lbrary easily.
Say you have a library myLib, then you can declare a 
set myLibVariables, 
as a subset of AllVariables, and 
having definition AllVariables * myLib.
Another example of this mechanism is presented at https://how-to.aimms.com/Articles/175/175-select-variables-and-constraints-for-math-program.html#selecting-constraints-or-variables

Going one step further, by using these subsets of AllVariables and AllConstraints, you can freely combine portions of your libraries.

Hope this helps,

Chris.

View original

1 reply

Chris Kuip
AIMMSian
Forum|alt.badge.img+7
  • AIMMSian
  • Answer
  • Mar 7, 2025 8:01 PM UTC

Hi Michael,

Yes that is a good way to combine multiple modeling applications.

Besides taking care of version control per library, 
you need to make a choice for your mathematical program(s):
* Do you want to combine all your variables and constraints into one mathematical program, or 
* do you want to keep a separate mathematical program per library?

When you want to combine them to one large mathematical program, you can declare a mathematical program in you main model,and
then use AllConstraints and AllVariables which include also the variables and constraints in your libraries.

When you want to keep a mathematical program per library, you can select the variables and constraints in that lbrary easily.
Say you have a library myLib, then you can declare a 
set myLibVariables, 
as a subset of AllVariables, and 
having definition AllVariables * myLib.
Another example of this mechanism is presented at https://how-to.aimms.com/Articles/175/175-select-variables-and-constraints-for-math-program.html#selecting-constraints-or-variables

Going one step further, by using these subsets of AllVariables and AllConstraints, you can freely combine portions of your libraries.

Hope this helps,

Chris.