[option maxTiers, and implementation
martin.hofmann@uni-bamberg.de**20091021082727] hunk ./src/Data/GlobalConfig.hs 8
-    setMaxLoops, setCmpRecArg, setTargets, addTargets, delTargets, setBackground,
+    setMaxLoops,setMaxTiers, setCmpRecArg, setTargets, addTargets, delTargets, setBackground,
hunk ./src/Data/GlobalConfig.hs 29
+    , scr_maxTiers   :: Integer
hunk ./src/Data/GlobalConfig.hs 48
+    , scr_maxTiers   = 1
hunk ./src/Data/GlobalConfig.hs 97
+setMaxTiers   v scr = scr{scr_maxTiers = v}
hunk ./src/Data/GlobalConfig.hs 114
-                       else hsep (map (squotes.pretty) (scr_bgks c))) <$>
-                fill 20 (text "Compare rec args") <+> pretty (show.scr_cmpRecArg $ c) <$>
-                fill 20 (text "Debug") <+> bool (scr_debug c) <$>                
-                fill 20 (text "dumpLog") <+> bool (scr_dumpLog c) <$>                
-                fill 20 (text "Simplified") <+> bool (scr_simplify c) <$>                              
-                fill 20 (text "Enhanced") <+> bool (scr_enhanced c) <$>                
-                fill 20 (text "Maximal loops") <+> 
-                    (if scr_debug c then integer (scr_maxLoops c) 
-                       else text "N/A"))
+                       else hsep (map (squotes.pretty) (scr_bgks c))) <$>             
+                fill 20 (text "Simplified") <+> bool (scr_simplify c) <$>                            
+                fill 20 (text "Enhanced") <+> bool (scr_enhanced c) <$>   
+                fill 20 (text "Compare rec args") <+> pretty (show.scr_cmpRecArg $ c) <$>             
+                fill 20 (text "DumpLog") <+> bool (scr_dumpLog c) <$>
+                fill 20 (text "Debug") <+> bool (scr_debug c)  <$>
+                if (not . scr_debug $ c) then linebreak
+                  else fill 20 (text "Maximal tiers") <+> integer (scr_maxTiers c) <$>                   
+                       fill 20 (text "Maximal loops") <+> integer (scr_maxLoops c) <>
+                       linebreak )     
hunk ./src/Data/IgorMonad.hs 14
-    tick, loopCount, loopsCount, isDebug, 
-    inEnhanced, ifIsSet, maxLoops, getPatComparison, background, targets, 
+    tick, nextTier, loopCount, loopsCount, tierCount, isDebug, 
+    inEnhanced, ifIsSet, atMaxLoops, atMaxTiers, getPatComparison, background, targets, 
hunk ./src/Data/IgorMonad.hs 47
---    , igor_sp  :: !HSpace
hunk ./src/Data/IgorMonad.hs 48
+    , igor_tc  :: Int
hunk ./src/Data/IgorMonad.hs 78
-setupTarget n ( Igor iod lc cf ct) = do
-    return $ Igor iod ((n,0):lc) cf ct  
+setupTarget n ( Igor iod lc tc cf ct) = do
+    return $ Igor iod ((n,0):lc) 0 cf ct  
hunk ./src/Data/IgorMonad.hs 86
-initIgor nr = Igor (initIOData nr) []
+initIgor nr = Igor (initIOData nr) [] 0
hunk ./src/Data/IgorMonad.hs 113
-maxLoops = gets $ scr_maxLoops.igor_cnf
+maxLoops = gets $ scr_maxLoops.igor_cnf   
+
+atMaxLoops :: IM Bool
+atMaxLoops = liftM2 ((==).((+1).fromInteger)) maxLoops loopCount
hunk ./src/Data/IgorMonad.hs 141
-    modify (\i@(Igor _ _ c _) -> i{igor_cnf=c{scr_bgks=bgk'}})
+    modify (\i@(Igor _ _ _ c _) -> i{igor_cnf=c{scr_bgks=bgk'}})
hunk ./src/Data/IgorMonad.hs 147
-    modify (\i@(Igor _ _ c _) -> i{igor_cnf=c{scr_bgks=bgk'}})
+    modify (\i@(Igor _ _ _ c _) -> i{igor_cnf=c{scr_bgks=bgk'}})
hunk ./src/Data/IgorMonad.hs 178
-    modify $ \igor@(Igor io _ _ _) ->
+    modify $ \igor@(Igor io _ _ _ _) ->
hunk ./src/Data/IgorMonad.hs 182
-tick = get >>= \i@(Igor _ ((n,lc):lcs) _ _) ->
+tick = get >>= \i@(Igor _ ((n,lc):lcs) _ _ _) ->
hunk ./src/Data/IgorMonad.hs 184
-    
+
+nextTier :: IM ()
+nextTier = get >>= \i@(Igor _ _ tc _ _) ->
+            llogNO(linebreak <> text "ALL CANDIDATES CLOSED, go to next tier") >>
+            put i{igor_tc = tc+1}
+
+tierCount :: IM Int
+tierCount = gets $ igor_tc 
+  
+maxTiers :: IM Integer
+maxTiers = gets $ scr_maxTiers.igor_cnf   
+
+atMaxTiers :: IM Bool
+atMaxTiers = liftM2 ((<=) . fromInteger) maxTiers tierCount
+            
hunk ./src/Data/IgorMonad.hs 210
-    i@(Igor iod _ _ _) <- get
+    i@(Igor iod _ _ _ _) <- get
hunk ./src/SynthesisEngine.hs 57
-    let hs' = take 2 $ map (simplify (scr_simplify conf)) $ hs
+    let hs' =  take (fromInteger . scr_maxTiers $ conf) $ map (simplify (scr_simplify conf)) $ hs
hunk ./src/SynthesisEngine.hs 91
-    llogNO . (text "HSpace:" <+>) . pretty $ hsp
-    get       >>= llogDE  . (indent 2) . pretty
-    if (isEmpty hsp) 
-       then llogNO(linebreak <> text "SEARCHSPACE EXHAUSTED - - STOP") >>
-             return []
-       else do 
-            let (hypos,hsp') = popHypos hsp
-            let (ejcts,cnds) = partition isFinished hypos
-            
-            maxloopcount <- stopAtMaxLoopCount
-         
-            if maxloopcount then stopWith hypos
-              else if (null cnds) 
-                     then llogNO(linebreak <> text "ALL CANDIDATES CLOSED, go to next tier") >> 
-                           doLoop hsp' >>= eject ejcts
-                     else do ahs   <- advance . head $ cnds
-                             hsp'' <- doLoop $ pushHypos ahs $ pushHypos (tail cnds) $ hsp'
-                             eject ejcts hsp'' 
-
+    llogNO . (text "HSpace:" <+>) . pretty $ hsp 
+        
+    debug <- isDebug   
+    let (hypos,hsp') = popHypos hsp
+    let (ejcts,cnds) = partition isFinished hypos
+    
+    if (isEmpty hsp) then exhausted
+       else if (null ejcts) then continue cnds hsp'
+              else if debug then finishTier ejcts cnds hsp'
+                     else llogNO (text "First Hypos finished: reduce" <+>
+                                  text "SearchSpace and finish tier!") >>
+                          finishTier ejcts cnds emptyHSpace
hunk ./src/SynthesisEngine.hs 104
+               
+finishTier ejcts [] hsp = do
+    debug <- isDebug
+    stop  <- liftM2 (||) atMaxTiers atMaxLoops
+    if (not debug) || (debug && stop) then stopWith ejcts
+       else llogNO (text "Tier finished: eject finished hypos and continue.") >>
+            doLoop hsp >>= eject ejcts                        
+finishTier ejcts cnds hsp = continue cnds $ pushHypos ejcts hsp
+                          
+continue cnds hsp = do 
+    ahs   <- advance . head $ cnds
+    doLoop $ pushHypos ahs $ pushHypos (tail cnds) $ hsp
+    
+exhausted = llogNO(linebreak <> text "SEARCHSPACE EXHAUSTED - - STOP") >>
+            return []     
hunk ./src/SynthesisEngine.hs 120
-eject hs 
-    | null hs   = return . id
-    | otherwise = return . (hs:)  
+eject hs = return . (hs:)  
hunk ./src/SynthesisEngine.hs 129
-       llogNO $ text "Stopped after entering loop the" <+> int lc <> text ". time."
+       tc <- tierCount
+       llogNO $ text "Stopped after entering loop the" <+> int lc <> 
+                text ". time in tier" <+> int tc <> colon
hunk ./src/SynthesisEngine.hs 134
-stopAtMaxLoopCount :: IM Bool
-stopAtMaxLoopCount = do 
-    d <- isDebug
-    if not d then return False 
-       else liftM2 ((==).((+1).fromInteger)) maxLoops loopCount
-
hunk ./src/UI/UIStarter.hs 62
+    , maxTiers  :: Integer
hunk ./src/UI/UIStarter.hs 91
+    , maxTiers  = 1
hunk ./src/UI/UIStarter.hs 273
+                (setMaxTiers . maxTiers $ s) .
hunk ./src/UI/UIStarter.hs 331
-outroBanner = linebreak <> 
-              indent 6 (bold (text "- - - - - - - FINISHED" <+> 
+outroBanner = indent 6 (bold (text "- - - - - - - FINISHED" <+> 
hunk ./src/UI/UIStarter.hs 348
+printTier 1 (hs,i) = vcat (map (printHypo (length hs)) (zip hs [1..])) 
hunk ./src/UI/UIStarter.hs 449
+      ("maxTiers",          "Return the first 'n' tiers of closed programs (debug only)",
+            maxTiers,  \ v s -> s { maxTiers = v}),