Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA - Solver use on arrays

I have developed an excel sheet which can calculate a certain number of data
via the solver-macro. Now I need to improve my sheet by only running all
calculations and data in the "background", i.e. show no data in any sheets,
unless it is the final result.

Basically, the problem is to get the FXW out of the following:
Minimize FunctionX
s.t.
1) (Min)imum < (W)eighting of variable
2) (W)eighting of variable < (Max)imum
3) (Sum) of FXW = 1
4) Max Weight of varible 1 to y (W_1y) = Predefined by Cell reference (MaxY)
5) Max Weight of varible y+1 to n (W_yn) = Predefined by Cell reference (MaxN)

Min and Max are arrays defined in functions. 4 and 5 is summation of
variable weight in the FXW, see below.
FunctionX is given as an FXW * matrix * FXW^-1, where FXW will be the weight
of each variable.

Input:
a) Max
b) Min
c) MaxY
d) MaxN
e) Matrix
Arrays and Matrix is n

Code is like this (in generel terms):
Function MaxY()
MaxY = Sheets("Inputs").Cells(5, 31).Value
End Function

Function W_1y()
Dim i as integer
for i=1 to y
x = x + FXW(1,i)
next i
W_1y = x
End Function

Function MinFunctionX()
ReDim FXW(n)
FunctionX = FXW * matrix * FXW^-1
SolverReset
Call solveradd(Sum, 2, "1")
Call solveradd(FXW, 3, Min)
Call solveradd(FXW, 1, Max)
Call solveradd(W_1y, 1, MaxY)
Call solveradd(W_yn, 1, MaxN)
Call solverok(FunctionX, 2, 0, FXW)
Call SolverSolve(True)
SolverFinish
MinFunctionX = FXW
End Function

What I don't know is 1) if I can use functions in the call solver... 2) the
repeated calculation of W_1y and W_yn is done in another function, is this
appropriate, even possible? 3) how to store the FXW for other use. I would
like to be able to double check the values with the slow excel program i got.

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
Solver: Can you use it with Arrays in VBA? Peter Bernadyne Excel Discussion (Misc queries) 2 August 19th 06 05:58 PM
Interesting Solver problem (Solver encounters an error) MrShorty Excel Discussion (Misc queries) 3 December 22nd 05 10:52 PM
Arrays Dan Excel Worksheet Functions 3 September 15th 05 07:36 AM
Resetting Solver Manually to Fix Solver Bug Stratuser Excel Programming 0 September 13th 04 07:04 PM
Arrays Colin Macleod Excel Programming 1 December 1st 03 04:32 PM


All times are GMT +1. The time now is 06:23 AM.

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

About Us

"It's about Microsoft Excel"