Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Another solver question

Ok, I answered my last question, but I have another one, so I'm going to post
a new thread, since it's not really related. I have the following.

AddIns("Solver Add-in").Installed = True
SolverReset
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverAdd CellRef:="$N$3:$N$7", Relation:=1, FormulaText:="$P$3:$P$7"
SolverAdd CellRef:="$N$8", Relation:=2, FormulaText:="$P$8"
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001,
AssumeLinear _
:=True, StepThru:=False, Estimates:=1, Derivatives:=1,
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001,
AssumeNonNeg:=True
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverSolve userfinish:=True

Now, I have a situation where I will have to run solver multiple times
against the same data set, but with changing target values. So my question
is, at what point in the macro does solver know that it either can or cannot
solve the problem? What I want to happen is write some code to name my
initial target values, then run solver, and if a solution is found, save the
entire problem, not just the solution row, then reset solver, reset the
target values, and start all over again. What I am missing is how to
determine when solver knows its ready to give me an answer. There is some
good help in the VBA help menu, but I can't seem to answer this question. In
a nut shell, the loop will be like this.

1) Set initial target values.
2) Run solver with above macro
3) If solution is found, save it, if no sulution, reset solver, set next set
of target values.
4) Do until all target values have been tried.

I need help with #3 above. Thank you.

Greg.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Another solver question

Ok, I found the answer shortly after I posted again. It was here...
http://peltiertech.com/Excel/SolverVBA.html#Solver1

Specifically with this line of code...

Result = Application.Run("Solver.xla!SolverSolve", True)

and this table of result descriptions...

0 Solver found a solution. All constraints and optimality conditions are
satisfied. 1 Solver has converged to the current solution. All constraints
are satisfied. 2 Solver cannot improve the current solution. All constraints
are satisfied. 3 Stop chosen when the maximum iteration limit was reached. 4
The Set Cell values do not converge. 5 Solver could not find a feasible
solution. 6 Solver stopped at user's request. 7 The conditions for Assume
Linear Model are not satisfied. 8 The problem is too large for Solver to
handle. 9 Solver encountered an error value in a target or constraint cell.
10 Stop chosen when maximum time limit was reached. 11 There is not enough
memory available to solve the problem. 12 Another Excel instance is using
SOLVER.DLL. Try again later. 13 Error in model. Please verify that all cells
and constraints are valid.

Read mo http://peltiertech.com/Excel/SolverV...#ixzz0RCeLRiDr






"Greg Snidow" wrote:

Ok, I answered my last question, but I have another one, so I'm going to post
a new thread, since it's not really related. I have the following.

AddIns("Solver Add-in").Installed = True
SolverReset
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverAdd CellRef:="$N$3:$N$7", Relation:=1, FormulaText:="$P$3:$P$7"
SolverAdd CellRef:="$N$8", Relation:=2, FormulaText:="$P$8"
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001,
AssumeLinear _
:=True, StepThru:=False, Estimates:=1, Derivatives:=1,
SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001,
AssumeNonNeg:=True
SolverOk SetCell:="$N$7", MaxMinVal:=2, ValueOf:="0",
ByChange:="$B$8:$M$8"
SolverSolve userfinish:=True

Now, I have a situation where I will have to run solver multiple times
against the same data set, but with changing target values. So my question
is, at what point in the macro does solver know that it either can or cannot
solve the problem? What I want to happen is write some code to name my
initial target values, then run solver, and if a solution is found, save the
entire problem, not just the solution row, then reset solver, reset the
target values, and start all over again. What I am missing is how to
determine when solver knows its ready to give me an answer. There is some
good help in the VBA help menu, but I can't seem to answer this question. In
a nut shell, the loop will be like this.

1) Set initial target values.
2) Run solver with above macro
3) If solution is found, save it, if no sulution, reset solver, set next set
of target values.
4) Do until all target values have been tried.

I need help with #3 above. Thank you.

Greg.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using solver question jvc007 Excel Worksheet Functions 3 August 5th 08 08:26 PM
Solver question prspilot Excel Discussion (Misc queries) 3 September 19th 07 10:18 PM
Solver Question Mark Excel Worksheet Functions 0 July 11th 06 10:01 PM
Solver question Mick Excel Discussion (Misc queries) 0 April 21st 06 05:33 PM
Solver question Bill_S Excel Worksheet Functions 1 February 2nd 06 06:38 PM


All times are GMT +1. The time now is 05:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"