minizinc-process-0.1.3.0: A set of helpers to call minizinc models.
Safe HaskellNone
LanguageHaskell2010

Process.Minizinc

Description

A set of types and functions to help calling Minizinc as an external binary.

Current strategy is to use JSON encode/decoding for passing in inputs and reading outputs. At this time, only a primitive output parser is supported.

Synopsis

Documentation

data MiniZinc input answer Source #

An object helping to run MiniZinc.

Constructors

MiniZinc 

Fields

simpleMiniZinc :: Hashable input => FilePath -> MilliSeconds Int -> Solver -> MiniZinc input answer Source #

A constructor for MiniZinc object for simple situations.

withArgs :: [String] -> MiniZinc input answer -> MiniZinc input answer Source #

Helper to set arguments.

data Solver Source #

Supported solvers or Other.

Instances

Instances details
Show Solver Source # 
Instance details

Defined in Process.Minizinc

type SolverName = String Source #

Name of a solver to be passed to the minizinc binary.

type MilliSeconds a = Int Source #

Type alias asking for milliseconds.

data SearchState a Source #

Instances

Instances details
Functor SearchState Source # 
Instance details

Defined in Process.Minizinc

Methods

fmap :: (a -> b) -> SearchState a -> SearchState b #

(<$) :: a -> SearchState b -> SearchState a #

Eq a => Eq (SearchState a) Source # 
Instance details

Defined in Process.Minizinc

Ord a => Ord (SearchState a) Source # 
Instance details

Defined in Process.Minizinc

Show a => Show (SearchState a) Source # 
Instance details

Defined in Process.Minizinc

data ResultHandler obj b Source #

Constructors

ResultHandler 

Fields

runMinizincJSON :: forall input answer b. (ToJSON input, FromJSON answer) => MiniZinc input answer -> input -> b -> ResultHandler answer b -> IO b Source #

collectResults :: ResultHandler obj [SearchState obj] Source #

Collect all results in memory. The resulting list is in reverse order (best are first elements in case of optimizations).

keepLast :: ResultHandler obj (Maybe (SearchState obj)) Source #

Keep only the latest result in memory.

runLastMinizincJSON :: (ToJSON input, FromJSON answer) => MiniZinc input answer -> input -> IO (Maybe answer) Source #

Runs MiniZinc on the input and parses output for the last answer.

cleanTmpFile :: MiniZinc input a -> input -> IO () Source #

Removes the temporary data file created as input before running minizinc.