A
AAB
Hi
Looking for a little insight on a frustrating problem with Frontline
Solver and Excel. I am working on a project that needs to run thousands
of LP problems. I seem to have all the code working but occasionally a
LP model it is trying to solve runs into a maximum iterations reached
error, if I click continue it reaches the maximum time and if I again
click continue it runs indefinitely. The problems are set up using VBA.
The confusing issue is that if I set up the problem manually, given
the same model, it finds a solution just fine. I have tried switching
to the macro language by recording the exact steps I use to set it up
manually but the same problem happens. It only occurs once every
several hundred models or so with no distinguishing characteristics to
the models it has problems with apparent. After spending much time
looking for a reason for this I am beginning to think it is a solver bug.
I have attached both the VBA code and the macro code to see if anyone
might see something I don't. System info: Frontline Premium Solver
v3.5, Excel 2000, XP Pro.
Any thoughts on this is greatly appreciated.
Thanks in advance.
Alan
Sub LPApprox()
'Reset Solver
SolverReset
SolverAdd CellRef:="$T$1", relation:=2, FormulaText:="0"
SolverAdd CellRef:="$AC$7:$AC$21", relation:=1, FormulaText:="0"
SolverAdd CellRef:="$AD$7:$AF$21", relation:=3, FormulaText:="0"
SolverEVOptions AssumeNonneg:=True
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$7:$V$21,$T$3:$V$3", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End Sub
Sub LPApproxMacroLanguage()
SolverReset
SolverAdd CellRef:="$AC$7:$AC$21", relation:=1, FormulaText:="0"
SolverAdd CellRef:="$AD$7:$AF$21", relation:=3, FormulaText:="0"
SolverAdd CellRef:="$T$1", relation:=2, FormulaText:="0"
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$3:$V$3,$T$7:$V$21", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
SolverLPOptions MaxTime:=100, ITERATIONS:=1000,
Precision:=0.00000001, PivotTol _
:=0.000001, ReducedTol:=0.000001, StepThru:=False,
Scaling:=False, AssumeNonneg _
:=True, BypassReports:=False, Derivatives:=1
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$3:$V$3,$T$7:$V$21", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
code = SolverSolve(True)
If code <> 0 Then MsgBox ("LPApprox Return Code (Probable Error) =
" & code)
End Sub
Looking for a little insight on a frustrating problem with Frontline
Solver and Excel. I am working on a project that needs to run thousands
of LP problems. I seem to have all the code working but occasionally a
LP model it is trying to solve runs into a maximum iterations reached
error, if I click continue it reaches the maximum time and if I again
click continue it runs indefinitely. The problems are set up using VBA.
The confusing issue is that if I set up the problem manually, given
the same model, it finds a solution just fine. I have tried switching
to the macro language by recording the exact steps I use to set it up
manually but the same problem happens. It only occurs once every
several hundred models or so with no distinguishing characteristics to
the models it has problems with apparent. After spending much time
looking for a reason for this I am beginning to think it is a solver bug.
I have attached both the VBA code and the macro code to see if anyone
might see something I don't. System info: Frontline Premium Solver
v3.5, Excel 2000, XP Pro.
Any thoughts on this is greatly appreciated.
Thanks in advance.
Alan
Sub LPApprox()
'Reset Solver
SolverReset
SolverAdd CellRef:="$T$1", relation:=2, FormulaText:="0"
SolverAdd CellRef:="$AC$7:$AC$21", relation:=1, FormulaText:="0"
SolverAdd CellRef:="$AD$7:$AF$21", relation:=3, FormulaText:="0"
SolverEVOptions AssumeNonneg:=True
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$7:$V$21,$T$3:$V$3", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End Sub
Sub LPApproxMacroLanguage()
SolverReset
SolverAdd CellRef:="$AC$7:$AC$21", relation:=1, FormulaText:="0"
SolverAdd CellRef:="$AD$7:$AF$21", relation:=3, FormulaText:="0"
SolverAdd CellRef:="$T$1", relation:=2, FormulaText:="0"
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$3:$V$3,$T$7:$V$21", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
SolverLPOptions MaxTime:=100, ITERATIONS:=1000,
Precision:=0.00000001, PivotTol _
:=0.000001, ReducedTol:=0.000001, StepThru:=False,
Scaling:=False, AssumeNonneg _
:=True, BypassReports:=False, Derivatives:=1
SolverOk SetCell:="$AC$23", MaxMinVal:=1, ValueOf:=0, ByChange:= _
"$T$3:$V$3,$T$7:$V$21", Engine:=2, EngineDesc:="Standard
LP/Quadratic"
code = SolverSolve(True)
If code <> 0 Then MsgBox ("LPApprox Return Code (Probable Error) =
" & code)
End Sub