之后解算器重置
我想关闭vba解算器中的"使无约束变量为非负"选项。
关闭"使解算器中的无约束变量为非负"的命令是什么?
我试着录制一个宏来找出答案,但我得到的只是
Sub Macro2()
'
' Macro2 Macro
'
'
SolverOk SetCell:="$D$26", MaxMinVal:=2, ValueOf:=0, ByChange:="$B$9:$B$12", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$D$26", MaxMinVal:=2, ValueOf:=0, ByChange:="$B$9:$B$12", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve
End Sub
您要做的是添加:
SolverOptions Assumenonneg:=False
所有解算器选项的完整详细信息可以在MSDN上找到。
录制"SOLVER"宏时,打开SOLVER窗口中的选项选项卡,然后关闭。单击"解决",然后"停止录制"。这将提供如下所示的"SLOVER选项"。您需要的选项是根据要求的AssuumeNonNeg:=False(或True(
SolverOptions MaxTime:=0, Iterations:=0, Precision:=0.000001, Convergence:= _
0.0001, StepThru:=False, Scaling:=True, AssumeNonNeg:=False, Derivatives:=1
SolverOptions PopulationSize:=100, RandomSeed:=0, MutationRate:=0.075, Multistart _
:=False, RequireBounds:=True, MaxSubproblems:=0, MaxIntegerSols:=0, _
IntTolerance:=1, SolveWithout:=False, MaxTimeNoImp:=30