Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your advise.
I replace my code but it still have same problem. I found some information from the web and would like to discuss. Below FAQ is similar to my problem, I can see fractional values after solver run, will the program occur error casued by the fractional values? If possible, I would like to share my template to you. ================================================ Q. I specified that certain variables in my model have to be integers. But when the Solver runs, I see fractional values in the variable cells. Is there something wrong? A. This is normal. The Solver uses the Branch & Bound method to deal with integer variables. This means that during the optimization, the Solver will indeed use fractional values, but when the optimal solution is found, all integer variables should have integer values. ================================================== "Dana DeLouis" wrote: Hi. This is not necessary, but only a technique. There are better ways, but sse if any techniques here are helpful. This is just a simple demo. Sub Demo() Dim Result With ActiveWorkbook.Names .Add "Target", [A8] .Add "Chg", [A1:A5] .Add "UpperLimit", [B1:B5] End With SolverReset SolverAdd [Chg], 3, 0 SolverAdd [Chg], 1, [UpperLimit] SolverAdd [Chg], 4, "integer" SolverOk [Target], 1, , [Chg] Result = SolverSolve(True) End Sub The idea is that when one has CellRef:=Range(Cells(8, 12), Cells(8, Icol)) listed throughout the code, it increases the odds of one of them having a typo It makes it hard to spot errors. Anyway, hope this helps. Dana DeLouis |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SolverSolve function exits abnormally | Excel Programming | |||
SolverSolve return values | Excel Programming | |||
SOLVER solversolve showref | Excel Programming | |||
Solver: 2nd function of SolverSolve | Excel Programming | |||
How does Solversolve Control Macro | Excel Programming |