Iterative Improvers

The generic skeleton of iterative improvers. The first parameters is a neighbourhood stream expander,
the second is a stream contractor which makes choices from neighbourhoods. All neighbourhoods will be
filtered so that the elements can only improve upon the previous solution.

Since the parameters are stream transformers, simple functions must be lifted before they can be used
as parameters. For example a deterministic neighbourhood function df should be lifted with map and
to choose the first element from each improving neighbourhood you would use map head, giving

iterativeImprover (map df) (map head).

This skeleton provides a standard infinite stream of solutions, rather than terminating
when a local minima is reached. This provides better safety for composition than the
versions suggested in the paper. When the filter results in an empty list, the seed
value is wrapped up as a list and returned in its place.

Stochastic iterative improvement strategy. The choice function is required to make a random choice from
the neighbourhood at each step. This is implemented in terms of the select function, and
uses a uniformCDF.

Commonly TABU search does not take a function which makes a TABU list, but rather a size of
TABU list. We provide this less flexible form here, where the first parameter changes from
to being the window size. The choice function is set to map head. Implemented in terms of tabu.

I am not happy with this. What is really needed is a more flexible version of safe, so that
rather than just returning the singleton it can return an alternative transformation of the neighbourhood.
This is also some scope for using compiler rules here to balance usability with performance.

Simulated Annealing

Simulated Annealing skeleton. This requires a significant number of parameters due to the
various stochastic components, temperatures and the need for a numerical valuation of
solutions qualities. The parameters are;

a function to get the numerical value of a candidate solution

a function to provide a perturbation of a solution, with respect to some external factor,
such as a random number, which is what the data type r is expected (though not required) to be.

Included for completeness, this is a cooling strategy for simulated annealing that is usually not very effective,
a linear changing strategy. The first value is the starting temperature the second is the value to increase it by
at each step. In order to have it reduce at each step, pass a negative value.

The traditional choice function used within simulated annealing. The parameters are;
a function to yield quality of a solution, a value between 0 and 1 (stochastic expected) a temperature,
the old solution and the possible future solution. Frustratingly this does not make use of Optimisable
because it requires the actual floating point quality values of solutions.

Genetic Algorithms

Ant Colony Optimisation

A simple ACO implementation. It assumes that Ants will be released in groups, which is represented as the
population size. It requires a transformation for generating pheromones, and creating new solutions from
pheromone data. This will be problem specific.

ACO's often use a degrading system, so that the next trail contains some part of the previous trails.
This function provides this functionality, assuming that pheromone data can be summed like a number, and
an initial state is provided. The stream transformation parameter represents a streamed
degrade, for example;

map (*0.1)

would give one tenth of the previous previous pheromone data added to the result. This is a stream transformation to allow for flexibility, for example adding a stochastic element.