Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- from subprocess import getstatusoutput as cmd
- # from encode import *
- def solve(pathToLevel):
- cmd("python encode.py " + pathToLevel + " > problem.pddl")
- start_time = time.time()
- cmd("./M -r 400 -Q domain.pddl problem.pddl > plan")
- execution_time = time.time() - start_time
- cmd("python plan2rotations.py plan")
- res = cmd("python validate_rotations.py " + pathToLevel +
- " plan-rotations")
- # print(res[1])
- if execution_time > 399:
- execution_time = -2
- elif "plan is valid" not in res[1]:
- execution_time = -1
- return execution_time
- # def is_st_fixed(pathToLevel):
- # level = parseInput(pathToLevel)
- # level = fix(level)
- # flag = printFixed(level)
- # return flag
- def main():
- f = open("instances", "r")
- all = True
- for level in f:
- level = level.strip()
- print("| " + level + " | ", end="")
- print(str(solve(level)) + " |")
- # print()
- # if is_st_fixed(level):
- # print("X")
- # else:
- # all = False
- # print("O")
- # if all:
- # print("jeah")
- # else:
- # print("neig")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement