Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 69 additions & 62 deletions FastDownward.hs
Original file line number Diff line number Diff line change
Expand Up @@ -600,71 +600,78 @@ solve cfg ops tests = do
Seq.fromList $ Data.Foldable.toList axioms
}

planFilePath <-
liftIO ( emptySystemTempFile "sas_plan" )

( exitCode, stdout, stderr ) <-
liftIO
( Exec.callFastDownward
Exec.Options
{ fastDownward = "downward"
, problem = plan
, planFilePath = planFilePath
, searchConfiguration = cfg
}
)

case exitCode of
ExitFailure 11 ->
return Unsolvable

ExitFailure 12 ->
return UnsolvableIncomplete

ExitFailure 22 ->
return OutOfMemory

ExitFailure 23 ->
return OutOfTime

ExitFailure 32 ->
return CriticalError

ExitFailure 33 ->
return InputError
if null goal
then pure (Solved (Solution
{ sas = plan
, operators = mempty
, stepIndices = mempty
}))
else do
planFilePath <-
liftIO ( emptySystemTempFile "sas_plan" )

( exitCode, stdout, stderr ) <-
liftIO
( Exec.callFastDownward
Exec.Options
{ fastDownward = "downward"
, problem = plan
, planFilePath = planFilePath
, searchConfiguration = cfg
}
)

case exitCode of
ExitFailure 11 ->
return Unsolvable

ExitFailure 12 ->
return UnsolvableIncomplete

ExitFailure 22 ->
return OutOfMemory

ExitFailure 23 ->
return OutOfTime

ExitFailure 32 ->
return CriticalError

ExitFailure 33 ->
return InputError

ExitFailure 34 ->
return Unsupported

ExitFailure other ->
return ( Crashed stdout stderr ( ExitFailure other ) )

ExitSuccess -> liftIO $ do
planText <-
Data.Text.Lazy.IO.readFile planFilePath

let
stepIndices =
map -- Read "(op42)" as 42
( read
. Data.Text.Lazy.unpack
. Data.Text.Lazy.init -- keep everything up to ")"
. Data.Text.Lazy.drop 3 -- drop "(op"
)
( takeWhile
( "(" `Data.Text.Lazy.isPrefixOf` )
( Data.Text.Lazy.lines planText )
)

ExitFailure 34 ->
return Unsupported

ExitFailure other ->
return ( Crashed stdout stderr ( ExitFailure other ) )

ExitSuccess -> liftIO $ do
planText <-
Data.Text.Lazy.IO.readFile planFilePath

let
stepIndices =
map -- Read "(op42)" as 42
( read
. Data.Text.Lazy.unpack
. Data.Text.Lazy.init -- keep everything up to ")"
. Data.Text.Lazy.drop 3 -- drop "(op"
)
( takeWhile
( "(" `Data.Text.Lazy.isPrefixOf` )
( Data.Text.Lazy.lines planText )
return
( Solved
Solution
{ sas = plan
, operators = IntMap.fromList ( zip [0..] ( map fst operators ) )
, ..
}
)

return
( Solved
Solution
{ sas = plan
, operators = IntMap.fromList ( zip [0..] ( map fst operators ) )
, ..
}
)


exhaustEffects
:: Traversable t
Expand Down