[英]Reproducing Excel Solver GRG Nonlinear Optimization in Visual Basic .NET
I am trying to re-produce the following Excel Solver GRG Nonlinear optimization using the Microsoft Solver Foundation in VB.NET (numbers are simplified for the sake of this example): 我正在尝试使用VB.NET中的Microsoft Solver Foundation重现以下Excel Solver GRG非线性优化(为简化示例,数字被简化):
This optimization is subject to the following relationships: 此优化取决于以下关系:
Is it possible to solve such a problem using Solver Foundation? 使用Solver Foundation是否可以解决这样的问题? When trying to implement this, the two things I struggled with are: 尝试实现此目标时,我遇到的两件事是:
model.AddGoal("total_gas_rate", GoalKind.[not sure what goes here], Well1PGasRate + Well2PGasRate
), but how do I define the other one? 我认为后者将被定义为目标定义的一部分(例如, model.AddGoal("total_gas_rate", GoalKind.[not sure what goes here], Well1PGasRate + Well2PGasRate
),但是我如何定义另一个? Thanks! 谢谢!
This answer only addresses part 1 of your question and in a conceptual manner, but hopefully it is helpful. 该答案仅以概念性的方式解决了您问题的第1部分,但希望对您有所帮助。 If you're trying to optimize for a specific value target
and the output of your function is output
then you could try something like this pseudocode: 如果您要针对特定的值target
进行优化,并且输出了函数的output
则可以尝试使用以下伪代码:
minimize(absolute_value(output/target-1))
Effectively, this will give you a value that reaches zero as the output of your function nears the target value. 实际上,当函数的输出接近目标值时,这将使您的值达到零。 So you can still use an optimization engine that minimizes the final output of your function. 因此,您仍然可以使用优化引擎来最大程度地减少函数的最终输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.