Message Boards Message Boards

0
|
4509 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to output best solution found so far in Simulated Annealing?

Posted 9 years ago
POSTED BY: F H
2 Replies

Among other possibilities, you might want to memoize that objective. This is done as

StressError[p1_, p2_, p3_, p4_, p5_]:= StressError[p1, p2, p3, p4, p5]=...

Once computed for a particular {p1,...,p5} it will subsequently be found by lookup.

Also it might be useful to define it in such a way that it only evaluates when given explicit numeric input. If symbolic processing is any part of the speed issue, this change will redress that.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

Thanks, the method described works in making evaluations with repeated parameters of the function much faster

StressError[p1_?NumericQ, p2_?NumericQ, p3_?NumericQ, p4_?NumericQ, p5_?NumericQ]:= StressError[p1, p2, p3, p4, p5] = ...

By adding "?NumericQ" I define the function to only evaluate with numeric input (that is how I defined the function initially), so numeric evaluation shouldn't take place.

POSTED BY: F H
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract