Hello,
I'm new to vensim so I'd appreciate any help I can get with this model I'm trying to construct. Basically I'm are trying to optimize the allocation of a resource across factories so that transportation costs and minimized and production is accomplished in the most cost efficient way. Here's a sketch of the model:
Resource (one resource, but 3 places to get it from)
(Min and max associated with each source)
These get transported to 6 different factories, each with it's own min and max capacity for resource production.
There are different transportation costs to go from one source to one specific factory, so there's a total of 18 different transportation costs.
Once produced, all products sell for one price.
I want a way to model this without drawing a ton of boxes and arrows. What's the best approach here? Is there are tutorial that might be of assistance? Really appreciate any help at all.
Thanks!
Multiple variable inputs in an optimization model
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Multiple variable inputs in an optimization model
You could start with the stock example in the Vensim help system,
http://www.vensim.com/documentation/ind ... ?21330.htm
Build that, then subscript by factory.
http://www.vensim.com/documentation/ind ... ?21330.htm
Build that, then subscript by factory.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Multiple variable inputs in an optimization model
Also, check the help system on the allocation functions, like ALLOCATE AVAILABLE.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Multiple variable inputs in an optimization model
Thank you both for your replies! I was able to create the model using subscripts for both the Source of a resource (3 different sources) and the Factory each goes to (6 different factories). I basically entered 18 different production figures and then 18 different per unit transportation costs. One question:
1) For an optimization, how would i go about constraining for a specific subscript? Example, if i want to put a limit on the total number of units one of the factories could make, how would i go about doing that? Right now all i can do is constrain each factory/source combination and not a whole subscript.
I've attached a screenshot of my model and the actual model itself. Apologies for the lenghty post and appreciate your help!
1) For an optimization, how would i go about constraining for a specific subscript? Example, if i want to put a limit on the total number of units one of the factories could make, how would i go about doing that? Right now all i can do is constrain each factory/source combination and not a whole subscript.
I've attached a screenshot of my model and the actual model itself. Apologies for the lenghty post and appreciate your help!
- Attachments
-
- model.JPG (72.55 KiB) Viewed 3402 times
-
- MauroModel3.mdl
- (3.79 KiB) Downloaded 189 times
Re: Multiple variable inputs in an optimization model
You could SUM() the factory's production in the model, and calculate a penalty for exceeding capacity. Then subtract the penalty from your payoff (i.e. include it with a weight of -1).
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Multiple variable inputs in an optimization model
Are there any other ways to go about applying a constraint? My concern is that the model is going to get significantly more complicated with the addition of things like multiple sources for different resources, multiple lines of production in each factory, multiple products made from each.
The solution would absolutely work if I was only applying one constraint but there are going to be many max and mins and I'm wondering if there isn't another way to set those parameters (either in the optimization engine or in the model itself).
The solution would absolutely work if I was only applying one constraint but there are going to be many max and mins and I'm wondering if there isn't another way to set those parameters (either in the optimization engine or in the model itself).
Re: Multiple variable inputs in an optimization model
There are various simplifications for special cases, like a commodity product with identical transportation costs (the ALLOC functions can handle that). In some cases you can also solve something to equilibrium using FIND ZERO and appropriate shadow prices, but it's not simple if you have to map a multidimensional set of choices to the single dimension iterated by FIND ZERO. So, it's not obvious how to do better than penalty functions.
This starts to sound like a linear programming problem, which is not Vensim's target space. You could potentially use LP_Solve though: http://vensim.com/workbench/ The setup would be nontrivial.
This starts to sound like a linear programming problem, which is not Vensim's target space. You could potentially use LP_Solve though: http://vensim.com/workbench/ The setup would be nontrivial.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/