Page 1 of 1
LP_solve
Posted: Wed Mar 23, 2022 8:05 pm
by RobbieOrvis
Hello,
I came across documentation on the ability to use LP_solve in Vensim and am interested in exploring this capability. However, I am getting errors that Vensim cannot open MultiExtLib.dll nor the VenextLP.dll.
Does Vensim still support the use of these plugins? It looks old (~2013) so perhaps it just hasn't been updated for use on the newest versions.
Re: LP_solve
Posted: Thu Mar 24, 2022 3:58 pm
by tomfid
Right - it hasn't been updated. It would probably work with an older version, 6 or 7.
Is there a particular problem you're looking to solve? LP_SOLVE is a pain to incorporate because it's under the LGPL license, but we've been thinking of adding some LP-based functions for some time.
Re: LP_solve
Posted: Tue Apr 26, 2022 6:16 pm
by RobbieOrvis
Thanks Tom, we are making forays into more detailed electricity capacity expansion modeling to integrate with the EPS. Dedicated capacity expansion models use linear programming to solve for deployment since the goal is to minimize a cost function with many different options. Happy to share more detail on how some other models approach this.
We recognize that Vensim isn't necessarily designed to be a LP solver, but if the functionality were there, we'd definitely explore using it for this.
Re: LP_solve
Posted: Tue May 03, 2022 2:28 am
by tomfid
In that case I know exactly what you're after.
Re: LP_solve
Posted: Fri May 13, 2022 2:47 pm
by tomfid
I should add that there's another way to solve the problem: FIND ZERO. The computational load may be heavier because it can handle nonlinear effects, which may not be needed.
The basic idea is to compute a node price that clears the market between supply and demand simultaneously. Then demand = f(devices,price) and supply = g(capacity,price). f() is probably something like referenceDemand*(price/referencePrice)^elasticity, and g() could be something like a logistic curve, such that a plant's utilization = 50% when price = their operating cost.
To handle capacity shortfalls, you can add an "unserved energy" source that kicks in at a high threshold.
This can also be extended to include multiple nodes with transmission.
Re: LP_solve
Posted: Thu Jan 05, 2023 8:34 pm
by RobbieOrvis
An extremely belated reply here, but do you have any examples of the FIND ZERO application used in the way you mentioned? I've got the example .mdl file downloaded and am looking at that, but thought I would check.
I think perhaps the example above is for electricity generation, which we actually have handled alright as is. The main issue is with building new capacity where demand is predetermined elsewhere in the model.
Re: LP_solve
Posted: Mon Jan 09, 2023 8:19 pm
by tomfid
Here's an example that's not quite what you need, but hopefully easily adaptable. This was built to explore a bug in FIND MARKET PRICE in a narrow use case (excess demand, CES type 5 curves), but the second view illustrates how to do allocation with FIND ZERO. I'll see if I have a better example.
Re: LP_solve
Posted: Mon Jan 09, 2023 10:00 pm
by tomfid
Here's an example that's probably closer to what's needed:
Re: LP_solve
Posted: Tue Jan 10, 2023 3:30 pm
by RobbieOrvis
Thanks for this. Will have a look!
By the way, Jeff and I are working on an 8760 dispatch model within an annual timestep model within the EPS that you might find interesting and we hope to have soon. We mapped hours onto a subscript and the model solves using ALLOCATE AVAILABLE for each hour. We backed out the hourly marginal price by identifying the Z-scores and using the mean and standard deviation fed into the allocation. From there, we have hourly dispatch and hourly market prices. Happy to share when it's done (and it will be included in our next EPS release).
Re: LP_solve
Posted: Mon Feb 13, 2023 4:40 pm
by RobbieOrvis
I've been playing around with this a bit, starting from the FIND ZERO example and trying to build something for electricity capacity. However, this has proven to be very tough. I tried developing a formula that would get closer to zero with a growing difference in future system costs with additions that lower the cost, subject to some constraints, but I think the nonlinearity of the penalties and the structure of FIND ZERO don't really lend it well to calculating this correctly. I definitely got some odd behavior too, probably because I wasn't quite using FIND ZERO as it was intended.
I'm not sure there are plans to do it, but a variation of this function but FIND MIN would basically be exactly what's needed, where the formula could iteratively test and narrow to a solution that reduces to a tolerance level.
Re: LP_solve
Posted: Mon Feb 13, 2023 8:09 pm
by tomfid
I'd be interested to see any of your nonworking experiments.
FIND MIN would be very much in the spirit of a linear programming approach. It would probably be easy to repurpose the Powell optimizer for this, though I'm not sure what performance would be like. I'll look into it.
Re: LP_solve
Posted: Mon Feb 03, 2025 7:49 pm
by RobbieOrvis
Hi there,
I thought I'd circle back on this to see if you ever looked into it? A FIND MIN function would still be extremely helpful.
Re: LP_solve
Posted: Thu Feb 06, 2025 3:55 pm
by tomfid
I haven't had a chance to work on this. One question: do you have batteries and pumped hydro? I've done the hourly array trick, but intertemporal features screw things up. Something more sophisticated might be needed.
Re: LP_solve
Posted: Thu Feb 06, 2025 4:32 pm
by RobbieOrvis
We do have batteries and pumped hydro, but they are not part of this solution, we handle them separately because of intertemporal issues, as you suggest. We use the prior year outputs on market revenue to allocate when they are charged (batteries) and discharged (both), and modify the load (both) instead of using them as dispatch resources.
This would primarily be use for generation resources to identify the lowest cost mix to meet system requirements.