Safe Haskell | None |
---|
- data Candidate = Candidate {}
- newtype Score = Score {}
- data DesignProblem = DesignProblem {
- structures :: [D1Secondary]
- assignments :: [Assignment]
- mkInitial :: (MonadPrim m, PrimMonad m) => (Primary -> Score) -> Int -> DesignProblem -> Rand m Candidate
- unfoldStream :: forall m. (MonadPrim m, PrimMonad m) => Int -> Int -> Int -> (Primary -> Score) -> (Candidate -> Candidate -> Rand m Bool) -> DesignProblem -> Candidate -> Stream (Rand m) Candidate
- mutateOneAssignmentWith :: (MonadPrim m, PrimMonad m) => (Primary -> Score) -> (Candidate -> Candidate -> Rand m Bool) -> Candidate -> Assignment -> Rand m Candidate
Documentation
A single candidate, with its sequence and the score, this sequence receives. Candidates are ordered by their scores.
The likelihood score we get.
TODO replace Score Likelihood / LogLikelihood (once we switch to the more generic MCMC library)
data DesignProblem Source
This structure defines a design problem
DesignProblem | |
|
mkInitial :: (MonadPrim m, PrimMonad m) => (Primary -> Score) -> Int -> DesignProblem -> Rand m CandidateSource
Create an initial, legal, candidate.
unfoldStream :: forall m. (MonadPrim m, PrimMonad m) => Int -> Int -> Int -> (Primary -> Score) -> (Candidate -> Candidate -> Rand m Bool) -> DesignProblem -> Candidate -> Stream (Rand m) CandidateSource
Create a stream of Candidate
s from an initial candidate.
:: (MonadPrim m, PrimMonad m) | |
=> (Primary -> Score) | the likelihood function, gives a sequence a score |
-> (Candidate -> Candidate -> Rand m Bool) | choose between old and new sequence (monadic, stochastic) |
-> Candidate | old / current sequence |
-> Assignment | possible assignments for the sequence |
-> Rand m Candidate | the new sequence |
Mutate the current (or old) sequence under the possible assignment
s as
prescribed by Assignment
. The modifying assignment is selected uniformly.
The monadic old -> new -> Rand m Bool
function chooses between the old and
the new candidate. It can be used to, e.g., allow always choosing new if
it is better, but choosing new as well if some stochastic value (hence
dependence on Rand m
) indicates so.