def call_planner(domain_in, problem_in):

    from driver.main import main
    from tempfile import mkdtemp
    from shutil import rmtree
    from os import path

    tmpdir = mkdtemp()

    domain_file = path.join(tmpdir, 'domain.pddl')
    problem_file = path.join(tmpdir, 'problem.pddl')
    copyfile(domain_in, domain_file)
    copyfile(problem_in, problem_file)
    plan_file = path.join(tmpdir, 'plan.out')

    try:
        log = main(["--plan-file", plan_file, "--cwd", tmpdir, problem_file, "--search", "astar(ff)"])
        with open(plan_file, "r") as text_file:
            p = text_file.read()
        return True, log, p

    except (CalledProcessError) as e:
        return False, e.output, "no plan due to error. check logs"
    except (RuntimeError, OSError) as e:
        return False, str(e), "no plan due to error. check logs"
    finally:
        rmtree(tmpdir, ignore_errors=True)

    return False, "This contains the logs", "This shall be the plan"
#! /usr/bin/env python
# -*- coding: utf-8 -*-

############################################################################
##    This file is part of OMTPlan.
##
##    OMTPlan is free software: you can redistribute it and/or modify
##    it under the terms of the GNU General Public License as published by
##    the Free Software Foundation, either version 3 of the License, or
##    (at your option) any later version.
##
##    OMTPlan is distributed in the hope that it will be useful,
##    but WITHOUT ANY WARRANTY; without even the implied warranty of
##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##    GNU General Public License for more details.
##
##    You should have received a copy of the GNU General Public License
##    along with OMTPlan.  If not, see <https://www.gnu.org/licenses/>.
############################################################################

import os

BASE_DIR = os.path.dirname(os.path.realpath(__file__))

if __name__ == "__main__":
    from driver.main import main
    main(BASE_DIR)
Exemple #3
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    from driver.main import main
    main()
#! /usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    # import os

    # import build

    from driver.main import main

    # config = build.load_build_configs(os.path.dirname(__file__))
    # main(release_build=config.pop("DEFAULT"), debug_build=config.pop("DEBUG"))
    main(release_build="release64dynamic", debug_build="debug64dynamic")
Exemple #5
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys

if __name__ == "__main__":
    from driver.main import main
    main(sys.argv[1:])
#! /usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    from driver.main import main

    main()
Exemple #7
0
from load_config.load_config import load_config
from logic.GOLBoard import GOLBoard
from driver.main import main

if __name__ == "__main__":
    seed, universe_size, num_iter, seed_pos, interval, CELL_SIZE = load_config()

    board = GOLBoard(
        universe_size=(
            int(universe_size[0]),
            int(universe_size[1]),
        ),
        seed=seed,
        seed_position=(
            int(seed_pos[0]),
            int(seed_pos[1]),
        ),
        n_generations=num_iter,
        interval=interval,
        CELL_SIZE=CELL_SIZE
    )

    main(board, CELL_SIZE)