简体   繁体   English

EXCEL:求解器约束

[英]EXCEL: Solver constraints

I would like to ask assistance on setting up the solver.我想寻求有关设置求解器的帮助。

Assuming I have 5 cells that must be allocated value that sum up to 1000. However, some of them can be zero if that will accommodate other constraints.假设我有 5 个单元格必须分配总和为 1000 的值。但是,如果可以容纳其他约束,其中一些单元格可以为零。 At this point I get some solver outputs that make 4 of the 5 zero, and allocates 1000 to the 1 cell.在这一点上,我得到一些求解器输出,使 5 个零中的 4 个为零,并将 1000 分配给 1 个单元格。

I would like to know how do I add another constraints that tells the solver that, say at least 3 of the 5 cannot be zero (any 5).我想知道如何添加另一个约束,告诉求解器,例如 5 个中的至少 3 个不能为零(任何 5)。

Your assistance would be appreciated.您的帮助将不胜感激。 Thanks谢谢

Add the constraints such as the sum of these 3 cells has to be greater than x or each of these cells has to be greater or equal to y.添加约束,例如这 3 个单元格的总和必须大于 x,或者这些单元格中的每一个都必须大于或等于 y。

So, if cells b1 to b5 have the results you are looking for then in cells c1 to c5 can be set to 10, 20, 30 or whatever and then in the solver you have:因此,如果单元格 b1 到 b5 具有您正在寻找的结果,那么在单元格 c1 到 c5 中可以设置为 10、20、30 或其他值,然后在求解器中您有:

$B$1:$B$5 >= $C$1:$C$5

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

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