I'm running VBA scripts under both Excel 2007 and 2010 which involve a lot of optimization using the built-in Solver of Excel.
我在Excel 2007和2010下运行VBA脚本,其中涉及使用内置的Excel解算器进行大量优化。
What is the correct way to specify decimal constraints like X>=0.0001 where X would be the decision variable of the problem.
指定十进制约束的正确方法是什么,例如X> = 0.0001,其中X将是问题的决策变量。
SolverAdd CellRef:=cells(5,5), Relation:=3, FormulaText:="0.0001"
Or do I have to remove the quotes " " ? And does the VBA interface of Solver allow for decimal (non-integer) constraints anyway?
或者我是否必须删除引号“”?并且Solver的VBA接口是否允许十进制(非整数)约束?
I'm asking, because sometimes I get the (unconfirmed) feeling that a constraint of >=0.0001 is incorrectly interpreted as >=1, which of course renders wrong results.
我问,因为有时我得到(未经证实)的感觉,> = 0.0001的约束被错误地解释为> = 1,这当然会导致错误的结果。
It would be great if somebody could clarify these issues for me.
如果有人能为我澄清这些问题,那就太好了。
Steve
1 个解决方案
#1
0
We've found that FormulaText
can really effect the final solution. We've always just used straight numbers there, no quotes:
我们发现FormulaText可以真正影响最终的解决方案。我们总是在那里使用直号,没有引号:
SolverAdd CellRef:=cells(5,5), Relation:=3, FormulaText:=0.0001
#1
0
We've found that FormulaText
can really effect the final solution. We've always just used straight numbers there, no quotes:
我们发现FormulaText可以真正影响最终的解决方案。我们总是在那里使用直号,没有引号:
SolverAdd CellRef:=cells(5,5), Relation:=3, FormulaText:=0.0001