[code cosmetics
martin.hofmann@uni-bamberg.de**20090218122231] hunk ./src/SynthesisEngine.hs 7
+import Data.IOData
hunk ./src/SynthesisEngine.hs 17
-import Debug.Trace
hunk ./src/SynthesisEngine.hs 18
-import Control.Monad.Error
hunk ./src/SynthesisEngine.hs 19
+_MaxLoopCount = 50
hunk ./src/SynthesisEngine.hs 37
-    tgts <- return $  decs2rules tgtsQ --  [(Name,Rules)]
-    bgks <- return $  decs2rules bgksQ
-    tnms <- return $  (map fst) tgts
-    allrs <- return $  (++) tgts bgks 
-    igordata <- return $ initIgor allrs
-    result <- (runIM ( synthesiseTargets tnms) igordata) 
+    let tgts     =  decs2rules tgtsQ --  [(Name,Rules)]
+    let bgks     =  decs2rules bgksQ
+    let tnms     =  (map fst) tgts
+    let allrs    =  (++) tgts bgks 
+    let igordata = initIgor allrs
+    result       <- (runIM ( synthesiseTargets tnms) igordata) 
hunk ./src/SynthesisEngine.hs 54
-    setTarget n >> currentBestHypos >>= closeHypos
-
-closeHypos :: Hypos -> IM [[(Name,Rules)]]
-closeHypos hs =  do
+    setTarget n >> enterLoop
hunk ./src/SynthesisEngine.hs 56
+enterLoop :: IM [[(Name,Rules)]]
+enterLoop =  do
hunk ./src/SynthesisEngine.hs 59
-    loopCount >>= \lc -> llogIN $ text "Entering Rule-Advancement-Loop for the" <+> int lc <+> text ". time"
-    llogIN $ text "Closing Hypos:" <^> pretty hs
-    hypoCount >>= \hc -> llogIN $ text "Currently are" <+> int hc <+> text "hypotheses in the search space"
-    getSearchSpace >>= \sp -> llogIN $ text "Current SearchSpace:" <^> pretty sp
-   
+    
hunk ./src/SynthesisEngine.hs 61
-    let openrules = (S.fold collect S.empty hs) 
-    if S.null openrules
-      then stopWith hs
-      else do applyAdvacements (chooseOneRule openrules)  >> currentBestHypos >>= closeHypos
-    where
-    chooseOneRule = S.findMin
-    collect = (\h rs -> S.union (open h) rs)
+    
+    loopCount >>= \lc -> llogIN $ text "Entering Rule-Advancement-Loop for the" <+> 
+                                  int (lc) <> text ". time"
+    get       >>= \ig -> llogIN $ indent 2 $ pretty ig
+    
+    candidatehypos <- currentBestHypos  
+    candidaterules <- chooseCandidateRules candidatehypos
+    
+    llogIN $ text "Candidate Hypos:" <^> pretty candidatehypos
+    llogIN $ text "Candidate Rules:" <^> pretty candidaterules
+    
+    nocandidates <- stopWhenNoCandidateRules candidaterules 
+    maxloopcount <- stopAtMaxLoopCount
+    
+    llogIN $ text "Stopping Criteria?" <^>
+             text "Empty Candidates :" <+> bool nocandidates <^>
+             text "Max Loopcount    :" <+> bool maxloopcount 
+                                
+    
+    candidaterule  <- chooseOneRule candidaterules
+    if nocandidates || maxloopcount
+      then stopWith candidatehypos
+      else applyAdvacements candidaterule  >>  enterLoop
hunk ./src/SynthesisEngine.hs 89
+
+stopWhenNoCandidateRules :: RuleFrags -> IM Bool
+stopWhenNoCandidateRules = return . S.null
+
+stopAtMaxLoopCount :: IM Bool
+stopAtMaxLoopCount = liftM2 (==) loopCount (return _MaxLoopCount)
+
+
+chooseCandidateRules :: Hypos -> IM RuleFrags
+chooseCandidateRules = return . S.fold collect S.empty  
+    where    
+    collect = S.union . open
+    
+chooseOneRule :: RuleFrags -> IM RuleFrag
+chooseOneRule = return . S.findMin
hunk ./src/SynthesisEngine.hs 110
-    modify $ advancements `seq` (propagate rf advancements)
+    propagate rf advancements