Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Problem with Solver and Integer constraints

If the solver is attempting to optimize a cell with a function in it,
and the input cell to the function has an integer constraint on it, the
solver won't do anything.

For example:

set A1 = 1
set B1 = "=dummy(A1)"

create a function in a module like so:

public function dummy( x as integer ) as integer
dummy = x * 10
end function

optimize for the maximum value of B1, constraining A1 like so:
A1 = 1
A1 <= 10
A1 is an integer

...And the solver does nothing. What is the proper way to do this?

  #2   Report Post  
Tushar Mehta
 
Posts: n/a
Default

You are trying to optimize a discontinuous function. Dummy(1<=x<1.5)=
10 and Dummy(1.5<=x<2.5)=20.

Solver, like several other optimization programs doesn't work well with
discontinuous functions (actually non-smooth functions). Change Dummy
to

Function Dummy(x As Double) As Double
Dummy = x * 10
End Function

and everything will work just fine. You will get 10 as the solution.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
If the solver is attempting to optimize a cell with a function in it,
and the input cell to the function has an integer constraint on it, the
solver won't do anything.

For example:

set A1 = 1
set B1 = "=dummy(A1)"

create a function in a module like so:

public function dummy( x as integer ) as integer
dummy = x * 10
end function

optimize for the maximum value of B1, constraining A1 like so:
A1 = 1
A1 <= 10
A1 is an integer

..And the solver does nothing. What is the proper way to do this?


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 parameter constraint question Morrigan Excel Discussion (Misc queries) 7 June 7th 05 10:01 PM
Solver and dynamic ranges tim Excel Worksheet Functions 0 May 5th 05 01:29 AM
Solver Constraints Rick Excel Discussion (Misc queries) 15 March 9th 05 03:17 PM


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