pg.geno.Space¶
Accessible via pg.geno.Space
, pg.geno.space
.
- class Space(elements=[], index=None, *, location=, hints=None)[source]¶
Bases:
pg.DNASpec
Represents a search space that consists of a list of decision points.
Example:
# Create a constant space. space = pg.geno.Space([]) # Create a space with one categorical decision point # and a float decision point space = pg.geno.space([ pg.geno.oneof([ pg.geno.constant(), pg.geno.constant(), ]), pg.geno.floatv(0.0, 1.0) ])
See also:
pg.geno.Space
,pg.geno.constant
.Attributes:
Returns all decision points in their declaration order.
Returns True if current node is a categorical choice.
Returns whether this template is constant.
Returns True if current node is a custom decision point.
Returns True if current node is numerical decision.
Returns True if current node is a sub-space.
Returns True if current node is a subchoice of a multi-choice.
Returns the size of the search space.
Methods:
format
([compact, verbose, root_indent])Format this object.
validate
(dna)Validate whether a DNA value conforms to this spec.
- property decision_points: List[DecisionPoint][source]¶
Returns all decision points in their declaration order.
- property is_constant: bool[source]¶
Returns whether this template is constant.
A constant Space does not have any genetic encoders.