How to implement Excel Solver functionality in C#? [duplicate]
I have an application in C#, I need to do some optimization calculations, like Excel Solver Add-in does, one option is certainly to write my own solver implementation, but I'm kind of short of time, so I'm looking into libraries that already exist that can help me with this.
I've been trying the Microsoft Solver Foundation, which seems pretty neat and cool, the problem is that it doesn't seem to work with the kind of calculations that I need to do.
At the end of this question I'm adding the information about the calculations I need to perform and optimize.
So basically my question is if any of you know of any other library that I can use for this purpose, or any tutorial that can help to do my own solver, or any idea that gives me a lead to solve this issue.
Thanks.
Additional Info:
This is the data I need to calculate:
I have 7 variables, lets call them var1, var2,...,var7
The constraints for these variables are:
- All of them need to be 0 <= varn <= 0.5 (where n is the number of the variable)
- The sum of all the variables should be equal to 1
The objective is to maximize the target formula, which in Excel looks like this:
(MMULT(TRANSPOSE(L26:L32),M14:M20)) / (SQRT(MMULT(MMULT(TRANSPOSE(L26:L32),M4:S10),L26:L32)))
The range that you see in this formula, L26:L32, is actually the range with the variables from above, var1, var2,..., varn.
M14:M20 and M4:S10 are ranges with data that I get from different sources, there are more likely decimal values.
As I said before, I was u开发者_开发知识库sing Microsoft Solver Foundation, I modeled pretty much everything with it, I created functions that handle the operations of the target formula, but when I tried to solve the model it always fail, I think it is because of the complexity of the operations.
In any case, I just wanted to show these data so you can have an idea about the kind of calculations that I need to implement.
Here are some commercial .NET libraries containing different kind of multivariate optimization functions which can be a replacement for Excel's solver:
- Extreme Optimization Numerical Libraries
- Centerspace NMath.Net library
- Visual Numerics library
If you find a good non-commercial / open source library for this purpose, let me know.
精彩评论