mirror of
https://codeberg.org/ProgramSnail/prog_synthesis.git
synced 2025-12-06 05:28:42 +00:00
new saturate step archetecture: call saturate only at the end, speedup
This commit is contained in:
parent
15cbf78ed5
commit
75dafdab5e
3 changed files with 73 additions and 43 deletions
|
|
@ -14,7 +14,8 @@ data Oracle = Oracle { oracleTypes :: TypeConf,
|
|||
|
||||
data Conf = Conf {confInput :: [Value],
|
||||
confOracle :: Oracle,
|
||||
confExamples :: [[Value]]}
|
||||
confExamples :: [[Value]],
|
||||
confTryFindExamples :: Bool}
|
||||
|
||||
-- TODO: check
|
||||
structuralLess :: Value -> Value -> Bool
|
||||
|
|
@ -100,9 +101,9 @@ eval conf (SelfE es) = do recInput <- foldM (\es e -> consValsM es (eval conf e)
|
|||
then RecError $ "self call on >= exprs, new=" ++ show recInput ++ " old=" ++ show (confInput conf)
|
||||
else do
|
||||
case (oracleFunc $ confOracle conf) recInput of
|
||||
Just recOutput -> if recInput `elem` confExamples conf
|
||||
Just recOutput -> if recInput `elem` confExamples conf || not (confTryFindExamples conf) -- TODO: better way
|
||||
then return recOutput
|
||||
else NewExamples $ trace ("newExample: " ++ show [(recInput, recOutput)]) [(recInput, recOutput)]
|
||||
else NewExamples $ trace ("New example: " ++ show [(recInput, recOutput)]) [(recInput, recOutput)]
|
||||
Nothing -> FatalError $ "no oracle output on " ++ show recInput
|
||||
where consValsM :: [Value] -> Result Value -> Result [Value]
|
||||
consValsM vs (Result v) = Result $ v : vs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue