added EnzymeTree-Generator via QuickCheck
This commit is contained in:
@ -154,9 +154,10 @@ plant.
|
||||
> | Photosynthesis
|
||||
> deriving (Show, Enum, Bounded, Eq)
|
||||
>
|
||||
> data Component = PP
|
||||
> data Component = GenericComponent Int
|
||||
> | PP
|
||||
> | FPP
|
||||
> deriving (Show, Enum, Bounded, Eq)
|
||||
> deriving (Show, Eq)
|
||||
|
||||
Compounds are either direct nutrients or already processed components
|
||||
|
||||
@ -173,15 +174,14 @@ Enzymes
|
||||
|
||||
Enzymes are the main reaction-driver behind synthesis of intricate compounds.
|
||||
|
||||
> data Synthesis = Synthesis [(Compound, Amount)] (Compound,Amount)
|
||||
> data Enzyme = Enzyme
|
||||
> { enzymeName :: String
|
||||
> -- ^ Name of the Enzyme. Enzymes with the same name are supposed
|
||||
> -- to be identical.
|
||||
> , substrateRequirements :: [(Nutrient,Amount)]
|
||||
> -- ^ needed for reaction to take place
|
||||
> , substrateIntolerance :: [(Nutrient,Amount)]
|
||||
> -- ^ inhibits reaction if given nutrients are above the given concentration
|
||||
> , synthesis :: [(Compound,Amount)] -> [(Compound,Amount)]
|
||||
> , synthesis :: [Synthesis]
|
||||
> -- ^ given x in amount a, this will produce y in amount b
|
||||
> , dominance :: Maybe Amount
|
||||
> -- ^ in case of competition for nutrients this denotes the priority
|
||||
@ -199,18 +199,14 @@ Enzymes are the main reaction-driver behind synthesis of intricate compounds.
|
||||
Example "enzymes" could be:
|
||||
|
||||
> pps :: Enzyme -- uses Phosphor from Substrate to produce PP
|
||||
> pps = Enzyme "PPS" [(Phosphor,1)] [] syn Nothing
|
||||
> pps = Enzyme "PPS" [(Phosphor,1)] syn Nothing
|
||||
> where
|
||||
> syn compAvailable = [(Substrate Phosphor,i*(-1)),(Produced PP,i)]
|
||||
> where
|
||||
> i = getAmountOf (Substrate Phosphor) compAvailable
|
||||
> syn = [Synthesis [(Substrate Phosphor, 1)] (PP, 1)]
|
||||
>
|
||||
> fpps :: Enzyme -- PP -> FPP
|
||||
> fpps = Enzyme "FPPS" [] [] syn Nothing
|
||||
> fpps :: Enzyme
|
||||
> fpps = Enzyme "FPPS" [] syn Nothing
|
||||
> where
|
||||
> syn compAvailable = [(Produced PP,i*(-1)),(Produced FPP,i*0.5)]
|
||||
> where
|
||||
> i = getAmountOf (Produced PP) compAvailable
|
||||
> syn = [Synthesis [(PP, 1)] (FPP, 1)]
|
||||
|
||||
|
||||
---
|
||||
@ -272,7 +268,7 @@ internal state how many nutrients and compounds are currently inside the plant.
|
||||
> data Plant = Plant
|
||||
> { genome :: Genome
|
||||
> -- ^ the genetic characteristic of the plant
|
||||
> , absorbNutrients :: Environment -> [(Nutrient,Amount)]
|
||||
> , absorbNutrients :: Environment -> [(Component,Amount)]
|
||||
> -- ^ the capability to absorb nutrients given an environment
|
||||
> }
|
||||
> instance Show Plant where
|
||||
@ -303,7 +299,8 @@ The following example yields in the example-environment this population:
|
||||
> a <- activation
|
||||
> return $ (,,) <$> e' <*> [q] <*> [a]
|
||||
>
|
||||
> defaultAbsorption (Environment s _) = limit Phosphor 2
|
||||
> defaultAbsorption (Environment s _) = (\(a,b) -> (Substrate a,b))
|
||||
> . limit Phosphor 2
|
||||
> . limit Nitrate 1
|
||||
> . limit Sulfur 0
|
||||
> <$> s
|
||||
@ -334,10 +331,10 @@ an environment.
|
||||
|
||||
---
|
||||
|
||||
> produceCompounds :: Plant -> [(Nutrient, Amount)] -> [Compound]
|
||||
> produceCompounds :: Plant -> [(Compound, Amount)] -> [Compound]
|
||||
> produceCompounds (Plant genes _) = undefined
|
||||
> -- this will take some constrained linear algebra-solving
|
||||
|
||||
>
|
||||
> deterPredators :: [(Predator, Probability)] -> [Compound] -> Probability
|
||||
> deterPredators ps cs = sum $ do
|
||||
> c <- cs -- for every compound
|
||||
|
Reference in New Issue
Block a user