A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using VBA, how to write unique solutions only?



 
 
Thread Tools Display Modes
  #1  
Old May 6th 04, 04:27 PM posted to microsoft.public.excel.programming
Michael[_27_]
external usenet poster
 
Posts: 41
Default Using VBA, how to write unique solutions only?

Hi everyone,

I run an optimizer n times, say 10, and tell the model to write
feasible solutions into an excel table as follows:

RUN Cost Weight Volume
1 2.3 51.27 20.3
2 3.1 49.2 22.2
3 4.3 37.2 16.7
4 2.3 51.27 20.3
5
6
and so on.

I use a piece of VBA code like this:

Cline = 1
For JobNr = 1 To 10
result = vehicleModel.ReadModel("MCS2vehicle.mpl")

If result > 0 Then
MsgBox vehicleModel.ErrorMessage
Else
vehicleModel.Solve

Set varVect = vehicleModel.VariableVectors("Assign")
Aline = 1
For Each mac In vehicleModel.Macros
If vehicleModel.Solution.ResultCode = 101 Then
Flag = 1
ARngSolution(Cline, Aline).Value = mac.Value
With ARngSolution(Cline, Aline)
.HorizontalAlignment = xlCenter
.NumberFormat = "#.##0"
End With
Else
Flag = 0
GoTo NextJobNr
End If
Aline = Aline + 1
Next mac

End If
NextJobNr:
Next

Note that solutions # 1 and 4 are identical! I want to write only new
solutions.
What should I add to the above piece to force it to do so?

Thanks,
Mike
Ads
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Comment Box Position - Any solutions? Stilla Excel Worksheet Functions 4 January 16th 07 06:59 PM
IF formula with many solutions. Jaime.CIS New Users to Excel 5 December 7th 06 08:25 PM
Ensure unique solutions to random formula Clayman Excel Worksheet Functions 5 February 24th 06 07:45 PM
lookup & match solutions ieatboogers Excel Worksheet Functions 0 November 16th 05 11:32 PM
Looking for Solutions Tony Johnson Excel Programming 6 August 14th 03 03:03 PM


All times are GMT +1. The time now is 12:52 PM.


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