ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   solver.xla fails (https://www.excelbanter.com/excel-programming/307718-solver-xla-fails.html)

g.Lakshmi

solver.xla fails
 
I am having problem with solver.xla. It doesnot work for
this


Private Sub CmdCompute_Click()
' ---------------------------------------------------------
-----------------------
' Author : S. Shashidhar
' Date : 28/03/2003
' Purpose : To be tested in Office SP3.
' ---------------------------------------------------------
-----------------------
Const bytGreateThanEqualTo = 3
Const bytLesserThanEqualTo = 1
Const OptimizeToMax = 1

SolverReset

SolverOk SetCell:=Range("C6"), MaxMinVal:=OptimizeToMax,
ByChange:=Range("D5:E5")

SolverAdd CellRef:=Range("F7"),
Relation:=bytLesserThanEqualTo, FormulaText:=4
SolverAdd CellRef:=Range("F8"),
Relation:=bytLesserThanEqualTo, FormulaText:=1
SolverAdd CellRef:=Range("D5"),
Relation:=bytGreateThanEqualTo, FormulaText:=0
SolverAdd CellRef:=Range("E5"),
Relation:=bytGreateThanEqualTo, FormulaText:=0


SolverOptions MaxTime:=100, Iterations:=100,
precision:=0.000001, _
assumeLinear:=False,
StepThru:=False, _
estimates:=2, derivatives:=1,
SearchOption:=1, _
intTolerance:=0.05,
scaling:=False, convergence:=0.001

SolverSolve UserFinish:=False

SolverFinish KeepFinal:=1
End Sub


where the following is the details entered in the
corresponding cells.


Z X1 X2 RHS

0 4

Objective Function 4 1 3

Constraint 1 2 1 4

Constraint 2 1 -2 -8

Kindly help in solving this issue.


Jerry W. Lewis

solver.xla fails
 
What are "the corresponding cells" What is the unspecified function
that you are trying to maximize (presumably a function of variables
z,x1, and x2)

Jerry

g.Lakshmi wrote:

I am having problem with solver.xla. It doesnot work for
this


Private Sub CmdCompute_Click()
' ---------------------------------------------------------
-----------------------
' Author : S. Shashidhar
' Date : 28/03/2003
' Purpose : To be tested in Office SP3.
' ---------------------------------------------------------
-----------------------
Const bytGreateThanEqualTo = 3
Const bytLesserThanEqualTo = 1
Const OptimizeToMax = 1

SolverReset

SolverOk SetCell:=Range("C6"), MaxMinVal:=OptimizeToMax,
ByChange:=Range("D5:E5")

SolverAdd CellRef:=Range("F7"),
Relation:=bytLesserThanEqualTo, FormulaText:=4
SolverAdd CellRef:=Range("F8"),
Relation:=bytLesserThanEqualTo, FormulaText:=1
SolverAdd CellRef:=Range("D5"),
Relation:=bytGreateThanEqualTo, FormulaText:=0
SolverAdd CellRef:=Range("E5"),
Relation:=bytGreateThanEqualTo, FormulaText:=0


SolverOptions MaxTime:=100, Iterations:=100,
precision:=0.000001, _
assumeLinear:=False,
StepThru:=False, _
estimates:=2, derivatives:=1,
SearchOption:=1, _
intTolerance:=0.05,
scaling:=False, convergence:=0.001

SolverSolve UserFinish:=False

SolverFinish KeepFinal:=1
End Sub


where the following is the details entered in the
corresponding cells.


Z X1 X2 RHS

0 4

Objective Function 4 1 3

Constraint 1 2 1 4

Constraint 2 1 -2 -8

Kindly help in solving this issue.





All times are GMT +1. The time now is 05:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com