LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Solver programming in VBA

In trying to model an optimization problem, I have successfully
written a macro to iterate through all of the branches of the problem,
and copy specified values from the relevant sensitivity reports to a
new worksheet (called "Summary"). However, in adding some new
constraints to the model, it turns out that the model becomes
infeasible for some of the branches. Thus, rather than generating a
Sensitivity Report, solver generates a Feasibility Report.

My problem: in my VBA code, I reference the Sensitivity Report
worksheet by name rather than index number. This causes my macro to
bomb out if a particular branch of the problem is infeasible (because
there is no appropriate Sensitivity Report to reference). However, if
I were to call the sheet by index number, I'd end up (1) not knowing
that some of the solutions in "Summary" were infeasible, and that some
of the data on that sheet comes from feasibility reports rather than
sensitivity reports.

My question: is there a way to have my macro behave differently if
solver finds that a particular iteration of a problem is infeasible?

Relevant code snippet below:

SolverSolve (True)
efficiency = Cells(27, 11)
'Create Sensitivity report if branch is inefficient
If (Round(efficiency, 2) < 1) Then
SolverFinish ReportArray:=Array(2)
refset = 0
nrefset = 0
'Find branches that constitute reference set of
inefficient branch
While refset < branches
Sheets("Sensitivity Report 1").Select
If (Round(Cells(refset + 28, 5), 2) 0) Then
Sheets("Summary").Select
Cells(k + 27, nrefset + 12) = (refset + 1)
nrefset = nrefset + 1
End If
refset = refset + 1
Wend
Application.DisplayAlerts = False
'Get rid of Sensitivity report, no questions asked...
Sheets("Sensitivity Report 1").Delete
Application.DisplayAlerts = True
Sheets("Branch Analysis G-IN").Select
End If

My apologies if my code is obtuse or cluttered, this is my first foray
into VBA.

Thanks for your help!

Andrew

 
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
Linear Programming via Excel Solver Squadron Excel Discussion (Misc queries) 1 December 5th 08 04:48 PM
Linear Programming(solver ?) rick Excel Programming 8 November 3rd 06 02:42 PM
Excel Solver Programming Error Derek Chen Excel Programming 4 November 29th 05 03:54 PM
SOLVER- programming or not? Henrique Campos Excel Programming 4 September 4th 04 03:31 PM
Solver and Excel programming problem AAB Excel Programming 0 February 3rd 04 12:57 AM


All times are GMT +1. The time now is 09:04 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"