PDA

View Full Version : How to set Iteration Times in Solver with macro



Jean
07-07-2007, 11:32 PM
Need help!:(

I have used the statement below to solve my LP problem, but the iteration times always reach the max, I can manually change the maximum times in "Excel-->Tools-->Solver-->Options--> change iteration times to 32767, "then the problem is solved, but using macro, I don't know how to set this parameter.




SolverReset
SolverOk Setcell:=Range("Target"), Maxminval:=2, Bychange:=Range("ChangingCell")
SolverAdd CellRef:=Range("Supply2"), Relation:=2, FormulaText:="Supply1"
SolverAdd CellRef:=Range("Demand2"), Relation:=2, FormulaText:="Demand1"
SolverOptions AssumeLinear:=True, AssumeNonneg:=True
SolverSolve UserFinish:=True

TheAntiGates
07-08-2007, 01:29 PM
Is this what you want?
application.MaxIterations=32767

Jean
07-08-2007, 06:10 PM
I have found the way

SolverOptions Iterations:=32767

I will try "application.MaxIterations=32767 "