morphological_measures
MorphologicalMeasures class.
Module Contents
Classes
Modular robot morphological measures. |
Attributes
- TModule
- class MorphologicalMeasures(body: revolve2.modular_robot.body.base.Body)
Bases:
Generic
[TModule
]Modular robot morphological measures.
Only works for robot with only right angle module rotations (90 degrees). Some measures only work for 2d robots, which is noted in their docstring.
The measures are based on the following paper: Miras, K., Haasdijk, E., Glette, K., Eiben, A.E. (2018). Search Space Analysis of Evolvable Robot Morphologies. In: Sim, K., Kaufmann, P. (eds) Applications of Evolutionary Computation. EvoApplications 2018. Lecture Notes in Computer Science(), vol 10784. Springer, Cham. https://doi.org/10.1007/978-3-319-77538-8_47
- property bounding_box_depth: int
Get the depth of the bounding box around the body.
Forward/backward axis for the core module.
- Returns:
The depth.
- property bounding_box_width: int
Get the width of the bounding box around the body.
Right/left axis for the core module.
- Returns:
The width.
- property bounding_box_height: int
Get the height of the bounding box around the body.
Up/down axis for the core module.
- Returns:
The height.
- property num_modules: int
Get the number of modules.
- Returns:
The number of modules.
- property num_bricks: int
Get the number of bricks.
- Returns:
The number of bricks.
- property num_active_hinges: int
Get the number of active hinges.
- Returns:
The number of active hinges.
- property num_filled_bricks: int
Get the number of bricks which have all slots filled with other modules.
- Returns:
The number of bricks.
- property num_filled_active_hinges: int
Get the number of bricks which have all slots filled with other modules.
- Returns:
The number of bricks.
- property num_filled_modules: int
Get the number of modules which have all slots filled with other modules, including the core.
- Returns:
The number of modules.
- property max_potentionally_filled_core_and_bricks: int
Get the maximum number of core and bricks that could potentially be filled with this set of modules if rearranged in an optimal way.
This calculates ‘b_max’ from the paper.
- Returns:
The calculated number.
- property filled_core_and_bricks_proportion: float
Get the ratio between filled cores and bricks and how many that potentially could have been if this set of modules was rearranged in an optimal way.
This calculates ‘branching’ from the paper.
- Returns:
The proportion.
- property num_single_neighbour_modules: int
Get the number of bricks that are only connected to one other module.
Both children and parent are counted.
- Returns:
The number of bricks.
- property max_potential_single_neighbour_modules: int
Get the maximum number of bricks that could potentially have only one neighbour if this set of modules was rearranged in an optimal way.
This calculates “l_max” from the paper.
- Returns:
The calculated number.
- property num_double_neighbour_bricks: int
Get the number of bricks that are connected to exactly two other modules.
Both children and parent are counted.
- Returns:
The number of bricks.
- property num_double_neighbour_active_hinges: int
Get the number of active hinges that are connected to exactly two other modules.
Both children and parent are counted.
- Returns:
The number of active hinges.
- property potential_double_neighbour_bricks_and_active_hinges: int
Get the maximum number of bricks and active hinges that could potentially have exactly two neighbours if this set of modules was rearranged in an optimal way.
This calculates e_max from the paper.
- Returns:
The calculated number.
- property double_neighbour_brick_and_active_hinge_proportion: float
Get the ratio between the number of bricks and active hinges with exactly two neighbours and how many that could potentially have been if this set of modules was rearranged in an optimal way.
This calculate length of limbs proportion(extensiveness) from the paper.
- Returns:
The proportion.
- property bounding_box_volume: int
Get the volume of the bounding box.
This calculates m_area from the paper.
- Returns:
The volume.
- property bounding_box_volume_coverage: float
Get the proportion of the bounding box that is filled with modules.
This calculates ‘coverage’ from the paper.
- Returns:
The proportion.
- property branching: float
Get the ‘branching’ measurement from the paper.
Alias for filled_core_and_bricks_proportion.
- Returns:
Branching measurement.
- property limbs: float
Get the ‘limbs’ measurement from the paper.
Alias for single_neighbour_brick_proportion.
- Returns:
Limbs measurement.
- property length_of_limbs: float
Get the ‘length of limbs’ measurement from the paper.
Alias for double_neighbour_brick_and_active_hinge_proportion.
- Returns:
Length of limbs measurement.
- property coverage: float
Get the ‘coverage’ measurement from the paper.
Alias for bounding_box_volume_coverage.
- Returns:
Coverage measurement.
- property proportion_2d: float
Get the ‘proportion’ measurement from the paper.
Only for 2d robots.
- Returns:
Proportion measurement.
- property symmetry: float
Get the ‘symmetry’ measurement from the paper, but extended to 3d.
- Returns:
Symmetry measurement.
- grid: numpy.typing.NDArray[TModule]
- symmetry_grid: numpy.typing.NDArray[TModule]
Position of the core in ‘body_as_grid’.
- core_grid_position: pyrr.Vector3[numpy.int_]
If the robot is two dimensional, i.e. all module rotations are 0 degrees.
- is_2d: bool
- core: revolve2.modular_robot.body.base.Core
- modules: list[revolve2.modular_robot.body.Module]
- bricks: list[revolve2.modular_robot.body.base.Brick]
- active_hinges: list[revolve2.modular_robot.body.base.ActiveHinge]
If all slots of the core are filled with other modules.
- core_is_filled: bool
Bricks which have all slots filled with other modules.
- filled_bricks: list[revolve2.modular_robot.body.base.Brick]
Active hinges which have all slots filled with other modules.
- filled_active_hinges: list[revolve2.modular_robot.body.base.ActiveHinge]
Modules that only connect to one other module.
This includes children and parents.
- single_neighbour_modules: list[revolve2.modular_robot.body.Module]
Bricks that are only connected to one other module.
Both children and parent are counted.
- single_neighbour_bricks: list[revolve2.modular_robot.body.base.Brick]
Bricks that are connected to exactly two other modules.
Both children and parent are counted.
- double_neighbour_bricks: list[revolve2.modular_robot.body.base.Brick]
Active hinges that are connected to exactly two other modules.
Both children and parent are counted.
- double_neighbour_active_hinges: list[revolve2.modular_robot.body.base.ActiveHinge]
X/Y-plane symmetry according to the paper but in 3D.
X-axis is defined as forward/backward for the core module Y-axis is defined as left/right for the core module.
- xy_symmetry: float
X/Z-plane symmetry according to the paper but in 3D.
X-axis is defined as forward/backward for the core module Z-axis is defined as up/down for the core module.
- xz_symmetry: float
Y/Z-plane symmetry according to the paper but in 3D.
Y-axis is defined as left/right for the core module. Z-axis is defined as up/down for the core module.
- yz_symmetry: float