Samplers¶
Samplers control how candidate configurations are generated for roadmap expansion. Changing the sampler can significantly affect solver speed and solution quality.
Typical usage¶
from discopygal.solvers_infra.samplers import Sampler_Uniform
sampler = Sampler_Uniform(scene)
sample = sampler.sample()
See also¶
- class discopygal.solvers_infra.samplers.Sampler(scene: Scene = None)¶
Abstract class for sampling methods in the scene.
- Parameters:
scene (
Scene) – a scene to sample in
- class discopygal.solvers_infra.samplers.SamplerWithAngle(scene: Scene = None)¶
Uniform sampler of random point and angle (for rotation)
- class discopygal.solvers_infra.samplers.Sampler_Elliptical(scene: Scene = None)¶
Elliptical sampler in the scene
- Parameters:
scene (
Scene) – a scene to sample in
- sample()¶
Return a sample in the space (might be invalid)
- Returns:
sampled point
- Return type:
- class discopygal.solvers_infra.samplers.Sampler_Uniform(scene: Scene = None)¶
Uniform sampler in the scene
- Parameters:
scene (
Scene) – a scene to sample in
- sample() Point_2¶
Return a sample in the space (might be invalid)
- Returns:
sampled point
- Return type:
- set_bounds_manually(min_x: FT, max_x: FT, min_y: FT, max_y: FT) None¶
Set the sampling bounds manually (instead of supplying a scene) Bounds are given in CGAL
FT
- set_scene(scene: Scene, bounding_box: BoundingBox = None) None¶
Set the scene the sampler should use. Can be overridded to add additional processing.
- Parameters:
scene (
Scene) – a scene to sample in
:param