求解器和 "Show Trial Solution" window
Solver and "Show Trial Solution" window
我是运行下面的求解器宏:
Sub Merton()
'
' Merton Macro
Dim i As Long
For i = 7 To 56
SolverReset
SolverOk SetCell:="$K", MaxMinVal:=1, ValueOf:=0, ByChange:="$I:$J", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$G$" & i, Relation:=2, FormulaText:="$H$" & i
SolverAdd CellRef:="$K$" & i, Relation:=2, FormulaText:="$B$" & i
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
Next i
End Sub
我不断弹出 "Show Trial Solution" 因为规划求解暂停。然后我必须按下 "Continue" 按钮让求解器继续。有什么方法可以在宏中插入一条命令,告诉规划求解不要显示 "Show Trial Solution" window?
听起来您选择了 Show Iteration Results
选项。在 运行 您的代码之前手动取消选择它可能就足够了。或者,在代码的顶部放置行
SolverOptions StepThru:=False
它应该取消选择该选项。
如果这不能解决问题,那么 solver.com 的文档说:
The Show Trial Solution dialog box also appears (only once, not on each
Trial Solution) if you press ESC, or if Solver reaches one of
the Solving Limits (Max Time, Iterations, Max Subproblems or Max
Feasible Solutions) while solving a problem
也许您超出了限制,需要增加您 运行 的限制。
.
我是运行下面的求解器宏:
Sub Merton()
'
' Merton Macro
Dim i As Long
For i = 7 To 56
SolverReset
SolverOk SetCell:="$K", MaxMinVal:=1, ValueOf:=0, ByChange:="$I:$J", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$G$" & i, Relation:=2, FormulaText:="$H$" & i
SolverAdd CellRef:="$K$" & i, Relation:=2, FormulaText:="$B$" & i
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
Next i
End Sub
我不断弹出 "Show Trial Solution" 因为规划求解暂停。然后我必须按下 "Continue" 按钮让求解器继续。有什么方法可以在宏中插入一条命令,告诉规划求解不要显示 "Show Trial Solution" window?
听起来您选择了 Show Iteration Results
选项。在 运行 您的代码之前手动取消选择它可能就足够了。或者,在代码的顶部放置行
SolverOptions StepThru:=False
它应该取消选择该选项。
如果这不能解决问题,那么 solver.com 的文档说:
The Show Trial Solution dialog box also appears (only once, not on each Trial Solution) if you press ESC, or if Solver reaches one of the Solving Limits (Max Time, Iterations, Max Subproblems or Max Feasible Solutions) while solving a problem
也许您超出了限制,需要增加您 运行 的限制。
.