alogos.systems.whge.mapping
¶
Forward mapping function for WHGE.
Note that a reverse function for WHGE is supposedly not possible in full generality.
Functions¶
|
Map a WHGE genotype to a string phenotype. |
Detailed object descriptions¶
- alogos.systems.whge.mapping.forward(grammar, genotype, parameters=None, raise_errors=True, return_derivation_tree=False, verbose=False)[source]¶
Map a WHGE genotype to a string phenotype.
- Parameters:
grammar (
Grammar
)genotype (
Genotype
or data that can be converted to it)parameters (
dict
orParameterCollection
, optional) – Following keyword-value pairs are considered by this function:raise_errors (
bool
, optional) – Possible values:True
: A mapping error will be raised if a derivation is not finished within a limit provided in the parameters.False
: A partial derivation is allowed. In this case, the returned string will contain unexpanded nonterminal symbols. Therefore it is not a valid phenotype, i.e. not a string of the grammar’s language but a so-called sentential form.
return_derivation_tree (
bool
, optional) – IfTrue
, not only the phenotype is returned but additionally also the derivation tree.verbose (
bool
, optional) – IfTrue
, output about steps of the mapping process is printed.
- Returns:
- Raises:
MappingError – If
raise_errors
isTrue
and the mapping process can not generate a full derivation before reaching a limit provided in the parameters.