pg.hyper.HyperValue¶
Accessible via pg.hyper.HyperValue
.
- class HyperValue[source]¶
Bases:
pg.symbolic.NonDeterministic
Base class for a hyper value.
Hyper value represents a space of objects, which is essential for programmatically generating objects. It can encode a concrete object into a DNA, or decode a DNA into a concrete object.
DNA is a nestable numeric interface we use to generate object (see geno.py). Each position in the DNA represents either the index of a choice, or a value itself is numeric. There could be multiple choices standing side-by-side, representing knobs on different parts of an object, or choices being chained, forming conditional choice spaces, which can be described by a tree structure.
Hyper values form a tree as the following:
Methods:
decode
(dna)Decode a value from a DNA.
dna_spec
([location])Get DNA spec of DNA that is decodable/encodable by this hyper value.
encode
(value)Encode a value into a DNA.
set_dna
(dna)Use this DNA to generate value.
Attributes:
Returns the DNA that is being used by this hyper value.
- abstract dna_spec(location=None)[source]¶
Get DNA spec of DNA that is decodable/encodable by this hyper value.
- Return type: