local-search-0.0.3: A first attempt at generalised local search within Haskell, for applications in combinatorial optimisation.

MaintainerRichard Senington <sc06r2s@leeds.ac.uk>



Simple Neighbourhood functions for the representation of problems to the library. All neighbourhood functions must ultimately be of the form a->[a].

This module also contains some additional code for the modeling of problems and the link between the model and the library.



exchange :: Eq a => Int -> Int -> [a] -> [[a]]Source

following helper function pinched from http:www.polyomino.f2s.comdavidhaskell/combinatorics.html

my code again from here on

The first type of neighbourhood is based upon combination exchange in a sequence of elements. This is appropriate for something like TSP, where order matters, but would be less useful for SAT.

It takes 2 numbers as parameters, one of which is the number of exchanges to perform, the other the maximum distance within the list. For example exchange 2 2, would change up to 2 elements in each neighbourhood, either adjacent or separated by 1 other element.

basicExchange :: Eq a => [a] -> [[a]]Source

We provide the most basic exchange system for testing

class (Ord b, Num b) => NumericallyPriced a b | a -> b whereSource

Some transformations (and the manual inspector of the search process) need to be able to extract a numeric price from a solution. To use these, the solution representation data type must be a part of the following class, please see the example code.


priceSolution :: a -> bSource