Beispiel #1
0
def experiments():
    base = dict(
        domain_dir="visitall-opt11-strips",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=visitall_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=[
            'problem03-full.pddl',
            # 'problem04-full.pddl',
            # 'problem05-full.pddl',
        ],
        test_instances=[],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        distance_feature_max_complexity=8,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    exps["debug"] = update_dict(
        base,
        instances=[
            # 'problem02-full.pddl',
            # 'problem03-full.pddl',
            "tests.pddl",
        ],
        test_instances=[
            # 'problem03-full.pddl',
            # 'problem04-full.pddl',
        ],
        # test_policy_instances=all_test_instances(),

        # max_concept_size=8,
        # distance_feature_max_complexity=8,
        # cond_feature_max_complexity=8,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        # use_incremental_refinement=True,
        print_denotations=True,
        feature_generator=debug_features,
    )

    return exps
Beispiel #2
0
def experiments():
    base = dict(
        domain_dir="log_one_truck",
        domain="domain-onetr_without_restrictions.pddl",
        test_domain="domain-onetr_without_restrictions.pddl",
        feature_namer=logistics_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    # Goal: arbitrary logistics goal
    exps["small"] = update_dict(
        base,
        instances=['probLOGISTICS-1-1.pddl'],
        # test_instances=["prob{:02d}.pddl".format(i) for i in range(2, 5)],
        test_instances=[],
        test_policy_instances=['probLOGISTICS-4-2.pddl'],  # all_instances(),
        distance_feature_max_complexity=8,
        max_concept_size=8,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    return exps
Beispiel #3
0
def experiments():
    base = dict(
        domain_dir="floortile-opt11-strips",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=floortile_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=["training1.pddl"],
        # instances=["testing.pddl"],
        test_instances=[],
        test_policy_instances=["opt-p01-002.pddl"],
        max_concept_size=8,
        distance_feature_max_complexity=8,
        parameter_generator=None,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    return exps
Beispiel #4
0
def experiments():
    base = dict(
        domain_dir="satellite",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=satellite_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=[
            'p01-pfile1.pddl',
            'p02-pfile2.pddl',
        ],
        test_instances=[],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        parameter_generator=None,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        # use_incremental_refinement=True,
    )

    return exps
Beispiel #5
0
def setup_workspace(config, sample, k):
    """ Create the workspace and update the config for the incremental search with the given parameters """
    # Create a subdir, e.g. inc_k5_s20, to place all the data for this learning attempt
    subdir = os.path.join(config.experiment_dir, "inc_k{}_s{}".format(k, sample.num_states()))
    os.makedirs(subdir, exist_ok=True)
    save(subdir, dict(sample=sample))
    log_sampled_states(sample, os.path.join(subdir, "sample.txt"))
    logging.info("Search for abstraction: |S|={}, k=|{}|".format(sample.num_states(), k))
    logging.info("Data stored in {}".format(subdir))
    subconfig = update_dict(config.to_dict(), max_concept_size=k, experiment_dir=subdir)
    return subconfig
Beispiel #6
0
def experiments():
    base = dict(
        domain_dir="reward",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=reward_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=["training_5x5.pddl"],
        # instances=["instance_5.pddl", "instance_4_blocked.pddl"],
        test_instances=[],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        distance_feature_max_complexity=8,
        parameter_generator=no_parameter,
        # parameter_generator=None
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    exps["debug"] = update_dict(exps["small"],
                                feature_generator=debug_features)

    # One reason for overfitting: in a 3x3 grid, with 2 booleans per dimension you can perfectly represent any position

    return exps
Beispiel #7
0
def experiments():
    base = dict(
        domain_dir="childsnack-opt14-strips",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=childsnack_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        # instances=['sample{:02d}.pddl'.format(i) for i in range(1, 5)],
        instances=[
            # 'sample_mini.pddl',
            'sample01.pddl',
            'sample02.pddl',
            # 'sample03.pddl',

            # 'child-snack_pfile01-2.pddl'  # STATE SPACE TOO LARGE
        ],
        test_instances=[
            # 'child-snack_pfile01-2.pddl',
        ],
        test_policy_instances=all_test_instances(),

        # create_goal_features_automatically=True,
        max_concept_size=10,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    return exps
Beispiel #8
0
def experiments():
    base = dict(
        domain_dir="gridworld",
        domain="domain_strips.pddl",
        test_domain="domain_strips.pddl",
        feature_namer=gridworld_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
    )

    exps = dict()

    # 3x3 overfits: in a 3x3 grid, with 2 booleans per dimension you can represent the position

    exps["5x5"] = update_dict(
        base,
        instances=[
            "instance_strips_5.pddl",
            "instance_strips_5_not_corner.pddl",
            "instance_strips_5_not_corner_2.pddl",
        ],
        test_instances=[],
        test_policy_instances=[],
        max_concept_size=8,
        distance_feature_max_complexity=8,

        # parameter_generator=gripper_parameters,  # Works also, but no real advantage
        parameter_generator=add_domain_parameters_strips,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        # use_incremental_refinement=True,

        # feature_generator=generate_features_1,
    )

    return exps
Beispiel #9
0
def experiments():
    base = dict(
        domain_dir="gripper",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=gripper_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,

        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        # instances=["sample-2balls.pddl", "sample-small.pddl"],
        instances=["prob01.pddl"],
        # test_instances=[f"prob{i:02d}.pddl" for i in range(3, 11)],
        test_instances=[],
        test_policy_instances=[f"prob{i:02d}.pddl" for i in range(3, 21)],

        max_concept_size=8,
        distance_feature_max_complexity=8,

        # parameter_generator=gripper_parameters,  # Works also, but no real advantage
        parameter_generator=None,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    return exps
Beispiel #10
0
def experiments():
    base = dict(
        domain_dir="delivery",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=delivery_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=[
            'instance_3_3_0.pddl',  # Use one small instance with three packages
            'instance_4_2_0.pddl',  # And a slightly larger one with two packages
            # 'instance_5_0.pddl',
        ],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        distance_feature_max_complexity=14,

        # feature_generator=debug_features,
        # d2l_policy=debug_policy,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
        # print_denotations=True,
    )

    return exps
Beispiel #11
0
def experiments():
    base = dict(
        domain_dir="barman-opt11-strips",
        domain="domain.pddl",
        test_domain="domain.pddl",
        feature_namer=barman_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=[
            'sample01.pddl',
        ],
        test_instances=[
            # 'child-snack_pfile01-2.pddl',
        ],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        distance_feature_max_complexity=8,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    return exps
Beispiel #12
0
def experiments():
    base = dict(
        domain_dir="blocks",
        feature_namer=blocksworld_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,
        test_instances=[],

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    strips_base = update_dict(
        base,
        domain="domain.pddl",
        test_domain="domain.pddl",
    )

    fn_base = update_dict(
        base,
        domain="domain_fstrips.pddl",
        test_domain="domain_fstrips.pddl",
    )

    strips_atomic_base = update_dict(
        base,
        domain="domain_atomic_move.pddl",
        test_domain="domain_atomic_move.pddl",
    )

    exps["clear"] = update_dict(
        strips_base,
        instances=["training_clear_5.pddl"],
        test_policy_instances=all_clear_test_instancess(),
        max_concept_size=8,
        parameter_generator=blocksworld_parameters_for_clear,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,

        # feature_generator=debug_features_clear,
    )

    exps["clear_fn"] = update_dict(
        fn_base,
        instances=["training_clear_5_fs.pddl"],
        test_policy_instances=[],
        max_concept_size=8,
        parameter_generator=blocksworld_parameters_for_clear,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    exps["on"] = update_dict(
        strips_base,
        instances=[
            "training_on_5.pddl",
        ],
        test_policy_instances=all_on_test_instancess(),
        max_concept_size=8,
        distance_feature_max_complexity=8,
        parameter_generator=blocksworld_parameters_for_on,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    exps["on_fn"] = update_dict(
        fn_base,
        instances=["training_on_5_fs.pddl"],
        test_policy_instances=[],
        max_concept_size=8,
        parameter_generator=blocksworld_parameters_for_on,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
    )

    exps["4op_5"] = update_dict(
        strips_base,
        instances=["probBLOCKS-5-0.pddl"],
        test_instances=[],
        test_policy_instances=all_4op_test_instances(),
        max_concept_size=12,
        use_incremental_refinement=True,
        use_equivalence_classes=True,
        use_feature_dominance=False,
    )

    exps["4op_debug"] = update_dict(
        exps["4op_5"],
        instances=["probBLOCKS-4-0.pddl"],

        # d2l_policy=debug_policy_4op,
        feature_generator=debug_features_4op,
        use_incremental_refinement=False,
        use_equivalence_classes=True,
        use_feature_dominance=False,
    )

    exps["all_fn_5"] = update_dict(
        fn_base,
        instances=[
            "training_arbitrary_5_fs.pddl",
            # "training_singletower_5_fs.pddl",
        ],
        test_policy_instances=[],
        max_concept_size=10,
        use_incremental_refinement=False,
        use_equivalence_classes=True,
        use_feature_dominance=False,

        # feature_generator=fs_debug_features,
        # d2l_policy=fs_debug_policy
    )

    exps["all_at_5"] = update_dict(
        strips_atomic_base,
        instances=[
            "training_arbitrary_5_atomic.pddl",
            "training_arbitrary_5_atomic_tower.pddl"
        ],
        test_policy_instances=[
            "training_arbitrary_5_atomic.pddl",
        ] + [
            f"test_atomic_{n}_{i}.pddl" for n in range(10, 31)
            for i in range(0, 5)
        ],
        max_concept_size=8,
        distance_feature_max_complexity=8,

        # feature_generator=debug_features_at,
        use_incremental_refinement=True,
        use_equivalence_classes=True,
        use_feature_dominance=False,
    )

    # Using incompletely-specified goals
    exps["all_at_5_inc"] = update_dict(
        exps["all_at_5"],
        instances=[
            "training_arbitrary_5_atomic_incomplete.pddl",
        ],
    )

    exps["all_at_testing"] = update_dict(
        strips_atomic_base,
        instances=[
            "training_arbitrary_5_atomic.pddl",
        ],
        test_policy_instances=[
            "training_arbitrary_5_atomic.pddl",
            "testing_arbitrary_10_atomic.pddl",
            "testing_arbitrary_10_1_atomic.pddl",
            "testing_arbitrary_17-0_atomic.pddl",
            "testing_arbitrary_17-1_atomic.pddl",
        ],
        feature_generator=debug_features_at2,
        use_incremental_refinement=False,
        use_equivalence_classes=True,
        use_feature_dominance=False,
    )

    return exps
Beispiel #13
0
def experiments():
    base = dict(
        domain_dir="miconic",
        # domain="domain.pddl",
        # test_domain="domain.pddl",

        # Without the fix, the "board" action allows to board passengers that are not on the floor anymore!
        test_domain="domain-with-fix.pddl",
        domain="domain-with-fix.pddl",
        feature_namer=miconic_names,
        pipeline="d2l_pipeline",
        maxsat_encoding="d2l",
        num_states="all",
        concept_generator=None,
        parameter_generator=None,
        v_slack=2,

        # concept_generation_timeout=120,  # in seconds
        maxsat_timeout=None,
        distinguish_goals=True,
    )

    exps = dict()

    exps["small"] = update_dict(
        base,
        instances=[
            # 's2-0.pddl',
            # 's2-1.pddl',
            # 's2-2.pddl',
            # 's2-3.pddl',
            # 's3-0.pddl',
            's4-0.pddl',
            'training2.pddl',
        ],
        test_instances=[],
        test_policy_instances=all_test_instances(),
        max_concept_size=8,
        distance_feature_max_complexity=8,
        parameter_generator=None,
        use_equivalence_classes=True,
        # use_feature_dominance=True,
        use_incremental_refinement=True,
        decreasing_transitions_must_be_good=True,
    )

    exps["small2"] = update_dict(
        exps["small"],
        instances=[
            's3-0.pddl',
            'training2.pddl',
        ],
        use_incremental_refinement=False,
    )

    exps["debug"] = update_dict(
        exps["small"],
        instances=[
            # 'debug.pddl',
            's4-0.pddl',
            'training2.pddl',
        ],
        feature_generator=debug_features,
        # d2l_policy=debug_policy,
        print_denotations=True,
        use_incremental_refinement=False,
        test_policy_instances=all_test_instances(),
        # test_policy_instances=[
        #     's4-0.pddl',
        # ]
    )

    return exps
Beispiel #14
0
def experiment(experiment_name=None):
    domain = "domain.pddl"
    domain_dir = "visitall"
    benchmark_dir = BENCHMARK_DIR
    # domain_dir = "gripper"

    problem02full = dict(
        lp_max_weight=10,
        benchmark_dir=benchmark_dir,
        instances=["problem02-full.pddl"],  #, "problem03-full.pddl"],
        test_instances=["problem04-full.pddl"],
        test_domain=domain,
        distance_feature_max_complexity=10,
        num_states=500,
        num_sampled_states=None,
        random_seed=12,
        max_concept_size=8,
        max_concept_grammar_iterations=3,
        concept_generator=None,
        parameter_generator=add_domain_parameters,
        feature_namer=feature_namer,
    )

    problem03full = dict(
        lp_max_weight=2,
        benchmark_dir=benchmark_dir,
        instances=["problem02-full.pddl", "problem03-full.pddl"],
        test_instances=[
            "problem04-full.pddl",
            "problem05-full.pddl",
            "problem06-full.pddl",
            "problem07-full.pddl",
            "problem08-full.pddl",
            "problem09-full.pddl",
            "problem10-full.pddl",
            "problem11-full.pddl",
        ],
        test_domain=domain,
        distance_feature_max_complexity=10,
        num_states=1000,
        num_sampled_states=None,
        random_seed=12,
        max_concept_size=8,
        max_concept_grammar_iterations=3,
        concept_generator=None,
        parameter_generator=add_domain_parameters,
        feature_namer=feature_namer,
    )

    # Incremental version
    # Experiment used in the paper
    problem03full_incremental = dict(
        benchmark_dir=BENCHMARK_DIR,
        lp_max_weight=5,
        experiment_class=IncrementalExperiment,
        test_domain=domain,
        instances=[
            'training01.pddl',
            'training02.pddl',
            'training03.pddl',
            'training04.pddl',
            'training05.pddl',
            'training06.pddl',
            'training09.pddl',
            'training10.pddl',
            'training11.pddl',
        ],
        test_instances=[
            "problem02-full.pddl",
            "problem03-full.pddl",
            "problem04-full.pddl",
            "problem05-full.pddl",
            "problem06-full.pddl",
            "problem07-full.pddl",
            "problem08-full.pddl",
            "problem09-full.pddl",
            "problem10-full.pddl",
            "problem11-full.pddl",
            'p-1-10.pddl',
            'p-1-11.pddl',
            'p-1-12.pddl',
            'p-1-13.pddl',
            'p-1-14.pddl',
            'p-1-15.pddl',
            'p-1-16.pddl',
            'p-1-17.pddl',
            'p-1-18.pddl',
            'p-1-5.pddl',
            'p-1-6.pddl',
            'p-1-7.pddl',
            'p-1-8.pddl',
            'p-1-9.pddl',
        ],
        num_states=10000,
        initial_sample_size=100,
        distance_feature_max_complexity=5,
        max_concept_grammar_iterations=10,
        initial_concept_bound=8,
        max_concept_bound=12,
        concept_bound_step=2,
        batch_refinement_size=50,
        clean_workspace=False,
        parameter_generator=add_domain_parameters,
        feature_namer=feature_namer,
    )

    guillem = update_dict(problem03full_incremental,
                          feature_generator=build_expected_features)

    visitall_incremental = dict(
        benchmark_dir=BENCHMARK_DIR,
        lp_max_weight=100,
        experiment_class=IncrementalExperiment,
        test_domain=domain,
        instances=[
            'training01.pddl',
            'training02.pddl',
            'training03.pddl',
            'training04.pddl',
            'training05.pddl',
            'training06.pddl',
            'training09.pddl',
            'training10.pddl',
            'training11.pddl',
        ],
        test_instances=[
            "problem02-full.pddl",
            "problem02-half.pddl",
            "problem03-full.pddl",
            "problem03-half.pddl",
            'problem02-full.pddl',
            'problem02-half.pddl',
            'problem03-full.pddl',
            'problem03-half.pddl',
            'problem04-full.pddl',
            'problem04-half.pddl',
            'problem05-full.pddl',
            'problem05-half.pddl',
            'problem06-full.pddl',
            'problem06-half.pddl',
            'problem07-full.pddl',
            'problem07-half.pddl',
            'problem08-full.pddl',
            'problem08-half.pddl',
            'problem09-full.pddl',
            'problem09-half.pddl',
            'problem10-full.pddl',
            'problem10-half.pddl',
            'problem11-full.pddl',
            'problem11-half.pddl',
            "problem04-full.pddl",
        ],
        num_states=35000,
        initial_sample_size=100,
        distance_feature_max_complexity=5,
        max_concept_grammar_iterations=3,
        initial_concept_bound=10,
        max_concept_bound=12,
        concept_bound_step=2,
        batch_refinement_size=10,
        clean_workspace=False,
        parameter_generator=add_domain_parameters,
        feature_namer=feature_namer,
    )

    parameters = {
        "problem02full": problem02full,
        "problem03full": problem03full,
        "problem03full_incremental": problem03full_incremental,
        "guillem": guillem,
        "visitall_incremental": visitall_incremental,
    }.get(experiment_name or "test")

    return generate_experiment(domain_dir, domain, **parameters)