moptipyapps.tests package¶
Unit tests that you can use to check your moptipyapps based experiments.
moptipyapps.tests.on_binpacking2d
contains tests on the two-dimensional bin packing problem.
Submodules¶
moptipyapps.tests.on_binpacking2d module¶
Perform tests on the Two-Dimensional Bin Packing Problem.
- moptipyapps.tests.on_binpacking2d.binpacking_instances_for_tests(random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Get a sequence of 2D Bin Packing instances to test on.
- moptipyapps.tests.on_binpacking2d.make_packing_invalid(random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Make a function that creates invalid packings.
- moptipyapps.tests.on_binpacking2d.make_packing_valid(inst, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Make a function that creates valid packings.
- moptipyapps.tests.on_binpacking2d.validate_algorithm_on_1_2dbinpacking(algorithm, instance=None, max_fes=100, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Check the validity of a black-box algorithm on the 2d bin packing.
- Parameters:
algorithm (
Union
[Algorithm
,Callable
[[Instance
,SignedPermutations
,Objective
],Algorithm
]]) – the algorithm or algorithm factoryinstance (
str
|None
, default:None
) – the instance name, or None to randomly pick onemax_fes (
int
, default:100
) – the maximum number of FEsrandom (
Generator
, default:Generator(PCG64) at 0x7F2D51E91B60
) – the default random generator to use
- Return type:
- moptipyapps.tests.on_binpacking2d.validate_algorithm_on_2dbinpacking(algorithm, max_fes=100, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Validate an algorithm on a set of bin packing instances.
- moptipyapps.tests.on_binpacking2d.validate_objective_on_1_2dbinpacking(objective, instance=None, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Validate an objective function on 1 2D bin packing instance.
- moptipyapps.tests.on_binpacking2d.validate_objective_on_2dbinpacking(objective, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Validate an objective function on bin packing instances.
- moptipyapps.tests.on_binpacking2d.validate_signed_permutation_encoding_on_1_2dbinpacking(encoding, instance=None, random=Generator(PCG64) at 0x7F2D51E91B60)[source]¶
Validate a signed permutation encoding on one 2D bin packing instance.
moptipyapps.tests.on_tsp module¶
Perform tests on the Traveling Salesperson Problem.
- moptipyapps.tests.on_tsp.tsp_instances_for_tests(random=Generator(PCG64) at 0x7F2D51E93A00, symmetric=True, asymmetric=True)[source]¶
Get a sequence of TSP instances to test on.
- Parameters:
- Return type:
- Returns:
an iterable of TSP instance names
- moptipyapps.tests.on_tsp.validate_algorithm_on_1_tsp(algorithm, instance=None, max_fes=256, random=Generator(PCG64) at 0x7F2D51E93A00)[source]¶
Check the validity of a black-box algorithm on one TSP instance.
- Parameters:
algorithm (
Union
[Algorithm
,Callable
[[Instance
,Permutations
],Algorithm
]]) – the algorithm or algorithm factoryinstance (
str
|None
, default:None
) – the instance name, or None to randomly pick onemax_fes (
int
, default:256
) – the maximum number of FEsrandom (
Generator
, default:Generator(PCG64) at 0x7F2D51E93A00
) – the default random generator to use
- Return type:
- moptipyapps.tests.on_tsp.validate_algorithm_on_tsp(algorithm, symmetric=True, asymmetric=True, max_fes=256, random=Generator(PCG64) at 0x7F2D51E93A00)[source]¶
Validate an algorithm on a set of TSP instances.
- Parameters:
algorithm (
Callable
[[Instance
,Permutations
],Algorithm
]) – the algorithm factorysymmetric (
bool
, default:True
) – include symmetric instancesasymmetric (
bool
, default:True
) – include asymmetric instancesmax_fes (
int
, default:256
) – the maximum FEsrandom (
Generator
, default:Generator(PCG64) at 0x7F2D51E93A00
) – the random number generator
- Return type:
- moptipyapps.tests.on_tsp.validate_objective_on_1_tsp(objective, instance=None, random=Generator(PCG64) at 0x7F2D51E93A00)[source]¶
Validate an objective function on 1 TSP instance.
- moptipyapps.tests.on_tsp.validate_objective_on_tsp(objective, symmetric=True, asymmetric=True, random=Generator(PCG64) at 0x7F2D51E93A00)[source]¶
Validate an objective function on TSP instances.
- Parameters:
objective (
Union
[Objective
,Callable
[[Instance
],Objective
]]) – the objective function or a factory creating itsymmetric (
bool
, default:True
) – include symmetric instancesasymmetric (
bool
, default:True
) – include asymmetric instancesrandom (
Generator
, default:Generator(PCG64) at 0x7F2D51E93A00
) – the random number generator
- Return type: