ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using solver variables to access database values (https://www.excelbanter.com/excel-programming/376787-using-solver-variables-access-database-values.html)

passenger

Using solver variables to access database values
 
Hi,

I'm trying to solve a problem using solver and an access database.

In that database I have a table with values that depend on a day of the
year and an hour of the day. That is: 365 * 24 rows.

In the Excel sheet I have a sumatory of functions that depend on those
variables.

The function = fx(day, hour, constants...)

I want to obtain the day and the hour that maximizes the sumatory.

I want to use solver to alter the two variables (day and hour) between
their constrained ranges

day =1 and day<=365
hour=0 and hour <=23

The function will use these values to launch selects on the database
and recover the values of the specified day:

select value from table where day=%SolverProposedDayValue% and
hour=%SolverProposedHourValue%

The problem is that despite of the integer restriction for teh
variables, solver sends real variables to the function, and using clong
or cint to convert the variable doesn't seem to solve the problem,
because solver thinks that the solution converges and stops the
calculation in very few iterations.

Can I force solve to send me integer variables between the range that I
have specified?

Can I use some kind of function to convert the proposed solver
variables to an integer variable between the range I have specified?

If I can't, there are other products that I can use? I have seen
lpsolve, but it seems not very integrated with excel...

Or perhaps ... Can I focus the problem in some other different way that
avoid me those problems?

Thanks in advance,



All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com