Linear Program
Linear Program
Tom (et al),
Any thoughts lately about incorporating a linear program for optimizing allocations? Last I was grappling with this, the only option was the market clearing algorithms (built-in) or trying to trade data with Excel and using their LP.
Cheers,
Lou
Any thoughts lately about incorporating a linear program for optimizing allocations? Last I was grappling with this, the only option was the market clearing algorithms (built-in) or trying to trade data with Excel and using their LP.
Cheers,
Lou
Re: Linear Program
It's available now as an external function. Take a look, then we can talk ... http://vensim.com/workbench/
/*
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: Linear Program
Tom,
Awesome!! I actually did a search way back when and saw that solver too.
I'll explore and let you know if I have any issues implementing.
Cheers,
Lou
Awesome!! I actually did a search way back when and saw that solver too.
I'll explore and let you know if I have any issues implementing.
Cheers,
Lou
Re: Linear Program
Tom,
I'm having some issues getting this running. I put the venextLP and venextLP_dp in the “C:\Users\SAO\Vensim\plugins” folder as shown. I put the lpsolve55.dll in the “C:\lp_solve” folder (and added it to my system path). I even put the dlls in the “C:\Users\SAO\Vensim\dll” and “C:\Windows\System32” paths, just in case. Here are my issues:
1) I’m using the DP version, so I point to the venextLP_dp file in the Tools>Options>Startup>External Function Library, but I get the “Expected 51051…” error. When I point to venextLP instead, I get the opposite error and something about (-2)? I even tried this with the MultiExtLib files (instead of VenextLP)…same problem.
2) The sample model opens as text and won’t convert to a drawing since it sees the LP_SOLVE and LP_ALLOC function as syntax errors.
Any ideas?
Thanks and have a great Mem Day weekend,
Lou
I'm having some issues getting this running. I put the venextLP and venextLP_dp in the “C:\Users\SAO\Vensim\plugins” folder as shown. I put the lpsolve55.dll in the “C:\lp_solve” folder (and added it to my system path). I even put the dlls in the “C:\Users\SAO\Vensim\dll” and “C:\Windows\System32” paths, just in case. Here are my issues:
1) I’m using the DP version, so I point to the venextLP_dp file in the Tools>Options>Startup>External Function Library, but I get the “Expected 51051…” error. When I point to venextLP instead, I get the opposite error and something about (-2)? I even tried this with the MultiExtLib files (instead of VenextLP)…same problem.
2) The sample model opens as text and won’t convert to a drawing since it sees the LP_SOLVE and LP_ALLOC function as syntax errors.
Any ideas?
Thanks and have a great Mem Day weekend,
Lou
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Linear Program
Delete these from here, they might confuse things.I even put the dlls in the “C:\Users\SAO\Vensim\dll” and “C:\Windows\System32” paths, just in case.
What version of Vensim are you using (Help->About Vensim). These DLLs are compiled to work with the latest (6.0 upwards).1) I’m using the DP version, so I point to the venextLP_dp file in the Tools>Options>Startup>External Function Library, but I get the “Expected 51051…” error.
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: Linear Program
I deleted the files out of the other locations.
I'm running Version 6.0b. Maintenance ran out so I can't download 6.1 (yet).
I'm running Version 6.0b. Maintenance ran out so I can't download 6.1 (yet).
Re: Linear Program
BTW, I should have mentioned, I have a 64-bit OS...don't know if that makes a difference.
Re: Linear Program
Problem solved!!!
When I replaced the 64-bit version of lpsolve55.dll with the 32-bit version (in the C:\lp_solve folder), it worked!
You may want to mention this in the setup instructions on the Workbench page.
Thanks,
Lou
When I replaced the 64-bit version of lpsolve55.dll with the 32-bit version (in the C:\lp_solve folder), it worked!
You may want to mention this in the setup instructions on the Workbench page.
Thanks,
Lou
Re: Linear Program
Great! I didn't think of that.
Let me know if you have specific thoughts about desired functionality.
Let me know if you have specific thoughts about desired functionality.
/*
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
*/
-
- Junior Member
- Posts: 11
- Joined: Fri Aug 26, 2016 9:49 pm
- Vensim version: DSS
Re: Linear Program
The LP solver is great. However, I would prefer to use the double precision version if possible, and I had problems with it. First, Norton didn't like it -- it flagged it as a potential virus using heuristics, and I had to stop Norton from scanning venextLP_dp.dll before I could continue. Then when I did try to run it, using Vensim DSS for Windows Version 6.4a Double Precision (x32), I go the error "Failed to set global variables in external function library" (in a file where I hadn't yet put in any LP functions). I have no problem with the single-precision library.
Re: Linear Program
I think the external lib may need to be complied with the flag DPMATH so that it's variable types are compatible with DP Vensim. I don't recall the details, but I'm hoping Tony does.
/*
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
*/
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Linear Program
Do the LP functions still work as this should just be a warning rather than an error?"Failed to set global variables in external function library"
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
-
- Junior Member
- Posts: 11
- Joined: Fri Aug 26, 2016 9:49 pm
- Vensim version: DSS
Re: Linear Program
I don't think so. I tried a test where I started putting in the function and then checked the expression, and got 'Do you want to add "LP SOLVE" to the model'. My understanding is that the name should have been loaded already and Vensim should recognize it. Is that right?
@tomfid: Thanks very much. I can compile it if need be, but right now I'm using the pre-compiled binaries for Windows. I've programmed Vensim extensions before, but it's been awhile and on a different machine. I'd need to pull the relevant libraries together, so I'm hoping to be able to use the pre-compiled versions.
Thanks,
Eric
@tomfid: Thanks very much. I can compile it if need be, but right now I'm using the pre-compiled binaries for Windows. I've programmed Vensim extensions before, but it's been awhile and on a different machine. I'd need to pull the relevant libraries together, so I'm hoping to be able to use the pre-compiled versions.
Thanks,
Eric
-
- Junior Member
- Posts: 11
- Joined: Fri Aug 26, 2016 9:49 pm
- Vensim version: DSS
Re: Linear Program
To be clear, I don't actually need double precision on my current project -- I just want to have the option in case I do need it as the model evolves. Also, I wanted to raise the issue I had in case someone else ran into the same problem. But the single-precision version is working great, and I'm moving right along.
Thanks,
Eric
Thanks,
Eric
Re: Linear Program
Cool.
When I first wrote the code, I had at least two ambitions that remain unrealized:
- use the LP infrastructure to create some custom allocation functions. For example, the LP makes it easy to solve the many-to-many noncommodity allocation problem, with unique costs (e.g. shipping) for each supplier x demander combination.
- persist the LP definition, for greater speed.
If you have any feedback as you progress, I'd appreciate hearing it.
When I first wrote the code, I had at least two ambitions that remain unrealized:
- use the LP infrastructure to create some custom allocation functions. For example, the LP makes it easy to solve the many-to-many noncommodity allocation problem, with unique costs (e.g. shipping) for each supplier x demander combination.
- persist the LP definition, for greater speed.
If you have any feedback as you progress, I'd appreciate hearing it.
/*
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
*/