Hello All-
I'm hoping you can help me get to the bottom of a solver issue. I have a simple workbook that I created several years ago. After a few recent modifications, it no longer works. I get the "solver encountered an error in the objective cell or a constraint cell" error and cannot find the cause.
It will solve if I change it to "nonlinear" but the solution isn't optimized.
I'm looking for it to return the least cost option given a variety of feedstuffs and their nutrient analysis.
Here's the code:
Where lines 35, 36, 37 are the max, min, and calculated pounds of each component in each "batch". And H41 through I70 are the nutritional parameters.
THANK YOU in advance.
I'm hoping you can help me get to the bottom of a solver issue. I have a simple workbook that I created several years ago. After a few recent modifications, it no longer works. I get the "solver encountered an error in the objective cell or a constraint cell" error and cannot find the cause.
It will solve if I change it to "nonlinear" but the solution isn't optimized.
I'm looking for it to return the least cost option given a variety of feedstuffs and their nutrient analysis.
Here's the code:
Code:
Private Sub Solve_Click()
SolverReset
SolverOk SetCell:="$L$33", MaxMinVal:=2, ValueOf:=0, ByChange:="$C$37:$K$37", _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:="$C$37:K37", Relation:=1, FormulaText:="$C$35:k35"
SolverAdd CellRef:="$C$37:k37", Relation:=3, FormulaText:="$C$36:k36"
SolverAdd CellRef:="$C$36:$K$36", Relation:=3, FormulaText:=".001"
SolverAdd CellRef:="$L$4:L32", Relation:=1, FormulaText:="$I$42:I70"
SolverAdd CellRef:="$L$4:L32", Relation:=3, FormulaText:="$H$42:H70"
SolverAdd CellRef:="$L$37", Relation:=2, FormulaText:="$I$71"
SolverSolve
End Sub
Where lines 35, 36, 37 are the max, min, and calculated pounds of each component in each "batch". And H41 through I70 are the nutritional parameters.
THANK YOU in advance.