diff --git a/tests/test_algorithms.py b/tests/test_algorithms.py index ed24c00..cddfdce 100644 --- a/tests/test_algorithms.py +++ b/tests/test_algorithms.py @@ -11,7 +11,7 @@ # Modify the problem generators for fast tests fast_problem_generators = [construct_murder_problem()] # Keep only the smallest problem -problem_generators = [construct_murder_problem(), construct_examtt_simple(), construct_nurse_rostering()] +problem_generators = [construct_murder_problem(), construct_examtt_simple(3,3,3,6), construct_nurse_rostering(3,3,6,1)] classifiers = [DecisionTreeClassifier(), RandomForestClassifier()] algorithms = [ca.QuAcq(), ca.MQuAcq(), ca.MQuAcq2(), ca.MineAcq(), ca.PQuAcq(), ca.GenAcq()] @@ -33,7 +33,6 @@ def _generate_base_inputs(fast=False): for comb in combs: yield comb - def _generate_proba_inputs(fast=False): if fast: combs = product(_generate_fast_benchmarks(), fast_tests_algorithms, [DecisionTreeClassifier()]) # Use minimal combinations @@ -116,6 +115,7 @@ def test_base_algorithms_with_initial_cl(self, bench, algorithm): (instance, oracle) = bench # Create a copy of the instance to avoid modifying the original instance = instance.copy() + env = ca.ActiveCAEnv() # Get some constraints from the oracle's constraint set initial_constraints = oracle.constraints[:len(oracle.constraints)//2] # Take half of the constraints @@ -123,6 +123,7 @@ def test_base_algorithms_with_initial_cl(self, bench, algorithm): initial_cl_size = len(instance.cl) ca_system = algorithm + ca_system.env = env learned_instance = ca_system.learn(instance=instance, oracle=oracle) assert ca_system.env.metrics.converged assert learned_instance.get_cpmpy_model().solve() @@ -162,7 +163,8 @@ def test_base_algorithms_with_bias(self, bench, algorithm): (instance, oracle) = bench # Create a copy of the instance to avoid modifying the original instance = instance.copy() - + env = ca.ActiveCAEnv() + # Generate bias constraints for the instance instance.construct_bias() # Separate constraints into those from oracle and others @@ -172,6 +174,7 @@ def test_base_algorithms_with_bias(self, bench, algorithm): instance.bias = list(oracle_constraints) + other_constraints[:len(other_constraints)//2] ca_system = algorithm + ca_system.env = env learned_instance = ca_system.learn(instance=instance, oracle=oracle) assert len(learned_instance.cl) > 0 assert learned_instance.get_cpmpy_model().solve() diff --git a/tests/test_finc.py b/tests/test_findc.py similarity index 100% rename from tests/test_finc.py rename to tests/test_findc.py