aboutsummaryrefslogtreecommitdiffstats
path: root/Anneal.hs
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-06-01 20:32:40 +0200
committerDavid Roundy <droundy@darcs.net>2007-06-01 20:32:40 +0200
commit7ef3c452e3b9878f6423ca64d25631bc7a422695 (patch)
tree3864fdd912ad941c76cb2342e18251259cb949a0 /Anneal.hs
parentf67ce40adf3a62e453734b51e956aa1e7175cee9 (diff)
downloadXMonadContrib-7ef3c452e3b9878f6423ca64d25631bc7a422695.tar.gz
XMonadContrib-7ef3c452e3b9878f6423ca64d25631bc7a422695.tar.xz
XMonadContrib-7ef3c452e3b9878f6423ca64d25631bc7a422695.zip
maximize rather than minimize the rating.
darcs-hash:20070601183240-72aca-496237c05e03b76ae05495afb22b36ced21d7b60.gz
Diffstat (limited to 'Anneal.hs')
-rw-r--r--Anneal.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Anneal.hs b/Anneal.hs
index 52f7048..e35a90b 100644
--- a/Anneal.hs
+++ b/Anneal.hs
@@ -1,4 +1,5 @@
-module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating, anneal ) where
+module XMonadContrib.Anneal ( Rated(Rated), the_value, the_rating
+ , anneal, annealMax ) where
import System.Random ( StdGen, Random, mkStdGen, randomR )
import Control.Monad.State ( State, runState, put, get, gets, modify )
@@ -21,6 +22,9 @@ instance Ord a => Ord (Rated a b) where
anneal :: a -> (a -> Double) -> (a -> [a]) -> Rated Double a
anneal st r sel = runAnneal st r (do_anneal sel)
+annealMax :: a -> (a -> Double) -> (a -> [a]) -> Rated Double a
+annealMax st r sel = runAnneal st (negate . r) (do_anneal sel)
+
do_anneal :: (a -> [a]) -> State (Anneal a) (Rated Double a)
do_anneal sel = do sequence_ $ replicate 100 da
gets best