packages feed

concurrent-sa 1.0.0 → 1.0.1

raw patch · 2 files changed

+15/−15 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.Concurrent.Annealer: annealForTime :: (Ord e) => Int -> Int -> Annealer s e -> IO s
+ Control.Concurrent.Annealer: annealForTime :: Ord e => Int -> Int -> Annealer s e -> IO s
- Control.Concurrent.Annealer: getBestState :: (Ord e) => Annealer s e -> IO s
+ Control.Concurrent.Annealer: getBestState :: Ord e => Annealer s e -> IO s
- Control.Concurrent.Annealer: initAnnealer :: (Ord e) => (s -> e) -> [s] -> Int -> (s -> IO s) -> IO (Annealer s e)
+ Control.Concurrent.Annealer: initAnnealer :: Ord e => [s] -> (s -> e) -> Int -> (s -> IO s) -> IO (Annealer s e)

Files

Control/Concurrent/Annealer.hs view
@@ -16,6 +16,7 @@ import Control.Concurrent.Annealer.Population hiding (offerState) import qualified Control.Concurrent.Annealer.Population as Pop +-- | An annealer.  Maintains a population of states and a perturbation function. data Annealer s e = PopAnn { 	solPop :: {-# UNPACK #-} !(Population s e), 	perturb :: s -> IO s}@@ -24,18 +25,6 @@ getBestState :: Ord e => Annealer s e -> IO s getBestState = getBest . solPop --- | Initializes an annealer.-initAnnealer :: Ord e => (s -> e) -- ^ The energy function for a state.-			-> [s]	-- ^ A collection of initial states.-			-> Int	-- ^ The size at which to maintain the population.-			-> (s -> IO s) -				-- ^ The perturbation function.-			-> IO (Annealer s e)-				-- ^ The annealer.-initAnnealer solScore sols popSize perturb = -	do	solPop <- initPop solScore sols popSize-		return PopAnn{..}- -- | A thread in which states in the annealer's current population are perturbed -- and offered back into the population. perturber :: Annealer s e -> IO ()@@ -44,12 +33,23 @@ 	Pop.offerState sol' solPop 	perturber pop +-- | @'initAnnealer' initPop energyFunc popSize perturb@ initializes an annealer.+initAnnealer :: Ord e => +	   [s] 			-- A seed collection of initial states.+	-> (s -> e)		-- The energy function of a state.+	-> Int			-- The size at which to maintain the population.+	-> (s -> IO s) 		-- The perturbation function.+	-> IO (Annealer s e) 	-- The annealer.+initAnnealer sols solScore popSize perturb = +	do	solPop <- initPop solScore sols popSize+		return PopAnn{..}+ -- | Offer a state to the annealer.  Depending on the current -- population, the state may or may not be kept. offerState :: s -> Annealer s e -> IO () offerState s = Pop.offerState s . solPop --- | Runs several annealing threads for the specified length of time.+-- | @'annealForTime' nThreads microTime annealer@ runs @nThreads@ annealing threads for the specified length of time. annealForTime :: Ord e =>  		Int	-- The number of annealing threads to run. 		-> Int	-- The number of milliseconds until this program will try to stop.
concurrent-sa.cabal view
@@ -1,6 +1,6 @@ Name:		concurrent-sa-Version:	1.0.0-Category:	Algorithms+Version:	1.0.1+Category:	Algorithms, Concurrency Author:		Louis Wasserman License:	BSD3 License-file:	LICENSE