mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-26 09:41:52 -07:00
maximize rather than minimize the rating.
This commit is contained in:
@@ -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
|
||||
|
@@ -153,7 +153,7 @@ mosaicL f hints origRect origws
|
||||
mc_mosaic :: [NamedWindow] -> CutDirection
|
||||
-> Rated Double (Mosaic (NamedWindow,Rectangle))
|
||||
mc_mosaic ws d = fmap (rect_mosaic origRect d) $
|
||||
anneal (zipML (example_mosaic ws) (map findarea ws))
|
||||
annealMax (zipML (example_mosaic ws) (map findarea ws))
|
||||
(the_rating . rate_mosaic ratew . rect_mosaic origRect d )
|
||||
changeMosaic
|
||||
|
||||
|
Reference in New Issue
Block a user