简体   繁体   English

Excel求解器说明

[英]Excel Solver explanation

I am using the excel solver to maximize a likelihood function, depending on three parameters, places in cells (for example) A3, A4, A5.我正在使用 excel 求解器来最大化似然函数,这取决于三个参数,在单元格中的位置(例如)A3、A4、A5。 The constraints of the optimization are:优化的约束是:

  1. A3 >= 0 A3 >= 0
  2. A4 > 0 A4 > 0
  3. A5 > 0 A5 > 0
  4. A4 + A5 < 1 A4 + A5 < 1

To manage the fourth point, I create an auxiliary cell (say A6) containing the sum of A4 and A5.为了管理第四点,我创建了一个包含 A4 和 A5 总和的辅助单元格(比如 A6)。 Thus, the constraints passed to the solver function become:因此,传递给求解器函数的约束变为:

  1. A3 >= 0 A3 >= 0
  2. A4 > 0 A4 > 0
  3. A5 > 0 A5 > 0
  4. A6 < 1 A6 < 1

Despite this, sometimes I get an error because the solver tries to use values for A4 and A5 that add up to a number greater than 1. In other words, it seems that the condition A6 < 1 (A4 + A5 < 1) is not always considered during optimization.尽管如此,有时我会遇到错误,因为求解器尝试使用 A4 和 A5 的值加起来大于 1 的数字。换句话说,似乎条件 A6 < 1 (A4 + A5 < 1) 不是在优化过程中始终考虑。

Does anyone know how to deal with this problem?有谁知道如何处理这个问题?

Solver works by trial and error methods and tries to refine solutions based on what gets you closer to your target within the defined criteria.求解器通过反复试验的方法工作,并尝试根据使您在定义的标准内更接近目标的因素来优化解决方案。 For non-linear but still reasonably smooth problems, there may be solution "wells" where if you can get close to a solution, you can refine it to find a better solution.对于非线性但仍然相当平滑的问题,可能存在解决方案“井”,如果您可以接近解决方案,则可以对其进行改进以找到更好的解决方案。 But if the problem is not smooth, "near" solutions may not guide it towards valid solutions, or there may be such tiny solution wells that the solver just never manages to find a valid solution.但是,如果问题不顺利,“接近”解决方案可能无法将其引导至有效解决方案,或者可能存在如此微小的解决方案井,以至于求解器永远无法找到有效解决方案。 It may also just be possible that no solution exists.也有可能不存在解决方案。

The first step to try to solve the problem is to try the different solver methods, as different methods are better for different solution "surface" behaviors.尝试解决问题的第一步是尝试不同的求解器方法,因为不同的方法更适合不同的解决方案“表面”行为。

You can also try seeding the solver by placing at least one set of "reasonable" values in the cells being changed.您还可以通过在要更改的单元格中放置至少一组“合理”值来尝试为求解器设置种子。

As a simple example, setting B1 formula of "=A1^2" and then solving for the largest possible B1 by changing A1 with constraint of B1<=16 seems quite simple... it should be able to figure out A1 = 4 easily.举个简单的例子,设置 B1 公式“=A1^2”,然后通过改变 A1 的约束 B1<=16 来求解最大可能的 B1 看起来很简单......它应该能够轻松计算出 A1 = 4 . But it only works if A1 has a positive value.但它仅在 A1 具有正值时才有效。 Any negative value or starting from 0 gives the wrong answer of 0.任何负值或从 0 开始都会给出 0 的错误答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM