Description Usage Arguments Details Value
Minimise an objective function using simulated annealing starting at various locations, with a supplied proposal distribution and cooling schedule.
1 2 |
objf |
an objective function that takes a matrix with each column corresponds to a state, and return a vector with respective objective function values. (num mat -> num vec) |
proposal |
a random walk proposal that takes a matrix, and produces a matrix of proposed states, centred on the corresponding columns of the input matrix. It should also take in the current iteration count. ((num mat, num) -> num mat) |
starting |
a matrix with each column corresponding to a starting state. This code assumes that the starting values are feasible. (num mat) |
schedule |
a cooling schedule, taking the current iteration count and the absolute value of the current lowest objective function value as its first and second arguments respectively, and return a temperature. (num, num -> num) |
N |
the number of initial states. If this number is greater than the
column size of |
iter |
total number of iterations. (num) |
diagnostic |
print out diagnostic plots? (bool) |
verbose |
show the algorithm progression? (bool) |
The constraints are enforced by using an appropriate proposal distribution. It is advisable that the proposal variance is decreased after each iteration (hence the reason the proposal distribution should take the current iteration count in addition to the current state). The iterator in this code starts from 1 to N.
Diagnostic plots include a boxplot of the objective function values and a
scatterplot of the acceptance probabilities, both of which are plotted for
each iteration. The supplied starting values are recycled to construct
N
starting values.
a list that contains the best state, its objective function value, and the acceptance rate at each iteration.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.