├── SMTPlan ├── src │ ├── SMTPlanConfig.h.in │ └── VALfiles │ │ ├── src │ │ ├── FastEnvironment.cpp │ │ ├── HowWhatWhenMain.cpp │ │ ├── ToFnMain.cpp │ │ ├── HowAnalyser.cpp │ │ ├── Environment.cpp │ │ ├── PingusTranslator.cpp │ │ ├── SearchSpace.cpp │ │ ├── instantiationMain.cpp │ │ ├── Utils.cpp │ │ ├── dynaMain.cpp │ │ ├── InstPropLinker.cpp │ │ ├── CausalGraph.cpp │ │ ├── random.cpp │ │ ├── parse.cpp │ │ ├── Analysis.cpp │ │ ├── TypedAnalysis.cpp │ │ ├── FuncExp.cpp │ │ ├── SASActions.cpp │ │ ├── TypeStrip.cpp │ │ ├── Relax.cpp │ │ ├── DYNA.cpp │ │ ├── LPGP.cpp │ │ ├── TIMMain.cpp │ │ ├── Parser │ │ │ └── pddl+.lex │ │ └── pddl+.lex │ │ └── include │ │ ├── OptInterface.h │ │ ├── TIM.h │ │ ├── StateObserver.h │ │ ├── InstPropLinker.h │ │ ├── GoalHypSpace.h │ │ ├── Agents.h │ │ ├── CausalGraph.h │ │ ├── oldCausalGraph.h │ │ ├── sStack.h │ │ ├── main.h │ │ ├── macros.h │ │ ├── TIMUtilities.h │ │ ├── Utils.h │ │ ├── Evaluator.h │ │ ├── Ownership.h │ │ ├── SearchSpace.h │ │ ├── PinguPlanGenerator.h │ │ ├── PartialPlan.h │ │ ├── parse_error.h │ │ ├── AbstractGraph.h │ │ ├── Environment.h │ │ ├── Partitions.h │ │ ├── PrettyPrinter.h │ │ ├── LaTeXSupport.h │ │ ├── FuncExp.h │ │ └── DebugWriteController.h ├── include │ └── SMTPlan │ │ ├── ProblemInfo.h │ │ ├── PlannerOptions.h │ │ ├── Encoder.h │ │ └── Algebraist.h ├── README.md ├── cmake_modules │ ├── FindGMP.cmake │ └── FindMPFR.cmake └── CMakeLists.txt ├── benchmarks ├── generator_linear │ ├── gen_linear_prob01.pddl │ ├── gen_linear_prob02.pddl │ ├── gen_linear_prob03.pddl │ ├── gen_linear_prob04.pddl │ ├── gen_linear_prob05.pddl │ ├── gen_linear_prob06.pddl │ ├── gen_linear_prob07.pddl │ ├── gen_linear_prob08.pddl │ └── gen_linear_domain.pddl ├── generator_nonlinear │ ├── gen_nonlinear_prob01.pddl │ ├── gen_nonlinear_prob02.pddl │ ├── gen_nonlinear_prob03.pddl │ ├── gen_nonlinear_prob04.pddl │ ├── gen_nonlinear_prob05.pddl │ ├── gen_nonlinear_prob06.pddl │ ├── gen_nonlinear_prob07.pddl │ ├── gen_nonlinear_prob08.pddl │ └── gen_nonlinear_domain.pddl ├── generator_events │ ├── gen_events_prob01.pddl │ ├── gen_events_prob02.pddl │ ├── gen_events_prob03.pddl │ ├── gen_events_prob04.pddl │ ├── gen_events_prob05.pddl │ ├── gen_events_prob06.pddl │ ├── gen_events_prob07.pddl │ ├── gen_events_prob08.pddl │ └── gen_events_domain.pddl ├── car_nodrag │ ├── car_prob01.pddl │ ├── car_prob02.pddl │ ├── car_prob03.pddl │ ├── car_prob04.pddl │ ├── car_prob05.pddl │ ├── car_prob06.pddl │ ├── car_prob07.pddl │ ├── car_prob08.pddl │ ├── car_prob09.pddl │ ├── car_prob10.pddl │ └── car_domain_nodrag.pddl └── generator_toricelli │ ├── gen_toricelli_prob01.pddl │ ├── gen_toricelli_prob02.pddl │ ├── gen_toricelli_prob03.pddl │ ├── gen_toricelli_prob04.pddl │ ├── gen_toricelli_prob05.pddl │ ├── gen_toricelli_prob06.pddl │ ├── gen_toricelli_prob07.pddl │ ├── gen_toricelli_prob08.pddl │ ├── gen_toricelli_prob09.pddl │ └── gen_toricelli_domain.pddl ├── .gitignore └── README.md /SMTPlan/src/SMTPlanConfig.h.in: -------------------------------------------------------------------------------- 1 | // the configured options and settings for SMTPlan 2 | #define SMTPlan_VERSION_MAJOR @SMTPlan_VERSION_MAJOR@ 3 | #define SMTPlan_VERSION_MINOR @SMTPlan_VERSION_MINOR@ 4 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob01.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 - tank) 4 | (:init 5 | (= (fuelLevel gen) 990) 6 | (= (capacity gen) 1000) 7 | (available tank1) 8 | ) 9 | (:goal (generator-ran)) 10 | ) 11 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob02.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 - tank) 4 | (:init (= (fuelLevel gen) 980) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | ) 9 | (:goal (generator-ran)) 10 | ) 11 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob01.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 - tank) 4 | (:init (= (fuelLevel gen) 967) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | 9 | (= (ptime tank1) 0) 10 | ) 11 | (:goal (generator-ran)) 12 | ) -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob03.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 - tank) 4 | (:init (= (fuelLevel gen) 960) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | ) 10 | (:goal (generator-ran)) 11 | ) 12 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob01.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 - tank) 4 | (:init 5 | (= (fuelLevel gen) 980) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | 10 | (available tank1) 11 | 12 | (safe gen) 13 | ) 14 | (:goal (generator-ran)) 15 | ) 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | SMTPlan/build 2 | 3 | # Compiled Object files 4 | *.slo 5 | *.lo 6 | *.o 7 | *.obj 8 | 9 | # Precompiled Headers 10 | *.gch 11 | *.pch 12 | 13 | # Compiled Dynamic libraries 14 | *.so 15 | *.dylib 16 | *.dll 17 | 18 | # Fortran module files 19 | *.mod 20 | 21 | # Compiled Static libraries 22 | *.lai 23 | *.la 24 | *.a 25 | *.lib 26 | 27 | # Executables 28 | *.exe 29 | *.out 30 | *.app 31 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob04.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 - tank) 4 | (:init (= (fuelLevel gen) 940) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | (available tank4) 10 | ) 11 | (:goal (generator-ran)) 12 | ) 13 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob02.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 - tank) 4 | (:init (= (fuelLevel gen) 940) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | 10 | (= (ptime tank1) 0) 11 | (= (ptime tank2) 0) 12 | ) 13 | (:goal (generator-ran)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob01.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 1) 8 | (= (down_limit) -1) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0) 12 | ) 13 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 14 | (:metric minimize(total-time)) 15 | ) 16 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob05.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 - tank) 4 | (:init (= (fuelLevel gen) 920) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | (available tank4) 10 | (available tank5) 11 | ) 12 | (:goal (generator-ran)) 13 | ) 14 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob02.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 - tank) 4 | (:init 5 | (= (fuelLevel gen) 940) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | 11 | (available tank1) 12 | (available tank2) 13 | 14 | (safe gen) 15 | ) 16 | (:goal (generator-ran)) 17 | ) 18 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob01.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 - tank) 4 | (:init 5 | (= ( gen_fuel_level generator) 980) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= (runtime) 1000)) 11 | (:goal (generator_ran generator)) 12 | (:metric minimize ( total-time )) 13 | ) 14 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob06.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 - tank) 4 | (:init (= (fuelLevel gen) 900) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | (available tank4) 10 | (available tank5) 11 | (available tank6) 12 | ) 13 | (:goal (generator-ran)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob03.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 - tank) 4 | (:init (= (fuelLevel gen) 900) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | 11 | (= (ptime tank1) 0) 12 | (= (ptime tank2) 0) 13 | (= (ptime tank3) 0) 14 | ) 15 | (:goal (generator-ran)) 16 | ) 17 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob02.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 2) 8 | (= (down_limit) -2) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob03.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 3) 8 | (= (down_limit) -3) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob04.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 4) 8 | (= (down_limit) -4) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob05.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 5) 8 | (= (down_limit) -5) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob06.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 6) 8 | (= (down_limit) -6) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob07.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 7) 8 | (= (down_limit) -7) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob08.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 8) 8 | (= (down_limit) -8) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob09.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 9) 8 | (= (down_limit) -9) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_prob10.pddl: -------------------------------------------------------------------------------- 1 | (define (problem car_prob) 2 | (:domain car) 3 | (:init (not (engineBlown)) 4 | (running) 5 | (transmission_fine) 6 | (= (running_time) 0) 7 | (= (up_limit) 10) 8 | (= (down_limit) -10) 9 | (= d 0) 10 | (= a 0) 11 | (= v 0)) 12 | (:goal (and (goal_reached) (not(engineBlown)) (<= (running_time) 50) (transmission_fine) )) 13 | (:metric minimize(total-time)) 14 | ) 15 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob07.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 - tank) 4 | (:init (= (fuelLevel gen) 880) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | (available tank4) 10 | (available tank5) 11 | (available tank6) 12 | (available tank7) 13 | ) 14 | (:goal (generator-ran)) 15 | ) 16 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob03.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 - tank) 4 | (:init 5 | (= (fuelLevel gen) 900) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | 12 | (available tank1) 13 | (available tank2) 14 | (available tank3) 15 | 16 | (safe gen) 17 | ) 18 | (:goal (generator-ran)) 19 | ) 20 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob04.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 - tank) 4 | (:init (= (fuelLevel gen) 890) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | (available tank4) 11 | 12 | (= (ptime tank1) 0) 13 | (= (ptime tank2) 0) 14 | (= (ptime tank3) 0) 15 | (= (ptime tank4) 0) 16 | ) 17 | (:goal (generator-ran)) 18 | ) 19 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_prob08.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator_linear) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 tank8 - tank) 4 | (:init (= (fuelLevel gen) 860) 5 | (= (capacity gen) 1000) 6 | (available tank1) 7 | (available tank2) 8 | (available tank3) 9 | (available tank4) 10 | (available tank5) 11 | (available tank6) 12 | (available tank7) 13 | (available tank8) 14 | ) 15 | (:goal (generator-ran)) 16 | ) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SMTPlan+ 2 | PDDL+ planning through compilation to SMT 3 | 4 | Full description on the project website: 5 | http://kcl-planning.github.io/SMTPlan 6 | 7 | The easiest way to get SMTPlan is now through planutils: 8 | https://github.com/AI-Planning/planutils 9 | 10 | Old installation and user instructions in SMTPlan directory: 11 | https://github.com/KCL-Planning/SMTPlan/tree/master/SMTPlan 12 | 13 | ## Contents 14 | 15 | - SMTPlan: source code for SMTPlan+ 16 | - benchmarks: PDDL2.1 and PDDL+ benchmark domains and problems 17 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob02.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 960) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= (runtime) 1000)) 14 | (:goal (generator_ran generator)) 15 | (:metric minimize ( total-time )) 16 | ) 17 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob04.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 - tank) 4 | (:init 5 | (= (fuelLevel gen) 860) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | (= (fuelInTank tank4) 40) 12 | 13 | (available tank1) 14 | (available tank2) 15 | (available tank3) 16 | (available tank4) 17 | 18 | (safe gen) 19 | ) 20 | (:goal (generator-ran)) 21 | ) 22 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob05.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 - tank) 4 | (:init (= (fuelLevel gen) 860) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | (available tank4) 11 | (available tank5) 12 | 13 | (= (ptime tank1) 0) 14 | (= (ptime tank2) 0) 15 | (= (ptime tank3) 0) 16 | (= (ptime tank4) 0) 17 | (= (ptime tank5) 0) 18 | ) 19 | (:goal (generator-ran)) 20 | ) 21 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob05.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 - tank) 4 | (:init 5 | (= (fuelLevel gen) 820) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | (= (fuelInTank tank4) 40) 12 | (= (fuelInTank tank5) 40) 13 | 14 | (available tank1) 15 | (available tank2) 16 | (available tank3) 17 | (available tank4) 18 | (available tank5) 19 | 20 | (safe gen) 21 | ) 22 | (:goal (generator-ran)) 23 | ) 24 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob06.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 - tank) 4 | (:init (= (fuelLevel gen) 800) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | (available tank4) 11 | (available tank5) 12 | (available tank6) 13 | 14 | (= (ptime tank1) 0) 15 | (= (ptime tank2) 0) 16 | (= (ptime tank3) 0) 17 | (= (ptime tank4) 0) 18 | (= (ptime tank5) 0) 19 | (= (ptime tank6) 0) 20 | ) 21 | (:goal (generator-ran)) 22 | ) 23 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob03.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 940) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= (runtime) 1000)) 17 | (:goal (generator_ran generator)) 18 | (:metric minimize ( total-time )) 19 | ) 20 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob07.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 - tank) 4 | (:init (= (fuelLevel gen) 780) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | (available tank4) 11 | (available tank5) 12 | (available tank6) 13 | (available tank7) 14 | 15 | (= (ptime tank1) 0) 16 | (= (ptime tank2) 0) 17 | (= (ptime tank3) 0) 18 | (= (ptime tank4) 0) 19 | (= (ptime tank5) 0) 20 | (= (ptime tank6) 0) 21 | (= (ptime tank7) 0) 22 | ) 23 | (:goal (generator-ran)) 24 | ) 25 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob06.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 - tank) 4 | (:init 5 | (= (fuelLevel gen) 780) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | (= (fuelInTank tank4) 40) 12 | (= (fuelInTank tank5) 40) 13 | (= (fuelInTank tank6) 40) 14 | 15 | (available tank1) 16 | (available tank2) 17 | (available tank3) 18 | (available tank4) 19 | (available tank5) 20 | (available tank6) 21 | 22 | (safe gen) 23 | ) 24 | (:goal (generator-ran)) 25 | ) 26 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_prob08.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 tank8 - tank) 4 | (:init (= (fuelLevel gen) 750) 5 | (= (capacity gen) 1600) 6 | 7 | (available tank1) 8 | (available tank2) 9 | (available tank3) 10 | (available tank4) 11 | (available tank5) 12 | (available tank6) 13 | (available tank7) 14 | (available tank8) 15 | 16 | (= (ptime tank1) 0) 17 | (= (ptime tank2) 0) 18 | (= (ptime tank3) 0) 19 | (= (ptime tank4) 0) 20 | (= (ptime tank5) 0) 21 | (= (ptime tank6) 0) 22 | (= (ptime tank7) 0) 23 | (= (ptime tank8) 0) 24 | ) 25 | (:goal (generator-ran)) 26 | ) 27 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob07.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 - tank) 4 | (:init 5 | (= (fuelLevel gen) 740) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | (= (fuelInTank tank4) 40) 12 | (= (fuelInTank tank5) 40) 13 | (= (fuelInTank tank6) 40) 14 | (= (fuelInTank tank7) 40) 15 | 16 | (available tank1) 17 | (available tank2) 18 | (available tank3) 19 | (available tank4) 20 | (available tank5) 21 | (available tank6) 22 | (available tank7) 23 | 24 | (safe gen) 25 | ) 26 | (:goal (generator-ran)) 27 | ) 28 | -------------------------------------------------------------------------------- /SMTPlan/include/SMTPlan/ProblemInfo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file describes the problem. 3 | */ 4 | #include 5 | #include 6 | #include 7 | 8 | #include"z3++.h" 9 | 10 | #include 11 | #include 12 | 13 | #ifndef KCL_problem_info 14 | #define KCL_problem_info 15 | 16 | // polynomials over R||Q 17 | using pexpr = piranha::polynomial>; 18 | 19 | namespace SMTPlan 20 | { 21 | 22 | struct ProblemInfo 23 | { 24 | std::map staticPredicateMap; 25 | std::map staticFunctionMap; 26 | std::map staticFunctionValues; 27 | std::map staticFunctionValuesPiranha; 28 | }; 29 | 30 | } // close namespace 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob04.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 920) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= (runtime) 1000)) 20 | (:goal (generator_ran generator)) 21 | (:metric minimize ( total-time )) 22 | ) 23 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_prob08.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generatorplus) 2 | (:domain generatorplus) 3 | (:objects gen - generator tank1 tank2 tank3 tank4 tank5 tank6 tank7 tank8 - tank) 4 | (:init 5 | (= (fuelLevel gen) 700) 6 | (= (capacity gen) 1600) 7 | 8 | (= (fuelInTank tank1) 40) 9 | (= (fuelInTank tank2) 40) 10 | (= (fuelInTank tank3) 40) 11 | (= (fuelInTank tank4) 40) 12 | (= (fuelInTank tank5) 40) 13 | (= (fuelInTank tank6) 40) 14 | (= (fuelInTank tank7) 40) 15 | (= (fuelInTank tank8) 40) 16 | 17 | (available tank1) 18 | (available tank2) 19 | (available tank3) 20 | (available tank4) 21 | (available tank5) 22 | (available tank6) 23 | (available tank7) 24 | (available tank8) 25 | 26 | (safe gen) 27 | ) 28 | (:goal (generator-ran)) 29 | ) 30 | -------------------------------------------------------------------------------- /SMTPlan/include/SMTPlan/PlannerOptions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The structs in this file are used to the setup of an SMTPlan instance. 3 | */ 4 | #ifndef KCL_options 5 | #define KCL_options 6 | 7 | #define MAX_BITSET 100000 8 | 9 | #include 10 | 11 | namespace SMTPlan 12 | { 13 | 14 | struct Argument 15 | { 16 | std::string name; 17 | bool has_value; 18 | std::string help; 19 | }; 20 | 21 | struct PlannerOptions 22 | { 23 | bool verbose; 24 | bool debug; 25 | 26 | // files 27 | std::string domain_path; 28 | std::string problem_path; 29 | 30 | // solving options 31 | bool solve; 32 | 33 | // encoding options 34 | int encoder; 35 | 36 | // iterative deepening 37 | int lower_bound; 38 | int upper_bound; 39 | int cascade_bound; 40 | int step_size; 41 | }; 42 | 43 | // close namespace 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob05.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 tank5 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 900) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= ( tank_fuel_level tank5 ) 25) 20 | (= ( sqrtvolinit tank5 ) 5) 21 | (= ( flow_constant tank5 ) 0.4) 22 | (= (runtime) 1000)) 23 | (:goal (generator_ran generator)) 24 | (:metric minimize ( total-time )) 25 | ) 26 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob06.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 tank5 tank6 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 880) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= ( tank_fuel_level tank5 ) 25) 20 | (= ( sqrtvolinit tank5 ) 5) 21 | (= ( flow_constant tank5 ) 0.4) 22 | (= ( tank_fuel_level tank6 ) 25) 23 | (= ( sqrtvolinit tank6 ) 5) 24 | (= ( flow_constant tank6 ) 0.4) 25 | (= (runtime) 1000)) 26 | (:goal (generator_ran generator)) 27 | (:metric minimize ( total-time )) 28 | ) 29 | -------------------------------------------------------------------------------- /benchmarks/generator_linear/gen_linear_domain.pddl: -------------------------------------------------------------------------------- 1 | (define (domain generator_linear) 2 | (:requirements :fluents :durative-actions :duration-inequalities :adl :typing) 3 | (:types generator tank) 4 | (:predicates (refueling ?g - generator) (generator-ran) (available ?t - tank)) 5 | 6 | (:functions (fuelLevel ?g - generator) (capacity ?g - generator) ) 7 | 8 | (:durative-action generate 9 | :parameters (?g - generator) 10 | :duration (= ?duration 1000) 11 | :condition (over all (>= (fuelLevel ?g) 0)) 12 | :effect (and (decrease (fuelLevel ?g) (* #t 1)) 13 | (at end (generator-ran)))) 14 | 15 | (:durative-action refuel 16 | :parameters (?g - generator ?t - tank) 17 | :duration (= ?duration 10) 18 | :condition (and (at start (available ?t)) 19 | (over all (< (fuelLevel ?g) (capacity ?g)))) 20 | :effect (and (at start (refueling ?g)) 21 | (increase (fuelLevel ?g) (* #t 2)) 22 | (at start (not (available ?t))) 23 | (at end (not (refueling ?g))) 24 | ) 25 | )) 26 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob07.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 tank5 tank6 tank7 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 860) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= ( tank_fuel_level tank5 ) 25) 20 | (= ( sqrtvolinit tank5 ) 5) 21 | (= ( flow_constant tank5 ) 0.4) 22 | (= ( tank_fuel_level tank6 ) 25) 23 | (= ( sqrtvolinit tank6 ) 5) 24 | (= ( flow_constant tank6 ) 0.4) 25 | (= ( tank_fuel_level tank7 ) 25) 26 | (= ( sqrtvolinit tank7 ) 5) 27 | (= ( flow_constant tank7 ) 0.4) 28 | (= (runtime) 1000)) 29 | (:goal (generator_ran generator)) 30 | (:metric minimize ( total-time )) 31 | ) 32 | -------------------------------------------------------------------------------- /benchmarks/generator_nonlinear/gen_nonlinear_domain.pddl: -------------------------------------------------------------------------------- 1 | (define (domain generator2) 2 | (:requirements :fluents :durative-actions :duration-inequalities :adl :typing) 3 | (:types generator tank) 4 | (:predicates (refueling ?g - generator) (generator-ran) (available ?t - tank)) 5 | 6 | (:functions (fuelLevel ?g - generator) (capacity ?g - generator) (ptime ?t - tank)) 7 | 8 | (:durative-action generate 9 | :parameters (?g - generator) 10 | :duration (= ?duration 1000) 11 | :condition (over all (>= (fuelLevel ?g) 0)) 12 | :effect (and (decrease (fuelLevel ?g) (* #t 1)) 13 | (at end (generator-ran)))) 14 | 15 | (:durative-action refuel 16 | :parameters (?g - generator ?t - tank) 17 | :duration (= ?duration 10) 18 | :condition (and (at start (available ?t)) 19 | (over all (< (fuelLevel ?g) (capacity ?g))) 20 | ) 21 | :effect (and (at start (refueling ?g)) 22 | (increase (ptime ?t) (* #t 1)) 23 | (increase (fuelLevel ?g) (* #t (* 0.1 (* (ptime ?t) (ptime ?t))))) 24 | (at start (not (available ?t))) 25 | (at end (not (refueling ?g))) 26 | ) 27 | ) 28 | 29 | 30 | 31 | 32 | ) -------------------------------------------------------------------------------- /benchmarks/car_nodrag/car_domain_nodrag.pddl: -------------------------------------------------------------------------------- 1 | (define (domain car) 2 | (:requirements :typing :durative-actions :fluents :time :negative-preconditions :timed-initial-literals) 3 | 4 | (:predicates (running) (stopped) (engineBlown) (transmission_fine) (goal_reached) ) 5 | 6 | (:functions (d) (v) (a) (up_limit) (down_limit) (running_time) ) 7 | 8 | (:process moving 9 | :parameters () 10 | :precondition (and (running)) 11 | :effect (and (increase (v) (* #t (a))) 12 | (increase (d) (* #t (v))) 13 | (increase (running_time) (* #t 1)) 14 | ) 15 | ) 16 | 17 | (:action accelerate 18 | :parameters() 19 | :precondition (and (running) (< (a) (up_limit))) 20 | :effect (and (increase (a) 1)) 21 | ) 22 | 23 | (:action decelerate 24 | :parameters() 25 | :precondition (and (running) (> (a) (down_limit))) 26 | :effect (and (decrease (a) 1)) 27 | ) 28 | 29 | (:event engineExplode 30 | :parameters () 31 | :precondition (and (running) (>= (a) 1) (>= (v) 100)) 32 | :effect (and (not (running)) (engineBlown) (assign (a) 0)) 33 | ) 34 | 35 | (:action stop 36 | :parameters() 37 | :precondition(and (= (v) 0) (>= (d) 30) (not (engineBlown)) ) 38 | :effect(goal_reached) 39 | ) 40 | 41 | ) 42 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob08.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 tank5 tank6 tank7 tank8 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 840) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= ( tank_fuel_level tank5 ) 25) 20 | (= ( sqrtvolinit tank5 ) 5) 21 | (= ( flow_constant tank5 ) 0.4) 22 | (= ( tank_fuel_level tank6 ) 25) 23 | (= ( sqrtvolinit tank6 ) 5) 24 | (= ( flow_constant tank6 ) 0.4) 25 | (= ( tank_fuel_level tank7 ) 25) 26 | (= ( sqrtvolinit tank7 ) 5) 27 | (= ( flow_constant tank7 ) 0.4) 28 | (= ( tank_fuel_level tank8 ) 25) 29 | (= ( sqrtvolinit tank8 ) 5) 30 | (= ( flow_constant tank8 ) 0.4) 31 | (= (runtime) 1000)) 32 | (:goal (generator_ran generator)) 33 | (:metric minimize ( total-time )) 34 | ) 35 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/FastEnvironment.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "FastEnvironment.h" 28 | 29 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_prob09.pddl: -------------------------------------------------------------------------------- 1 | (define (problem run-generator2) 2 | (:domain generator) 3 | (:objects generator - gen tank1 tank2 tank3 tank4 tank5 tank6 tank7 tank8 tank9 - tank ) 4 | (:init 5 | (= ( gen_fuel_level generator) 820) 6 | (= ( capacity generator) 1000) 7 | (= ( tank_fuel_level tank1 ) 25) 8 | (= ( sqrtvolinit tank1 ) 5) 9 | (= ( flow_constant tank1 ) 0.4) 10 | (= ( tank_fuel_level tank2 ) 25) 11 | (= ( sqrtvolinit tank2 ) 5) 12 | (= ( flow_constant tank2 ) 0.4) 13 | (= ( tank_fuel_level tank3 ) 25) 14 | (= ( sqrtvolinit tank3 ) 5) 15 | (= ( flow_constant tank3 ) 0.4) 16 | (= ( tank_fuel_level tank4 ) 25) 17 | (= ( sqrtvolinit tank4 ) 5) 18 | (= ( flow_constant tank4 ) 0.4) 19 | (= ( tank_fuel_level tank5 ) 25) 20 | (= ( sqrtvolinit tank5 ) 5) 21 | (= ( flow_constant tank5 ) 0.4) 22 | (= ( tank_fuel_level tank6 ) 25) 23 | (= ( sqrtvolinit tank6 ) 5) 24 | (= ( flow_constant tank6 ) 0.4) 25 | (= ( tank_fuel_level tank7 ) 25) 26 | (= ( sqrtvolinit tank7 ) 5) 27 | (= ( flow_constant tank7 ) 0.4) 28 | (= ( tank_fuel_level tank8 ) 25) 29 | (= ( sqrtvolinit tank8 ) 5) 30 | (= ( flow_constant tank8 ) 0.4) 31 | (= ( tank_fuel_level tank9 ) 25) 32 | (= ( sqrtvolinit tank9 ) 5) 33 | (= ( flow_constant tank9 ) 0.4) 34 | (= (runtime) 1000)) 35 | (:goal (generator_ran generator)) 36 | (:metric minimize ( total-time )) 37 | ) 38 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/OptInterface.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __OPTINTERFACE 28 | #define __OPTINTERFACE 29 | 30 | 31 | void initialiser(int ndim,ColumnVector & x) 32 | { 33 | x(0) = 0.0; 34 | }; 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/TIM.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __TIM 28 | #define __TIM 29 | 30 | #include "TimSupport.h" 31 | 32 | 33 | namespace VAL { 34 | extern TypeChecker * theTC; 35 | }; 36 | 37 | namespace TIM { 38 | extern TIMAnalyser * TA; 39 | 40 | void performTIMAnalysis(char * argv[]); 41 | 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/StateObserver.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __STATEOBS 28 | #define __STATEOBS 29 | 30 | namespace VAL { 31 | 32 | class Happening; 33 | class EffectsRecord; 34 | 35 | class StateObserver { 36 | public: 37 | virtual ~StateObserver() {}; 38 | virtual void notifyChanged(const State * s,const Happening * h) {}; 39 | }; 40 | 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /benchmarks/generator_events/gen_events_domain.pddl: -------------------------------------------------------------------------------- 1 | (define (domain generatorplus) 2 | (:requirements :fluents :durative-actions :duration-inequalities :adl :typing :time) 3 | (:types generator tank) 4 | (:predicates (generator-ran) (available ?t - tank) (using ?t - tank ?g - generator) (safe ?g - generator)) 5 | (:functions (fuelLevel ?g - generator) (capacity ?g - generator) (fuelInTank ?t - tank) (ptime ?t - tank)) 6 | 7 | (:durative-action generate 8 | :parameters (?g - generator) 9 | :duration (= ?duration 1000) 10 | :condition (and (over all (>= (fuelLevel ?g) 0)) (over all (safe ?g))) 11 | :effect (and (decrease (fuelLevel ?g) (* #t 1)) 12 | (at end (generator-ran))) 13 | ) 14 | 15 | (:action refuel 16 | :parameters (?g - generator ?t - tank) 17 | :precondition (and (not (using ?t ?g)) (available ?t)) 18 | :effect (and (using ?t ?g) (not (available ?t))) 19 | ) 20 | 21 | (:process refuelling 22 | :parameters (?g - generator ?t -tank) 23 | :precondition (and (using ?t ?g)) 24 | :effect (and (decrease (fuelInTank ?t) (* #t (* 0.001 (* (ptime ?t) (ptime ?t))))) 25 | (increase (ptime ?t) (* #t 1)) 26 | (increase (fuelLevel ?g) (* #t (* 0.001 (* (ptime ?t) (ptime ?t)))))) 27 | ) 28 | (:event tankEmpty 29 | :parameters (?g - generator ?t - tank) 30 | :precondition (and (using ?t ?g) (<= (fuelInTank ?t) 0)) 31 | :effect (and (not (using ?t ?g))) 32 | ) 33 | 34 | (:event generatorOverflow 35 | :parameters (?g - generator) 36 | :precondition (and (> (fuelLevel ?g) (capacity ?g)) (safe ?g)) 37 | :effect (and (not (safe ?g))) 38 | ) 39 | 40 | ) 41 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/InstPropLinker.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __LITERALPROPLINK 28 | #define __LITERALPROPLINK 29 | 30 | namespace VAL { 31 | class SimpleProposition; 32 | class Environment; 33 | }; 34 | 35 | namespace Inst { 36 | 37 | class Literal; 38 | class instantiatedOp; 39 | 40 | Literal * toLiteral(const VAL::SimpleProposition *); 41 | VAL::Environment toEnv(instantiatedOp * op); 42 | 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /SMTPlan/README.md: -------------------------------------------------------------------------------- 1 | ## Installation 2 | 3 | SMTPlan requires the Piranha computer algebra system and the z3 SMT solver. 4 | 5 | First install z3: 6 | ``` 7 | git clone https://github.com/Z3Prover/z3 8 | ``` 9 | And follow the installation instructions for that repository. 10 | 11 | Then install Piranha: 12 | ``` 13 | git clone https://github.com/bluescarni/piranha 14 | ``` 15 | And follow the installation instructions here: http://bluescarni.github.io/piranha/sphinx/getting_started.html 16 | 17 | Then, from the SMTPlan directory: 18 | ``` 19 | mkdir build 20 | cd build 21 | cmake .. 22 | make 23 | ``` 24 | 25 | ## Using SMTPlan 26 | 27 | SMTPlan is suited to domains with continuous polyomial change over real variables. 28 | 29 | To run SMTPlan: 30 | ``` 31 | ./SMTPlan [domain_file.pddl] [problem_file.pddl] [options] 32 | ``` 33 | 34 | The possible options are described below: 35 | ``` 36 | Options: 37 | -h Print this and exit. 38 | -l number Begin iterative deepening at an encoding with l happenings (default 1). 39 | -u number Run iterative deepening until the u is reached. Set -1 for unlimited (default -1). 40 | -c number Limit the length of the concurrent cascading event and action chain (default 2, minimum 2). 41 | -s number Iteratively deepen with a step size of s (default 1). 42 | -n Do not solve. Output encoding in smt2 format and exit. 43 | -v Verbose times. 44 | ``` 45 | 46 | For example: `./SMTPlan domain.pddl problem.pddl -l 4 -u 10 -s 2` 47 | 48 | ## More information 49 | 50 | For more information on SMTPlan, visit the website: http://kcl-planning.github.io/SMTPlan/ 51 | -------------------------------------------------------------------------------- /SMTPlan/include/SMTPlan/Encoder.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file describes the Encoder class. This class 3 | * is used to create encodings of a PDDL domain and 4 | * problem pair. 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "z3++.h" 13 | 14 | #include "ptree.h" 15 | #include "instantiation.h" 16 | #include "VisitController.h" 17 | #include "FastEnvironment.h" 18 | #include "TIM.h" 19 | 20 | #include "SMTPlan/PlannerOptions.h" 21 | #include "SMTPlan/ProblemInfo.h" 22 | #include "SMTPlan/Algebraist.h" 23 | 24 | #ifndef KCL_encoder 25 | #define KCL_encoder 26 | 27 | namespace SMTPlan 28 | { 29 | enum EncState 30 | { 31 | ENC_NONE, 32 | ENC_INIT, 33 | ENC_GOAL, 34 | ENC_LITERAL, 35 | ENC_ACTION_CONDITION, 36 | ENC_ACTION_DURATION, 37 | ENC_ACTION_EFFECT, 38 | ENC_SIMPLE_ACTION_CONDITION, 39 | ENC_SIMPLE_ACTION_EFFECT, 40 | ENC_TIL_EFFECT, 41 | ENC_EVENT_CONDITION, 42 | ENC_EVENT_EFFECT, 43 | ENC_PROCESS_CONDITION 44 | }; 45 | 46 | class Encoder : public VAL::VisitController 47 | { 48 | private: 49 | public: 50 | 51 | /* encoding methods */ 52 | virtual bool encode(int H) =0; 53 | 54 | /* 55 | * add goal expression to the model for printing. 56 | * Usually the goal expression is only passed to the solver for checking. 57 | */ 58 | virtual void addGoal() =0; 59 | 60 | /* solving */ 61 | z3::context * z3_context; 62 | z3::tactic * z3_tactic; 63 | z3::solver * z3_solver; 64 | virtual z3::check_result solve() =0; 65 | virtual void printModel() =0; 66 | }; 67 | 68 | } // close namespace 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/GoalHypSpace.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __HYPSP 28 | #define __HYPSP 29 | 30 | #include 31 | 32 | namespace VAL { 33 | 34 | class GoalHypothesisSpace { 35 | public: 36 | virtual ~GoalHypothesisSpace() {}; 37 | virtual void write(std::ostream & o) const 38 | { 39 | std::cout << "Goal Hypothesis Space:\n<< >>\n"; 40 | }; 41 | }; 42 | 43 | std::ostream & operator<<(std::ostream & o,const GoalHypothesisSpace & g) 44 | { 45 | g.write(o); 46 | return o; 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Agents.h: -------------------------------------------------------------------------------- 1 | #ifndef __AGENTS 2 | #define __AGENTS 3 | 4 | #include "ptree.h" 5 | #include "Environment.h" 6 | 7 | class Agents { 8 | private: 9 | int numGps; 10 | std::vector > agentGps; 11 | std::map inGroup; 12 | std::map > > groupActions; 13 | public: 14 | Agents() : numGps(0), agentGps() {}; 15 | void addAgent(VAL::const_symbol * c) 16 | { 17 | agentGps[numGps-1].push_back(c); 18 | inGroup[c] = numGps-1; 19 | } 20 | void startNewGroup(VAL::const_symbol * c) 21 | { 22 | agentGps.push_back(std::vector()); 23 | ++numGps; 24 | addAgent(c); 25 | } 26 | 27 | void addAction(VAL::operator_ * o,int n) 28 | { 29 | groupActions[numGps-1].push_back(make_pair(o,n)); 30 | } 31 | 32 | vector whichGroups(const VAL::Environment & bdgs) 33 | { 34 | vector gps; 35 | int c = 0; 36 | for(vector >::iterator i = agentGps.begin();i != agentGps.end();++i,++c) 37 | { 38 | for(vector::iterator j = i->begin();j != i->end();++j) 39 | { 40 | for(VAL::Environment::const_iterator k = bdgs.begin();k != bdgs.end();++k) 41 | { 42 | if(k->second == *j) 43 | { 44 | gps.push_back(c); 45 | j = i->end(); 46 | --j; 47 | break; 48 | } 49 | } 50 | } 51 | } 52 | return gps; 53 | } 54 | 55 | string show(int g) 56 | { 57 | string s(""); 58 | for(vector::iterator i = agentGps[g].begin(); 59 | i != agentGps[g].end();++i) 60 | { 61 | s += (*i)->getName(); 62 | s += " "; 63 | } 64 | return s; 65 | } 66 | }; 67 | 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /benchmarks/generator_toricelli/gen_toricelli_domain.pddl: -------------------------------------------------------------------------------- 1 | (define (domain generator2 ) 2 | (:requirements :fluents :durative-actions :typing :negative-preconditions 3 | :duration-inequalities) 4 | (:types gen tank ) 5 | (:predicates ( refueling ?g - gen ?t - 6 | tank) 7 | ( generator_ran ?g - gen )) 8 | (:functions ( tank_fuel_level ?t - tank ) 9 | ( gen_fuel_level ?g - gen ) 10 | ( flow_constant ?t - tank ) 11 | ( refuel_time ?t - tank ) 12 | ( capacity ?g - gen ) 13 | ( sqrtvolinit ?t - tank ) 14 | ( sqrtvol ?t - tank) 15 | (runtime) 16 | ) 17 | (:durative-action generate 18 | :parameters (? g - gen ) 19 | :duration (= ? duration (runtime)) 20 | :condition ( over all (> ( gen_fuel_level ?g) 0) ) 21 | :effect (and (decrease ( gen_fuel_level ? g) (* #t 1)) 22 | (at end ( generator_ran ?g)))) 23 | 24 | 25 | (:durative-action refuel 26 | :parameters (? g - gen ?t - tank ) 27 | :duration ( <= ? duration (* (/ 1 (flow_constant ?t)) ( sqrtvolinit ?t))) 28 | :condition (and 29 | (at start (not (refueling ?g ?t )) ) 30 | ( over all (< ( gen_fuel_level ?g) (capacity ?g))) 31 | ( over all (> ( tank_fuel_level ?t) 0 )) ) 32 | 33 | :effect (and 34 | (at start ( refueling ?g ?t)) 35 | (at start (assign ( refuel_time ?t) 0) ) 36 | (at start (assign ( sqrtvol ?t) (sqrtvolinit ?t)) ) 37 | (increase ( refuel_time ?t) (* #t 1) ) 38 | (decrease ( sqrtvol ?t) (* #t (flow_constant ?t)) ) 39 | (decrease ( tank_fuel_level ?t) (* #t (* (* 2 ( flow_constant ?t)) (- (sqrtvolinit ?t) (* ( flow_constant ?t) (refuel_time ?t)))) )) 40 | (increase ( gen_fuel_level ?g) (* #t (*(* 2 ( flow_constant ?t)) (- (sqrtvolinit ?t) (* ( flow_constant ?t) (refuel_time ?t)))) )) 41 | (at end (not ( refueling ?g ?t))) 42 | (at end (assign ( sqrtvolinit ?t) (sqrtvol ?t)) ))) 43 | ) 44 | 45 | 46 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/HowWhatWhenMain.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include 28 | #include "ptree.h" 29 | #include "TIM.h" 30 | #include "HowAnalyser.h" 31 | #include "FuncAnalysis.h" 32 | #include "AbstractGraph.h" 33 | 34 | using namespace TIM; 35 | using namespace VAL; 36 | //using namespace Inst; 37 | 38 | 39 | 40 | int main(int argc,char * argv[]) 41 | { 42 | FAverbose = false; 43 | performTIMAnalysis(&argv[1]); 44 | 45 | HowAnalyser ha; 46 | 47 | current_analysis->the_domain->predicates->visit(&ha); 48 | current_analysis->the_domain->ops->visit(&ha); 49 | current_analysis->the_problem->initial_state->visit(&ha); 50 | ha.completeGraph(); 51 | }; 52 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/ToFnMain.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "ToFunction.h" 28 | #include "FastEnvironment.h" 29 | #include "SASActions.h" 30 | #include "instantiation.h" 31 | #include "SimpleEval.h" 32 | 33 | using namespace SAS; 34 | 35 | int main(int argc,char * argv[]) 36 | { 37 | performTIMAnalysis(&argv[1]); 38 | use_sasoutput = true; 39 | FunctionStructure fs; 40 | fs.normalise(); 41 | fs.initialise(); 42 | 43 | fs.processActions(); 44 | fs.buildLayers(); 45 | 46 | fs.setUpInitialState(); 47 | int level = 0; 48 | while(fs.growOneLevel()) 49 | { 50 | ++level; 51 | cout << "Built level: " << level << "\n"; 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/HowAnalyser.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "HowAnalyser.h" 28 | #include "AbstractGraph.h" 29 | 30 | namespace VAL { 31 | 32 | HowAnalyser::HowAnalyser() : VisitController(), ag(new AbstractGraph()) 33 | {}; 34 | 35 | void HowAnalyser::visit_simple_effect(simple_effect * se) 36 | { 37 | extended_pred_symbol * e = EPS(se->prop->head); 38 | if(epss.find(e) == epss.end()) 39 | { 40 | ag->addInitialFact(e); 41 | epss.insert(e); 42 | }; 43 | }; 44 | 45 | void HowAnalyser::visit_action(action * a) 46 | { 47 | cout << "Action: " << *(a->name) << "(" << *acts[a] << ")\n"; 48 | acts[a]->analyse(a); 49 | ag->addAction(acts[a]); 50 | }; 51 | 52 | void HowAnalyser::completeGraph() 53 | { 54 | ag->develop(); 55 | }; 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/CausalGraph.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __CGA 28 | #define __CGA 29 | 30 | #include 31 | #include 32 | 33 | #include "ToFunction.h" 34 | 35 | namespace SAS { 36 | 37 | class CausalGraph { 38 | public: 39 | typedef pair Var; 40 | typedef std::set Vars; 41 | typedef std::map Graph; 42 | 43 | private: 44 | FunctionStructure fs; 45 | 46 | Graph dependencies; 47 | Graph dependents; 48 | 49 | public: 50 | CausalGraph(); 51 | const Vars & getDependencies(Var p) 52 | { 53 | return dependencies[p]; 54 | }; 55 | const Vars & getDependents(Var p) 56 | { 57 | return dependents[p]; 58 | }; 59 | void add(Var,Var); 60 | void write(std::ostream & o) const; 61 | }; 62 | 63 | inline std::ostream & operator<<(std::ostream & o,const CausalGraph & cg) 64 | { 65 | cg.write(o); 66 | return o; 67 | }; 68 | 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/oldCausalGraph.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __CGA 28 | #define __CGA 29 | 30 | #include 31 | #include 32 | 33 | namespace TIM { 34 | class Property; 35 | } 36 | 37 | namespace VAL { 38 | using TIM::Property; 39 | 40 | class CausalGraph { 41 | public: 42 | typedef std::map > Graph; 43 | 44 | private: 45 | Graph dependencies; 46 | Graph dependents; 47 | 48 | public: 49 | CausalGraph(); 50 | const std::set & getDependencies(const Property * p) 51 | { 52 | return dependencies[p]; 53 | }; 54 | const std::set & getDependents(const Property * p) 55 | { 56 | return dependents[p]; 57 | }; 58 | void add(const Property *,const Property *); 59 | void write(std::ostream & o) const; 60 | }; 61 | 62 | inline std::ostream & operator<<(std::ostream & o,const CausalGraph & cg) 63 | { 64 | cg.write(o); 65 | return o; 66 | }; 67 | 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/Environment.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:12 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include "Environment.h" 48 | 49 | namespace VAL { 50 | 51 | map > Environment::copies 52 | = map >(); 53 | 54 | }; 55 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/sStack.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | 28 | /* 29 | sStack.h 30 | 31 | Simple Stack. 32 | 33 | $Date: 2009-02-05 10:50:27 $ 34 | $Revision: 1.2 $ 35 | 36 | This is an STL deque with a stack-like interface added. This is an 37 | insecure stack with all the deque interface deliberately left 38 | available. 39 | 40 | */ 41 | 42 | #ifndef SSTACK_H 43 | #define SSTACK_H 44 | 45 | #include 46 | 47 | using std::deque; 48 | 49 | namespace VAL { 50 | 51 | template 52 | class sStack : public deque 53 | { 54 | private: 55 | typedef deque _Base; 56 | public: 57 | 58 | // push elem onto stack 59 | void push(const T& elem) 60 | { 61 | _Base::push_front(elem); 62 | }; 63 | 64 | // pop elem from stack and return it 65 | T pop() 66 | { 67 | T elem(_Base::front()); 68 | _Base::pop_front(); 69 | return elem; 70 | }; 71 | 72 | // return top element, leaving it on the stack 73 | T& top() 74 | { 75 | return _Base::front(); 76 | }; 77 | }; 78 | 79 | }; 80 | 81 | #endif /* SSTACK_H */ 82 | -------------------------------------------------------------------------------- /SMTPlan/cmake_modules/FindGMP.cmake: -------------------------------------------------------------------------------- 1 | # Originally copied from the KDE project repository: 2 | # http://websvn.kde.org/trunk/KDE/kdeutils/cmake/modules/FindGMP.cmake?view=markup&pathrev=675218 3 | 4 | # Copyright (c) 2006, Laurent Montel, 5 | # Copyright (c) 2008-2016 Francesco Biscani, 6 | 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # 1. Redistributions of source code must retain the copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 3. The name of the author may not be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # ------------------------------------------------------------------------------------------ 30 | 31 | IF(GMP_INCLUDE_DIR AND GMP_LIBRARIES) 32 | # Already in cache, be silent 33 | SET(GMP_FIND_QUIETLY TRUE) 34 | ENDIF(GMP_INCLUDE_DIR AND GMP_LIBRARIES) 35 | 36 | FIND_PATH(GMP_INCLUDE_DIR NAMES gmp.h) 37 | FIND_LIBRARY(GMP_LIBRARIES NAMES gmp) 38 | 39 | INCLUDE(FindPackageHandleStandardArgs) 40 | 41 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) 42 | 43 | MARK_AS_ADVANCED(GMP_INCLUDE_DIR GMP_LIBRARIES) 44 | -------------------------------------------------------------------------------- /SMTPlan/cmake_modules/FindMPFR.cmake: -------------------------------------------------------------------------------- 1 | # Originally copied from the KDE project repository: 2 | # http://websvn.kde.org/trunk/KDE/kdeutils/cmake/modules/FindGMP.cmake?view=markup&pathrev=675218 3 | 4 | # Copyright (c) 2006, Laurent Montel, 5 | # Copyright (c) 2008-2016 Francesco Biscani, 6 | 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions 9 | # are met: 10 | # 11 | # 1. Redistributions of source code must retain the copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 3. The name of the author may not be used to endorse or promote products 17 | # derived from this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | # ------------------------------------------------------------------------------------------ 30 | 31 | IF(MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) 32 | # Already in cache, be silent 33 | SET(MPFR_FIND_QUIETLY TRUE) 34 | ENDIF(MPFR_INCLUDE_DIR AND MPFR_LIBRARIES) 35 | 36 | FIND_PATH(MPFR_INCLUDE_DIR NAMES mpfr.h) 37 | FIND_LIBRARY(MPFR_LIBRARIES NAMES mpfr) 38 | 39 | INCLUDE(FindPackageHandleStandardArgs) 40 | 41 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPFR DEFAULT_MSG MPFR_INCLUDE_DIR MPFR_LIBRARIES) 42 | 43 | MARK_AS_ADVANCED(MPFR_INCLUDE_DIR MPFR_LIBRARIES) 44 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/PingusTranslator.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include "ptree.h" 30 | #include "TIM.h" 31 | #include "FuncAnalysis.h" 32 | #include "PinguPlanGenerator.h" 33 | #include "FlexLexer.h" 34 | 35 | using namespace std; 36 | using namespace TIM; 37 | using namespace VAL; 38 | //using namespace Inst; 39 | 40 | namespace VAL { 41 | 42 | extern yyFlexLexer * yfl; 43 | } 44 | extern int yyparse(); 45 | 46 | plan * getPlan(char * name) 47 | { 48 | plan * the_plan = 0; 49 | 50 | ifstream planFile(name); 51 | if(!planFile) 52 | { 53 | cout << "Bad plan file!\n"; 54 | return the_plan; 55 | }; 56 | 57 | 58 | yfl = new yyFlexLexer(&planFile,&cout); 59 | yyparse(); 60 | delete yfl; 61 | 62 | the_plan = dynamic_cast(top_thing); 63 | 64 | return the_plan; 65 | 66 | }; 67 | 68 | 69 | int main(int argc,char * argv[]) 70 | { 71 | FAverbose = false; 72 | performTIMAnalysis(&argv[1]); 73 | 74 | plan * thePlan = getPlan(argv[3]); 75 | PinguPlanGen ppg(argv[4]); 76 | 77 | current_analysis->the_problem->initial_state->visit(&ppg); 78 | cout << "(pingus-plan\n(actions\n"; 79 | thePlan->visit(&ppg); 80 | cout << "))\n"; 81 | }; 82 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/SearchSpace.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "SearchSpace.h" 28 | 29 | namespace Planner { 30 | 31 | SearchSpace::SearchSpace() : 32 | derivRules(VAL::current_analysis->the_domain->drvs,VAL::current_analysis->the_domain->ops), 33 | val(&derivRules,0.001,*VAL::theTC,VAL::current_analysis->the_domain->ops,VAL::current_analysis->the_problem->initial_state, 34 | &dummyPlan,VAL::current_analysis->the_problem->metric,true,true,0,0), 35 | gf(new Inst::GraphFactory()), 36 | pg(gf), ppq(0), hasOrder(false), myPPO(0) 37 | { 38 | pg.extendToGoals(); 39 | }; 40 | 41 | 42 | void SearchSpace::findPlan() 43 | { 44 | if(!hasOrder) 45 | { 46 | cout << "You have to set the ordering for Partial Plans before searching for a plan\n"; 47 | exit(0); 48 | }; 49 | PartialPlan * pp = new PartialPlan(); 50 | cout << "Our first partial plan:\n" << *pp << "\n"; 51 | ppq->push(pp); 52 | 53 | cout << "Let's embark on our search for a plan....\n"; 54 | cout << "Our story begins with\n" << *(ppq->top()) << "\n"; 55 | 56 | cout << "First we wait epsilon\n"; 57 | pp->initialWait(val.getTolerance()); 58 | ppq->pop(); 59 | ppq->push(pp); 60 | cout << "Now we have:\n" << *pp << "\n"; 61 | pp->timeToTrigger(); 62 | }; 63 | 64 | }; 65 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/main.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:26 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #ifndef __MAIN 48 | #define __MAIN 49 | 50 | #include 51 | using std::ostream; 52 | 53 | namespace VAL { 54 | 55 | extern bool Verbose; 56 | extern bool ContinueAnyway; 57 | extern bool ErrorReport; 58 | extern bool InvariantWarnings; 59 | extern bool LaTeX; 60 | extern bool LaTeXRecord; 61 | extern ostream*report; 62 | extern int NoGraphPoints; 63 | extern bool makespanDefault; 64 | extern bool stepLengthDefault; 65 | 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/instantiationMain.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include 30 | #include "ptree.h" 31 | #include 32 | #include "instantiation.h" 33 | #include "SimpleEval.h" 34 | #include "DebugWriteController.h" 35 | #include "typecheck.h" 36 | #include "TIM.h" 37 | 38 | using std::ifstream; 39 | using std::cerr; 40 | 41 | using namespace TIM; 42 | using namespace Inst; 43 | using namespace VAL; 44 | 45 | int main(int argc,char * argv[]) 46 | { 47 | performTIMAnalysis(&argv[1]); 48 | 49 | SimpleEvaluator::setInitialState(); 50 | for(operator_list::const_iterator os = current_analysis->the_domain->ops->begin(); 51 | os != current_analysis->the_domain->ops->end();++os) 52 | { 53 | cout << (*os)->name->getName() << "\n"; 54 | instantiatedOp::instantiate(*os,current_analysis->the_problem,*theTC); 55 | cout << instantiatedOp::howMany() << " so far\n"; 56 | }; 57 | instantiatedOp::createAllLiterals(current_analysis->the_problem,theTC); 58 | instantiatedOp::filterOps(theTC); 59 | cout << instantiatedOp::howMany() << "\n"; 60 | instantiatedOp::writeAll(cout); 61 | 62 | cout << "\nList of all literals:\n"; 63 | 64 | instantiatedOp::writeAllLiterals(cout); 65 | 66 | } 67 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/macros.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /* ---------------------------------------------------------------------------- 28 | Macros for diagnostic output. 29 | These generate code to output both name and value of a field, 30 | and to deal with pretty-printing indentation in a consistent way. 31 | 32 | Edit this file to change the output format of the syntax trees. 33 | 34 | $Date: 2009-02-05 10:50:26 $ 35 | $Revision: 1.2 $ 36 | 37 | stephen.cresswell@cis.strath.ac.uk 38 | 39 | Strathclyde Planning Group 40 | --------------------------------------------------------------------------*/ 41 | 42 | // # expands arg into quoted string 43 | // ## concatenates arg 44 | 45 | // Output NAME - used for name of class 46 | #define TITLE(NAME) indent(ind); cout << '(' << #NAME << ')'; 47 | 48 | // Display a data member that is a parse_category 49 | #define FIELD(NAME) indent(ind); cout << #NAME << ": "; if (NAME != NULL) NAME->display(ind+1); else cout << "(NULL)"; 50 | 51 | // Used for display of list element 52 | #define ELT(NAME) { if ((NAME) != NULL) (NAME)->display(ind+1); else cout << "(NULL)"; } 53 | 54 | // Display NAME only 55 | #define LABEL(NAME) indent(ind); cout << #NAME << ':'; 56 | 57 | // Output a data member that is not a parse_category 58 | #define LEAF(NAME) indent(ind); cout << #NAME << ": "; cout << NAME; 59 | 60 | 61 | extern void indent(int ind); 62 | 63 | 64 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/TIMUtilities.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __TIMUTILS 28 | #define __TIMUTILS 29 | 30 | #include 31 | #include 32 | 33 | 34 | using std::ostream; 35 | using std::iterator; 36 | 37 | namespace VAL { 38 | class pddl_type; 39 | }; 40 | 41 | template 42 | struct ptrwriter 43 | { 44 | ostream & os; 45 | const char * septr; 46 | 47 | ptrwriter(ostream & o,const char * sep) : os(o), septr(sep) {}; 48 | void operator()(T * p) 49 | { 50 | os << (*p) << septr; 51 | }; 52 | }; 53 | 54 | namespace TIM { 55 | 56 | template 57 | struct typeTransformer : 58 | public 59 | #ifndef OLDCOMPILER 60 | std::iterator 61 | #endif 62 | #ifdef OLDCOMPILER 63 | std::forward_iterator 64 | #endif 65 | ::iterator_category,VAL::pddl_type *>{ 66 | TI ti; 67 | int arg; 68 | const VAL::pddl_type * pt; 69 | int cnt; 70 | 71 | typeTransformer(TI t,int a,const VAL::pddl_type * p) : 72 | ti(t), arg(a), pt(p), cnt(0) {}; 73 | 74 | VAL::pddl_type * operator*() 75 | { 76 | if(cnt==arg) return const_cast(pt); 77 | return (*ti)->type; 78 | }; 79 | typeTransformer & operator++() {++ti; ++cnt; return *this;}; 80 | bool operator==(const typeTransformer & t) const {return ti == t.ti;}; 81 | size_t operator-(const typeTransformer & t) const 82 | { 83 | return ti - t.ti; 84 | }; 85 | }; 86 | 87 | template 88 | typeTransformer makeTT(TI t,int a,const VAL::pddl_type * p) 89 | { 90 | return typeTransformer(t,a,p); 91 | }; 92 | 93 | }; 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/Utils.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:24 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include 48 | #include 49 | #include "Polynomial.h" 50 | #include "Action.h" 51 | #include "FuncExp.h" 52 | #include "Utils.h" 53 | 54 | namespace VAL { 55 | 56 | void replaceSubStrings(string & s,string s1,string s2) 57 | { 58 | size_t pos = s.find(s1); 59 | size_t subPos = pos; 60 | size_t size = s.size(); 61 | 62 | 63 | for(size_t count = 1;count < size ; ++count) 64 | { 65 | if(subPos != string::npos) 66 | s.replace(pos,s1.size(),s2); 67 | else 68 | break; 69 | 70 | subPos = (s.substr(pos + s2.size(),string::npos)).find(s1); 71 | pos = pos + s2.size() + subPos; 72 | }; 73 | 74 | }; 75 | 76 | //change any action names etc that LaTeX will not like 77 | void latexString(string & s) 78 | { 79 | replaceSubStrings(s,"_","\\_"); 80 | 81 | 82 | }; 83 | 84 | }; 85 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:24 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include 48 | #include 49 | 50 | #ifndef __VALUTILS 51 | #define __VALUTILS 52 | 53 | using std::ostringstream; 54 | using std::string; 55 | 56 | namespace VAL { 57 | 58 | template 59 | struct ToStringer { 60 | string operator()(T d) 61 | { 62 | ostringstream aStringStream; 63 | aStringStream << d; 64 | return aStringStream.str(); 65 | }; 66 | }; 67 | 68 | template 69 | struct ToStringer { 70 | string operator()(T * d) 71 | { 72 | ostringstream aStringStream; 73 | aStringStream << *d; 74 | return aStringStream.str(); 75 | }; 76 | }; 77 | 78 | template 79 | string toString(T d) 80 | { 81 | ToStringer ts; 82 | return ts(d); 83 | }; 84 | 85 | void replaceSubStrings(string & s,string s1,string s2); 86 | 87 | void latexString(string & s); 88 | 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/dynaMain.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include 30 | #include "ptree.h" 31 | #include 32 | #include "instantiation.h" 33 | #include "SimpleEval.h" 34 | #include "DebugWriteController.h" 35 | #include "typecheck.h" 36 | #include "TIM.h" 37 | 38 | #include "graphconstruct.h" 39 | #include "SearchSpace.h" 40 | #include "PartialPlan.h" 41 | 42 | using std::ifstream; 43 | using std::cerr; 44 | 45 | using namespace TIM; 46 | using namespace Inst; 47 | using namespace VAL; 48 | using namespace Planner; 49 | 50 | namespace VAL { 51 | bool ContinueAnyway; 52 | bool ErrorReport; 53 | bool InvariantWarnings; 54 | bool LaTeX; 55 | 56 | }; 57 | 58 | int main(int argc,char * argv[]) 59 | { 60 | performTIMAnalysis(&argv[1]); 61 | 62 | SimpleEvaluator::setInitialState(); 63 | for(operator_list::const_iterator os = current_analysis->the_domain->ops->begin(); 64 | os != current_analysis->the_domain->ops->end();++os) 65 | { 66 | cout << (*os)->name->getName() << "\n"; 67 | instantiatedOp::instantiate(*os,current_analysis->the_problem,*theTC); 68 | cout << instantiatedOp::howMany() << " so far\n"; 69 | }; 70 | cout << instantiatedOp::howMany() << "\n"; 71 | //instantiatedOp::writeAll(cout); 72 | 73 | //cout << "\nList of all literals:\n"; 74 | instantiatedOp::createAllLiterals(current_analysis->the_problem,theTC); 75 | //instantiatedOp::writeAllLiterals(cout); 76 | 77 | Inst::ActEntry::readDurations(argv[3]); 78 | 79 | SearchSpace::instance().setOrdering(new LongPlanHead); 80 | SearchSpace::instance().findPlan(); 81 | 82 | } 83 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/InstPropLinker.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "InstPropLinker.h" 28 | 29 | #include "Proposition.h" 30 | #include "instantiation.h" 31 | 32 | #include "ptree.h" 33 | #include "FastEnvironment.h" 34 | #include "Environment.h" 35 | 36 | using namespace VAL; 37 | 38 | 39 | namespace Inst { 40 | 41 | Literal * toLiteral(const VAL::SimpleProposition * sp) 42 | { 43 | int id = -1; 44 | for(parameter_symbol_list::const_iterator i = sp->getProp()->args->begin(); 45 | i != sp->getProp()->args->end();++i) 46 | { 47 | if(const var_symbol * vs = dynamic_cast(*i)) 48 | { 49 | id = std::max(id,static_cast*>(vs)->getId()); 50 | }; 51 | }; 52 | FastEnvironment * fe = new FastEnvironment(id+1); 53 | for(parameter_symbol_list::const_iterator i = sp->getProp()->args->begin(); 54 | i != sp->getProp()->args->end();++i) 55 | { 56 | if(const var_symbol * vs = dynamic_cast(*i)) 57 | { 58 | (*fe)[vs] = const_cast(sp->getEnv()->find(vs)->second); 59 | }; 60 | }; 61 | 62 | CreatedLiteral * cl = new CreatedLiteral(sp->getProp(),fe); 63 | 64 | Literal * res = instantiatedOp::getLiteral(cl); 65 | if(res != cl) 66 | { 67 | delete cl; 68 | }; 69 | return res; 70 | }; 71 | 72 | Environment toEnv(instantiatedOp * op) 73 | { 74 | Environment e; 75 | for(var_symbol_list::const_iterator i = op->forOp()->parameters->begin(); 76 | i != op->forOp()->parameters->end();++i) 77 | { 78 | if(const var_symbol * vs = dynamic_cast(*i)) 79 | { 80 | e[vs] = (*(op->getEnv()))[vs]; 81 | }; 82 | }; 83 | return e; 84 | }; 85 | 86 | }; 87 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Evaluator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __EVALUATOR 28 | #define __EVALUATOR 29 | #include "VisitController.h" 30 | #include 31 | #include 32 | #include 33 | #include "ptree.h" 34 | #include "Environment.h" 35 | 36 | namespace VAL { 37 | class State; 38 | class FastEnvironment; 39 | class Validator; 40 | 41 | }; 42 | 43 | namespace Inst { 44 | 45 | class instantiatedOp; 46 | 47 | class Evaluator : public VAL::VisitController { 48 | protected: 49 | VAL::Validator * vld; 50 | 51 | bool value; 52 | VAL::Environment env; 53 | VAL::FastEnvironment * f; 54 | 55 | const VAL::State * state; 56 | 57 | VAL::pred_symbol * equality; 58 | 59 | bool ignoreMetrics; 60 | bool context; 61 | 62 | public: 63 | 64 | static void setInitialState(); 65 | 66 | Evaluator(VAL::Validator * v,const VAL::State * s,Inst::instantiatedOp * op,bool im = false); 67 | 68 | virtual void visit_simple_goal(VAL::simple_goal *); 69 | virtual void visit_qfied_goal(VAL::qfied_goal *); 70 | virtual void visit_conj_goal(VAL::conj_goal *); 71 | virtual void visit_disj_goal(VAL::disj_goal *); 72 | virtual void visit_timed_goal(VAL::timed_goal *); 73 | virtual void visit_imply_goal(VAL::imply_goal *); 74 | virtual void visit_neg_goal(VAL::neg_goal *); 75 | virtual void visit_comparison(VAL::comparison *); 76 | virtual void visit_preference(VAL::preference *); 77 | virtual void visit_event(VAL::event * e); 78 | virtual void visit_process(VAL::process * p); 79 | virtual void visit_action(VAL::action * o); 80 | virtual void visit_durative_action(VAL::durative_action * da); 81 | bool operator()() {return value;}; 82 | }; 83 | 84 | }; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /SMTPlan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(SMTPlan) 3 | 4 | ## Version number 5 | set (SMTPlan_VERSION_MAJOR 0) 6 | set (SMTPlan_VERSION_MINOR 9) 7 | 8 | ##-----------## 9 | ## Configure ## 10 | ##-----------## 11 | 12 | set(CMAKE_CXX_FLAGS "-std=c++0x") 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules" "${CMAKE_SOURCE_DIR}/cmake_modules/yacma") 14 | set (PROJECT_SOURCE_DIR src) 15 | 16 | ## configure a header file for CMake settings 17 | configure_file ( 18 | "${PROJECT_SOURCE_DIR}/SMTPlanConfig.h.in" 19 | "${PROJECT_BINARY_DIR}/SMTPlanConfig.h" 20 | ) 21 | 22 | ## add the binary tree to the include files so that we will find SMTPlanConfig.h 23 | include_directories("${PROJECT_BINARY_DIR}") 24 | 25 | ##-------## 26 | ## Build ## 27 | ##-------## 28 | 29 | ## required 30 | find_package(FLEX REQUIRED) 31 | find_package(PythonLibs REQUIRED) 32 | FIND_PACKAGE(GMP REQUIRED) 33 | MESSAGE(STATUS "GMP library found.") 34 | MESSAGE(STATUS "GMP include dir is: ${GMP_INCLUDE_DIR}") 35 | MESSAGE(STATUS "GMP library is: ${GMP_LIBRARIES}") 36 | FIND_PACKAGE(MPFR REQUIRED) 37 | MESSAGE(STATUS "MPFR library found.") 38 | MESSAGE(STATUS "MPFR include dir is: ${MPFR_INCLUDE_DIR}") 39 | MESSAGE(STATUS "MPFR library is: ${MPFR_LIBRARIES}") 40 | find_package(Boost REQUIRED thread) 41 | 42 | ## include directories 43 | include_directories (include) 44 | include_directories (src/VALfiles) 45 | include_directories (src/VALfiles/src) 46 | include_directories (src/VALfiles/include) 47 | include_directories(${PYTHON_INCLUDE_DIRS}) 48 | include_directories(${SYMENGINE_INCLUDE_DIRS}) 49 | include_directories(${GMP_INCLUDE_DIR}) 50 | include_directories(${MPFR_INCLUDE_DIR}) 51 | 52 | ## val sources 53 | set(VAL_SOURCES 54 | src/VALfiles/src/DebugWriteController.cpp 55 | src/VALfiles/src/FastEnvironment.cpp 56 | src/VALfiles/src/FuncAnalysis.cpp 57 | src/VALfiles/src/SimpleEval.cpp 58 | src/VALfiles/src/TIM.cpp 59 | src/VALfiles/src/TimSupport.cpp 60 | src/VALfiles/src/TypedAnalyser.cpp 61 | src/VALfiles/src/instantiation.cpp 62 | src/VALfiles/src/pddl+.cpp 63 | src/VALfiles/src/ptree.cpp 64 | src/VALfiles/src/typecheck.cpp) 65 | 66 | ## SMTPLAN sources 67 | set(SMTPLAN_SOURCES 68 | src/SMTPlan.cpp 69 | src/Algebraist.cpp 70 | src/EncoderHappening.cpp 71 | src/EncoderFluent.cpp) 72 | 73 | ## Declare cpp executables 74 | add_executable(SMTPlan ${SMTPLAN_SOURCES} ${VAL_SOURCES}) 75 | target_link_libraries(SMTPlan ${Boost_LIBRARIES} z3 ${Boost_LIBRARIES} ${GMP_LIBRARIES} ${MPFR_LIBRARIES}) 76 | ## Uncomment to solve undefined reference to symbol 'pthread' 77 | ## target_link_libraries(SMTPlan ${Boost_LIBRARIES} pthread) 78 | 79 | #add_executable(test_python src/test_python.cpp) 80 | #target_link_libraries(test_python ${Boost_LIBRARIES} ${GMP_LIBRARIES} ${MPFR_LIBRARIES}) 81 | 82 | # add the install targets 83 | install (TARGETS SMTPlan DESTINATION bin) 84 | install (FILES "${PROJECT_BINARY_DIR}/SMTPlanConfig.h" DESTINATION include) 85 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/CausalGraph.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "CausalGraph.h" 28 | #include "ptree.h" 29 | #include "VisitController.h" 30 | #include "TimSupport.h" 31 | #include "ToFunction.h" 32 | #include "SASActions.h" 33 | #include 34 | 35 | using namespace std; 36 | using namespace VAL; 37 | 38 | namespace SAS { 39 | 40 | 41 | 42 | CausalGraph::CausalGraph() 43 | { 44 | fs.normalise(); 45 | fs.initialise(); 46 | fs.processActions(); 47 | 48 | for(FunctionStructure::iterator i = fs.begin();i != fs.end();++i) 49 | { 50 | cout << *(i->second); 51 | set pres; 52 | set posts; 53 | for(SASActionTemplate::iterator j = i->second->precondsBegin();j != i->second->precondsEnd();++j) 54 | { 55 | pres.insert(j->second.begin(),j->second.end()); 56 | }; 57 | for(SASActionTemplate::iterator j = i->second->postcondsBegin();j != i->second->postcondsEnd();++j) 58 | { 59 | posts.insert(j->second.begin(),j->second.end()); 60 | }; 61 | for(set::iterator j = posts.begin();j != posts.end();++j) 62 | { 63 | for(set::iterator k = pres.begin();k != pres.end();++k) 64 | { 65 | add(Var((*j)->getType(),(*j)->getSegment()),Var((*k)->getType(),(*k)->getSegment())); 66 | }; 67 | }; 68 | }; 69 | }; 70 | 71 | void CausalGraph::add(Var e,Var p) 72 | { 73 | if(e != p) 74 | { 75 | dependencies[e].insert(p); 76 | dependents[p].insert(e); 77 | }; 78 | }; 79 | 80 | void CausalGraph::write(ostream & o) const 81 | { 82 | for(Graph::const_iterator i = dependencies.begin();i != dependencies.end();++i) 83 | { 84 | o << i->first.first->getName() << "_" << i->first.second << ":\n"; 85 | for(Vars::iterator j = i->second.begin(); j != i->second.end();++j) 86 | { 87 | o << "\t" << j->first->getName() << "_" << j->second << "\n"; 88 | }; 89 | }; 90 | }; 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/random.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:27 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include "random.h" 48 | 49 | namespace VAL { 50 | 51 | NormalGen Generators::randomNumberNormGenerator = NormalGen(); 52 | UniformGen Generators::randomNumberUniGenerator = UniformGen(0,0,1); 53 | 54 | //return a random number with norm prob over -1 to 1 55 | double getRandomNumberNormal() 56 | { 57 | double randomNumber; 58 | do 59 | { 60 | randomNumber = Generators::randomNumberNormGenerator()*0.25; 61 | }while(randomNumber > 1.0 || randomNumber < -1.0); 62 | 63 | //cout << randomNumber << " \\\\\n"; 64 | return randomNumber; 65 | }; 66 | 67 | //return a random number with uniform prob over 0 to 1 68 | double getRandomNumberUniform() 69 | { 70 | //double randomNumber = double(rand()) / double(RAND_MAX); 71 | double randomNumber = Generators::randomNumberUniGenerator(); 72 | 73 | return randomNumber; 74 | }; 75 | 76 | double getRandomNumberPsuedoNormal() 77 | { 78 | 79 | int noToAverage = 4; 80 | double total = 0; 81 | 82 | for(int i = 1; i <= noToAverage; ++i) 83 | { 84 | total += getRandomNumberUniform(); 85 | }; 86 | 87 | return total/noToAverage; 88 | }; 89 | 90 | }; 91 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Ownership.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:20 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #ifndef __OWNERSHIP 48 | #define __OWNERSHIP 49 | 50 | #include 51 | #include "ptree.h" 52 | 53 | namespace VAL { 54 | 55 | class Validator; 56 | class Action; 57 | class FuncExp; 58 | struct Environment; 59 | class SimpleProposition; 60 | class expression; 61 | 62 | using std::map; 63 | using std::pair; 64 | 65 | enum ownership {E_PRE,E_PPRE,E_NPRE,E_ADD,E_DEL,E_ASSIGNMENT}; 66 | 67 | class Ownership { 68 | private: 69 | map > propOwner; 70 | 71 | Validator * vld; 72 | map > FEOwner; 73 | 74 | public: 75 | Ownership(Validator * v) : vld(v) {}; 76 | 77 | bool markOwnedPrecondition(const Action * a,const SimpleProposition * p,ownership o); 78 | bool markOwnedPreconditionFEs(const Action * a,const expression * e,const Environment & bs); 79 | bool ownsForAdd(const Action * a,const SimpleProposition * p); 80 | bool ownsForDel(const Action * a,const SimpleProposition * p); 81 | bool markOwnedEffectFE(const Action * a,const FuncExp * fe,assign_op aop, 82 | const expression * e,const Environment & bs); 83 | 84 | }; 85 | 86 | }; 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/SearchSpace.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __SEARCHSPACE 28 | #define __SEARCHSPACE 29 | 30 | #include "Validator.h" 31 | #include "ptree.h" 32 | #include "graphconstruct.h" 33 | #include "TIM.h" 34 | #include "PartialPlan.h" 35 | 36 | #include 37 | 38 | namespace Planner { 39 | 40 | // This is a singleton object.... 41 | 42 | class SearchSpace { 43 | private: 44 | // We need all these things to build a Validator object that can then be used to 45 | // support the simulation process for execution of Happenings. 46 | VAL::DerivationRules derivRules; 47 | VAL::plan dummyPlan; 48 | VAL::Validator val; 49 | 50 | Inst::GraphFactory * gf; 51 | Inst::PlanGraph pg; 52 | 53 | typedef std::priority_queue,PartialPlanOrderer> PPQueue; 54 | PPQueue * ppq; 55 | 56 | bool hasOrder; 57 | PartialPlanOrder * myPPO; 58 | 59 | SearchSpace(); 60 | SearchSpace(const SearchSpace &); 61 | 62 | public: 63 | static SearchSpace & instance() 64 | { 65 | static SearchSpace ssp; 66 | return ssp; 67 | }; 68 | 69 | ~SearchSpace() 70 | { 71 | delete myPPO; 72 | }; 73 | 74 | void setOrdering(PartialPlanOrder * ppo) 75 | { 76 | if(hasOrder) 77 | { 78 | PPQueue * ppq1 = new PPQueue(PartialPlanOrderer(ppo)); 79 | 80 | while(!ppq->empty()) 81 | { 82 | ppq1->push(ppq->top()); 83 | ppq->pop(); 84 | }; 85 | delete ppq; 86 | ppq = ppq1; 87 | delete myPPO; 88 | myPPO = ppo; 89 | } 90 | else 91 | { 92 | ppq = new PPQueue(PartialPlanOrderer(ppo)); 93 | myPPO = ppo; 94 | hasOrder = true; 95 | }; 96 | }; 97 | 98 | VAL::Validator * getVal() {return &val;}; 99 | VAL::plan * getDummyPlan() {return &dummyPlan;}; 100 | Inst::PlanGraph & getPG() {return pg;}; 101 | 102 | 103 | void findPlan(); 104 | }; 105 | 106 | 107 | 108 | }; 109 | 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/parse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /* 28 | main() for the PDDL2.2 parser 29 | 30 | $Date: 2009-02-05 10:50:26 $ 31 | $Revision: 1.2 $ 32 | 33 | This expects any number of filenames as arguments, although 34 | it probably doesn't ever make sense to supply more than two. 35 | 36 | stephen.cresswell@cis.strath.ac.uk 37 | 38 | Strathclyde Planning Group 39 | */ 40 | 41 | #include 42 | #include 43 | #include 44 | #include "ptree.h" 45 | #include "FlexLexer.h" 46 | 47 | extern int yyparse(); 48 | extern int yydebug; 49 | 50 | using std::ifstream; 51 | using std::ofstream; 52 | 53 | namespace VAL { 54 | 55 | parse_category* top_thing=NULL; 56 | 57 | analysis an_analysis; 58 | analysis* current_analysis; 59 | 60 | yyFlexLexer* yfl; 61 | 62 | }; 63 | 64 | char * current_filename; 65 | 66 | using namespace VAL; 67 | 68 | int main(int argc,char * argv[]) 69 | { 70 | current_analysis= &an_analysis; 71 | ifstream* current_in_stream; 72 | yydebug=0; // Set to 1 to output yacc trace 73 | 74 | yfl= new yyFlexLexer; 75 | 76 | // Loop over given args 77 | for (int a=1; abad()) 83 | { 84 | // Output a message now 85 | cout << "Failed to open\n"; 86 | 87 | // Log an error to be reported in summary later 88 | line_no= 0; 89 | log_error(E_FATAL,"Failed to open file"); 90 | } 91 | else 92 | { 93 | line_no= 1; 94 | 95 | // Switch the tokeniser to the current input stream 96 | yfl->switch_streams(current_in_stream,&cout); 97 | yyparse(); 98 | 99 | // Output syntax tree 100 | if (top_thing) top_thing->display(0); 101 | } 102 | delete current_in_stream; 103 | } 104 | // Output the errors from all input files 105 | current_analysis->error_list.report(); 106 | delete yfl; 107 | } 108 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/Analysis.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /* 28 | main() for the PDDL2.1 Analysis tester 29 | 30 | $Date: 2009-02-05 10:50:10 $ 31 | $Revision: 1.2 $ 32 | 33 | This expects any number of filenames as arguments, although 34 | it probably doesn't ever make sense to supply more than two. 35 | 36 | derek.long@cis.strath.ac.uk 37 | 38 | Strathclyde Planning Group 39 | */ 40 | 41 | #include 42 | #include 43 | #include 44 | #include "ptree.h" 45 | #include "FlexLexer.h" 46 | #include "Analyser.h" 47 | 48 | extern int yyparse(); 49 | extern int yydebug; 50 | 51 | 52 | using std::ifstream; 53 | using std::ofstream; 54 | 55 | namespace VAL { 56 | 57 | parse_category* top_thing=NULL; 58 | 59 | analysis an_analysis; 60 | analysis* current_analysis; 61 | 62 | yyFlexLexer* yfl; 63 | 64 | }; 65 | 66 | char * current_filename; 67 | using namespace VAL; 68 | 69 | int main(int argc,char * argv[]) 70 | { 71 | current_analysis= &an_analysis; 72 | an_analysis.pred_tab.replaceFactory(); 73 | 74 | ifstream* current_in_stream; 75 | yydebug=0; // Set to 1 to output yacc trace 76 | 77 | yfl= new yyFlexLexer; 78 | 79 | // Loop over given args 80 | for (int a=1; abad()) 86 | { 87 | // Output a message now 88 | cout << "Failed to open\n"; 89 | 90 | // Log an error to be reported in summary later 91 | line_no= 0; 92 | log_error(E_FATAL,"Failed to open file"); 93 | } 94 | else 95 | { 96 | line_no= 1; 97 | 98 | // Switch the tokeniser to the current input stream 99 | yfl->switch_streams(current_in_stream,&cout); 100 | yyparse(); 101 | 102 | // Output syntax tree 103 | //if (top_thing) top_thing->display(0); 104 | } 105 | delete current_in_stream; 106 | } 107 | // Output the errors from all input files 108 | current_analysis->error_list.report(); 109 | delete yfl; 110 | Analyser a; 111 | current_analysis->the_problem->visit(&a); 112 | current_analysis->the_domain->visit(&a); 113 | current_analysis->the_domain->predicates->visit(&a); 114 | } 115 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/PinguPlanGenerator.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __PINGUPLANGEN 28 | #define __PINGUPLANGEN 29 | 30 | #include "ptree.h" 31 | #include "VisitController.h" 32 | #include 33 | #include "TypedAnalyser.h" 34 | #include "TimSupport.h" 35 | #include 36 | #include 37 | #include 38 | 39 | using std::string; 40 | using std::pair; 41 | using std::map; 42 | using std::cout; 43 | using std::set; 44 | using namespace TIM; 45 | 46 | namespace VAL { 47 | 48 | struct PinguPosition { 49 | float first; 50 | float second; 51 | int di; 52 | 53 | PinguPosition(float f1,float f2,int d) : first(f1), second(f2), di(d) {}; 54 | }; 55 | 56 | struct PinguAction { 57 | string name; 58 | int x; 59 | int y; 60 | 61 | PinguAction(string n,int x1,int y1) : name(n), x(x1), y(y1) {}; 62 | }; 63 | 64 | class PinguPlanGen : public VisitController { 65 | private: 66 | map > position; 67 | set midairLocs; 68 | map bounceLocs; 69 | map recordDirection; 70 | set blocked; 71 | string lastAt; 72 | int count; 73 | 74 | map lastActionTime; 75 | map whoIsAt; 76 | map lastActAt; 77 | map lastActWas; 78 | map path; 79 | int pingu; 80 | int lastMoved; 81 | bool mustDelay; 82 | 83 | void doAction(string,plan_step *); 84 | void doBomb(plan_step *,string,string); 85 | void doBridge(string,string); 86 | void doMine(string,string); 87 | void doBash(string,string); 88 | int findDirection(string); 89 | PinguPosition getPosition(string); 90 | void doThis(string,string); 91 | 92 | public: 93 | PinguPlanGen(char * name); 94 | 95 | virtual void visit_effect_lists(effect_lists * el) 96 | { 97 | for(pc_list::iterator i = el->add_effects.begin(); 98 | i != el->add_effects.end();++i) 99 | { 100 | (*i)->visit(this); 101 | }; 102 | 103 | for(pc_list::iterator i = el->assign_effects.begin(); 104 | i != el->assign_effects.end();++i) 105 | { 106 | (*i)->visit(this); 107 | }; 108 | 109 | for(pc_list::iterator i = el->timed_effects.begin(); 110 | i != el->timed_effects.end();++i) 111 | { 112 | (*i)->visit(this); 113 | }; 114 | }; 115 | 116 | virtual void visit_simple_effect(simple_effect * se); 117 | 118 | virtual void visit_plan_step(plan_step * p); 119 | }; 120 | 121 | }; 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/PartialPlan.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __PARTIALPLAN 28 | #define __PARTIALPLAN 29 | 30 | #include "State.h" 31 | #include "Plan.h" 32 | #include "Validator.h" 33 | #include 34 | 35 | 36 | namespace Inst { 37 | class ActEntry; 38 | }; 39 | 40 | namespace Planner { 41 | 42 | 43 | 44 | class PartialPlan { 45 | private: 46 | VAL::State current; 47 | // This contains the active process effects and some information about the 48 | // active duratives. 49 | VAL::Plan planHead; 50 | VAL::Plan::const_iterator currentStep; 51 | 52 | // Note: Not sure, yet, whether the mismatch between instantiatedOp structures and 53 | // Action structures will cause a problem. We might need a translation between them, 54 | // or, better still, a quick way to interpret a FastEnvironment as an Environment. 55 | 56 | // possibleActions will be created on first entry to a state after an epsilon wait 57 | // or a long wait (or for the initial state). After an action is selected we will 58 | // need to filter all mutex choices out of the collection, but it is not renewed 59 | // until a wait. 60 | vector possibleActions; 61 | vector relevantActions; 62 | 63 | vector scheduledActions; 64 | 65 | bool waited; 66 | VAL::Happening * pending; 67 | 68 | void selfSchedule(Inst::ActEntry *); 69 | void selfCommit(); 70 | void selfWait(double t); 71 | public: 72 | PartialPlan(); 73 | void write(std::ostream & o) const; 74 | int length() const {return planHead.length();}; 75 | 76 | PartialPlan * schedule(Inst::ActEntry *); 77 | PartialPlan * commit(); 78 | PartialPlan * wait(double t); 79 | bool hasWaited() const {return waited;}; 80 | bool canCommit() const {return !scheduledActions.empty();}; 81 | void initialWait(double t); 82 | 83 | double timeToTrigger(); 84 | }; 85 | 86 | struct PartialPlanOrder { 87 | virtual ~PartialPlanOrder() {}; 88 | virtual bool operator()(const PartialPlan * pp1,const PartialPlan * pp2) const = 0; 89 | }; 90 | 91 | struct PartialPlanOrderer { 92 | PartialPlanOrder * ppo; 93 | PartialPlanOrderer(PartialPlanOrder * p) : ppo(p) {}; 94 | PartialPlanOrderer() : ppo(0) {}; 95 | bool operator()(const PartialPlan * pp1,const PartialPlan * pp2) const 96 | { 97 | return ppo->operator()(pp1,pp2); 98 | }; 99 | }; 100 | 101 | struct LongPlanHead : public PartialPlanOrder { 102 | bool operator()(const PartialPlan * pp1,const PartialPlan * pp2) const; 103 | }; 104 | 105 | inline ostream & operator<<(ostream & o,const PartialPlan & pp) 106 | { 107 | pp.write(o); 108 | return o; 109 | }; 110 | 111 | }; 112 | 113 | #endif 114 | 115 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/parse_error.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | Parse error representation 29 | 30 | $Date: 2009-02-05 10:50:26 $ 31 | $Revision: 1.2 $ 32 | 33 | stephen.cresswell@cis.strath.ac.uk 34 | July 2001. 35 | 36 | Strathclyde Planning Group 37 | ---------------------------------------------------------------------------- 38 | */ 39 | 40 | 41 | #ifndef PARSE_ERROR_H 42 | #define PARSE_ERROR_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | #include "ptree.h" 49 | 50 | using std::list; 51 | using std::string; 52 | using std::cout; 53 | 54 | extern int line_no; // Line number global 55 | extern char* current_filename; // file global 56 | 57 | namespace VAL { 58 | 59 | enum error_severity {E_WARNING,E_FATAL}; 60 | 61 | 62 | class parse_error 63 | { 64 | private: 65 | error_severity severity; 66 | char* filename; 67 | int line; 68 | string description; 69 | 70 | public: 71 | 72 | parse_error(error_severity s, const string& d) : 73 | severity(s), 74 | line(line_no), 75 | description(d) 76 | { 77 | filename= current_filename; 78 | }; 79 | 80 | // describe error 81 | void report() 82 | { 83 | cout << filename 84 | << ": line: " 85 | << line 86 | << ": "; 87 | 88 | if (severity==E_FATAL) 89 | cout << "Error: "; 90 | else 91 | cout << "Warning: "; 92 | 93 | cout << description 94 | << '\n'; 95 | }; 96 | }; 97 | 98 | 99 | // It seems to be more sensible to keep errors and warnings together in the 100 | // same list, as we want to output them in the same order that they were 101 | // found. 102 | 103 | class parse_error_list : public list 104 | { 105 | public: 106 | int errors; 107 | int warnings; 108 | 109 | parse_error_list() : errors(0), warnings(0) {}; 110 | 111 | ~parse_error_list() 112 | { 113 | for (iterator i=begin(); i!=end(); ++i) 114 | delete (*i); 115 | }; 116 | 117 | 118 | // parse_error_list is reponsible for creating and 119 | // destroying parse_error objects, 120 | void add(error_severity sev, const string& description) 121 | { 122 | // Use yacc globals to retrieve file and line number; 123 | push_back(new parse_error(sev,description)); 124 | 125 | if (sev==E_WARNING) 126 | ++warnings; 127 | else 128 | ++errors; 129 | }; 130 | 131 | void report() 132 | { 133 | cout << "\nErrors: " << errors 134 | << ", warnings: " << warnings << '\n'; 135 | 136 | for (iterator i=begin(); i!=end(); ++i) 137 | (*i)->report(); 138 | }; 139 | }; 140 | 141 | }; 142 | 143 | #endif /* PARSE_ERROR_H */ 144 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/TypedAnalysis.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /* 28 | main() for the PDDL2.1 Analysis tester 29 | 30 | $Date: 2009-02-05 10:50:24 $ 31 | $Revision: 1.2 $ 32 | 33 | This expects any number of filenames as arguments, although 34 | it probably doesn't ever make sense to supply more than two. 35 | 36 | derek.long@cis.strath.ac.uk 37 | 38 | Strathclyde Planning Group 39 | */ 40 | 41 | #include 42 | #include 43 | #include 44 | #include "ptree.h" 45 | #include "FlexLexer.h" 46 | #include "TypedAnalyser.h" 47 | 48 | 49 | extern int yyparse(); 50 | extern int yydebug; 51 | 52 | using std::ifstream; 53 | using std::ofstream; 54 | 55 | namespace VAL { 56 | 57 | bool Verbose = false; 58 | ostream * report = &cout; 59 | parse_category* top_thing=NULL; 60 | 61 | analysis an_analysis; 62 | analysis* current_analysis; 63 | 64 | yyFlexLexer* yfl; 65 | 66 | TypeChecker * theTC; 67 | 68 | int PropInfo::x = 0; 69 | 70 | }; 71 | 72 | char * current_filename; 73 | using namespace VAL; 74 | 75 | 76 | int main(int argc,char * argv[]) 77 | { 78 | current_analysis= &an_analysis; 79 | an_analysis.pred_tab.replaceFactory(); 80 | an_analysis.func_tab.replaceFactory(); 81 | 82 | ifstream* current_in_stream; 83 | yydebug=0; // Set to 1 to output yacc trace 84 | 85 | yfl= new yyFlexLexer; 86 | 87 | // Loop over given args 88 | for (int a=1; abad()) 94 | { 95 | // Output a message now 96 | cout << "Failed to open\n"; 97 | 98 | // Log an error to be reported in summary later 99 | line_no= 0; 100 | log_error(E_FATAL,"Failed to open file"); 101 | } 102 | else 103 | { 104 | line_no= 1; 105 | 106 | // Switch the tokeniser to the current input stream 107 | yfl->switch_streams(current_in_stream,&cout); 108 | yyparse(); 109 | 110 | // Output syntax tree 111 | //if (top_thing) top_thing->display(0); 112 | } 113 | delete current_in_stream; 114 | } 115 | // Output the errors from all input files 116 | current_analysis->error_list.report(); 117 | delete yfl; 118 | 119 | TypeChecker tc(current_analysis); 120 | theTC = &tc; 121 | 122 | TypePredSubstituter a; 123 | current_analysis->the_problem->visit(&a); 124 | current_analysis->the_domain->visit(&a); 125 | Analyser aa; 126 | current_analysis->the_problem->visit(&aa); 127 | current_analysis->the_domain->visit(&aa); 128 | current_analysis->the_domain->predicates->visit(&aa); 129 | if(current_analysis->the_domain->functions) current_analysis->the_domain->functions->visit(&aa); 130 | } 131 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/AbstractGraph.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __ABSTRACTGRAPH 28 | #define __ABSTRACTGRAPH 29 | 30 | #include "HowAnalyser.h" 31 | 32 | namespace VAL { 33 | 34 | 35 | class AbstractProposition { 36 | private: 37 | extended_pred_symbol * eps; 38 | 39 | public: 40 | AbstractProposition(extended_pred_symbol * e) : eps(e) 41 | {}; 42 | 43 | }; 44 | 45 | class AbstractAction { 46 | private: 47 | HWWAction * hww; 48 | public: 49 | AbstractAction(HWWAction * h) : hww(h) 50 | {}; 51 | 52 | void write(ostream & o) const 53 | { 54 | if(hww){ o << *hww; } else {o << "Nil";}; 55 | }; 56 | 57 | }; 58 | 59 | inline ostream & operator <<(ostream & o, const AbstractAction & a) 60 | { 61 | a.write(o); 62 | return o; 63 | }; 64 | 65 | 66 | class AbstractGraph { 67 | private: 68 | vector factSpike; 69 | vector actionSpike; 70 | 71 | vector factLayerSizes; 72 | vector actionLayerSizes; 73 | 74 | int layers; 75 | 76 | vector acts; 77 | 78 | public: 79 | AbstractGraph() : factLayerSizes(1,0), layers(0) {}; 80 | ~AbstractGraph() 81 | { 82 | for(vector::iterator i = factSpike.begin(); 83 | i != factSpike.end();++i) 84 | { 85 | delete (*i); 86 | }; 87 | for(vector::iterator i = actionSpike.begin(); 88 | i != actionSpike.end();++i) 89 | { 90 | delete (*i); 91 | }; 92 | }; 93 | 94 | void addInitialFact(extended_pred_symbol * eps) 95 | { 96 | factSpike.push_back(new AbstractProposition(eps)); 97 | ++factLayerSizes[0]; 98 | }; 99 | 100 | void addAction(HWWAction * h) 101 | { 102 | acts.push_back(new AbstractAction(h)); 103 | cout << "Added action\n"; 104 | }; 105 | 106 | void develop() 107 | { 108 | factLayerSizes.push_back(0); 109 | while(extend()) 110 | { 111 | cout << "Extended a layer\n"; 112 | factLayerSizes.push_back(0); 113 | addNewFacts(); 114 | }; 115 | 116 | cout << "built\n"; 117 | }; 118 | 119 | private: 120 | void addNewFacts() 121 | {}; 122 | 123 | 124 | bool extend() 125 | { 126 | bool change = false; 127 | actionLayerSizes.push_back(0); 128 | for(unsigned int i = 0;i < acts.size();++i) 129 | { 130 | bool b = newlyApplicable(acts[i]); 131 | cout << "Acts: "; 132 | if(acts[i]) 133 | { 134 | cout << *acts[i]; 135 | } 136 | else 137 | { 138 | cout << "Nil"; 139 | }; 140 | cout << " " << b << "\n"; 141 | if(acts[i] && b) 142 | { 143 | actionSpike.push_back(acts[i]); 144 | acts[i] = 0; 145 | ++actionLayerSizes[layers]; 146 | change = true; 147 | }; 148 | }; 149 | 150 | return change; 151 | }; 152 | 153 | 154 | bool newlyApplicable(AbstractAction * a) 155 | { 156 | static int i = 0; 157 | ++i; 158 | return i < 3; 159 | }; 160 | 161 | }; 162 | 163 | 164 | }; 165 | 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Environment.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:12 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include 48 | #include 49 | 50 | namespace VAL { 51 | 52 | class var_symbol; 53 | class const_symbol; 54 | class Validator; 55 | 56 | }; 57 | 58 | //#undef vector 59 | //#undef map 60 | 61 | using std::map; 62 | using std::vector; 63 | 64 | #ifndef __MYENVIRONMENT 65 | #define __MYENVIRONMENT 66 | 67 | 68 | //#define vector std::vector 69 | 70 | namespace VAL { 71 | 72 | template bool operator != (T & t1,T & t2) {return ! (t1==t2);}; 73 | 74 | struct Environment : public map { 75 | static map > copies; 76 | 77 | double duration; 78 | 79 | Environment * copy(Validator * v) const 80 | { 81 | Environment * e = new Environment(*this); 82 | copies[v].push_back(e); 83 | //cout << "Copy of "<::iterator i = copies[v].begin();i != copies[v].end();++i) 91 | delete *i; 92 | copies[v].clear(); 93 | 94 | //cout << "Deleting the copies of enviroments here!\\\\\n"; 95 | }; 96 | }; 97 | 98 | template 99 | struct EnvironmentParameterIterator { 100 | Environment * env; 101 | TI pi; 102 | 103 | EnvironmentParameterIterator(Environment * f,TI p) : 104 | env(f), pi(p) {}; 105 | 106 | // Having to cast the const is not good...currently we are forced to do it in order 107 | // to interact with Cascader, but should look at fixing it. 108 | const_symbol * operator*() 109 | { 110 | if(const_symbol * s = const_cast(dynamic_cast(*pi))) 111 | { 112 | return s; 113 | }; 114 | return const_cast((*env)[dynamic_cast(*pi)]); 115 | }; 116 | 117 | EnvironmentParameterIterator & operator++() 118 | { 119 | ++pi; 120 | return *this; 121 | }; 122 | 123 | bool operator==(const EnvironmentParameterIterator & li) const 124 | { 125 | return pi==li.pi; 126 | }; 127 | 128 | bool operator!=(const EnvironmentParameterIterator & li) const 129 | { 130 | return pi!=li.pi; 131 | }; 132 | }; 133 | 134 | template 135 | EnvironmentParameterIterator makeIterator(Environment * f,TI p) 136 | { 137 | return EnvironmentParameterIterator(f,p); 138 | }; 139 | 140 | 141 | }; 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/Partitions.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __PARTITIONS 28 | #define __PARTITIONS 29 | 30 | /* This code is designed to support a simple problem in managing partitions. 31 | The idea is that we have a collection of objects that are going to start 32 | off as individuals and, over a series of operations, we are going to merge 33 | them into sets of increasing size. The sets will together form a partition 34 | of the union of all the objects at all times. At the end we want each object 35 | to be mapped to its partition so that we can associate each object with 36 | a unique structure that is identical for all the objects in the same partition. 37 | */ 38 | #include 39 | #include 40 | 41 | template 42 | class Partitioner { 43 | private: 44 | typedef std::pair<_PData,list< _Key > > _pdata; 45 | typedef std::map<_Key,_pdata> _pmap; 46 | 47 | _pmap partitiondata; 48 | _PDataCombine combine; 49 | int partitions; 50 | 51 | struct partitionStruct { 52 | _Key key; 53 | partitionStruct * next; 54 | 55 | partitionStruct(_Key k) : key(k), next(0) {}; 56 | }; 57 | 58 | typedef map<_Key,partitionStruct *> PElink; 59 | PElink pelements; 60 | 61 | partitionStruct * trace(partitionStruct * p) const 62 | { 63 | while(p->next) p = p->next; 64 | return p; 65 | }; 66 | 67 | public: 68 | Partitioner(_PDataCombine c) : combine(c), partitions(0) 69 | {}; 70 | 71 | void add(_Key k,_PData p) 72 | { 73 | if(pelements.find(k) != pelements.end()) return; 74 | list<_Key> sk; 75 | sk.push_front(k); 76 | partitiondata.insert(make_pair(k,make_pair(p,sk))); 77 | pelements[k] = new partitionStruct(k); 78 | partitions++; 79 | }; 80 | 81 | bool contains(_Key k) const 82 | { 83 | return pelements.find(k) != pelements.end(); 84 | }; 85 | 86 | void setData(_Key k,_PData p) 87 | { 88 | if(pelements.find(k) == pelements.end()) 89 | { 90 | add(k,p); 91 | } 92 | else 93 | { 94 | partitiondata[trace(pelements[k])->key].first = p; 95 | }; 96 | }; 97 | 98 | 99 | void connect(_Key k1,_Key k2) 100 | { 101 | if(pelements.find(k1) == pelements.end() || 102 | pelements.find(k2) == pelements.end()) return; 103 | 104 | partitionStruct * e1 = trace(pelements[k1]); 105 | partitionStruct * e2 = trace(pelements[k2]); 106 | 107 | if(e1==e2) return; 108 | partitiondata[e1->key].second.merge(partitiondata[e2->key].second); 109 | partitiondata[e1->key].first = 110 | combine(partitiondata[e1->key].first,partitiondata[e2->key].first); 111 | partitiondata.erase(e2->key); 112 | e2->next = e1; 113 | partitions--; 114 | }; 115 | 116 | _PData getData(_Key k) 117 | { 118 | return partitiondata.find(trace(pelements.find(k)->second)->key)->second.first; 119 | }; 120 | 121 | int count() const 122 | { 123 | return partitions; 124 | }; 125 | 126 | _Key partition(_Key k) const 127 | { 128 | if(pelements.find(k) == pelements.end()) return k; 129 | 130 | return trace(pelements[k])->key; 131 | }; 132 | 133 | typedef typename _pmap::const_iterator PSI; 134 | PSI begin() {return partitiondata.begin();}; 135 | PSI end() {return partitiondata.end();}; 136 | typedef const pair<_Key, _pdata > DataSource; 137 | 138 | static _PData grabData(DataSource & p) 139 | { 140 | return p.second.first; 141 | }; 142 | }; 143 | 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/PrettyPrinter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __PRETTYPRINT 28 | #define __PRETTYPRINT 29 | 30 | #include "WriteController.h" 31 | 32 | namespace VAL { 33 | 34 | class PrettyPrinter : public WriteController { 35 | private: 36 | bool showType; 37 | bool firstCall; 38 | bool inInitial; 39 | public: 40 | PrettyPrinter() : showType(true), firstCall(true), inInitial(false) {}; 41 | 42 | virtual void write_symbol(ostream & o,const symbol *); 43 | virtual void write_const_symbol(ostream & o,const const_symbol *); 44 | virtual void write_var_symbol(ostream & o,const var_symbol *); 45 | virtual void write_pddl_typed_symbol(ostream & o,const pddl_typed_symbol *); 46 | virtual void write_plus_expression(ostream & o,const plus_expression *); 47 | virtual void write_minus_expression(ostream & o,const minus_expression *); 48 | virtual void write_mul_expression(ostream & o,const mul_expression *); 49 | virtual void write_div_expression(ostream & o,const div_expression *); 50 | virtual void write_uminus_expression(ostream & o,const uminus_expression *); 51 | virtual void write_int_expression(ostream & o,const int_expression *); 52 | virtual void write_float_expression(ostream & o,const float_expression *); 53 | virtual void write_special_val_expr(ostream & o,const special_val_expr *); 54 | virtual void write_func_term(ostream & o,const func_term *); 55 | virtual void write_assignment(ostream & o,const assignment *); 56 | virtual void write_goal_list(ostream & o,const goal_list *); 57 | virtual void write_simple_goal(ostream & o,const simple_goal *); 58 | virtual void write_qfied_goal(ostream & o,const qfied_goal *); 59 | virtual void write_conj_goal(ostream & o,const conj_goal *); 60 | virtual void write_disj_goal(ostream & o,const disj_goal *); 61 | virtual void write_timed_goal(ostream & o,const timed_goal *); 62 | virtual void write_imply_goal(ostream & o,const imply_goal *); 63 | virtual void write_neg_goal(ostream & o,const neg_goal *); 64 | virtual void write_comparison(ostream & o,const comparison *); 65 | virtual void write_proposition(ostream & o,const proposition *); 66 | //virtual void write_pred_decl_list(ostream & o,const pred_decl_list *); 67 | //virtual void write_func_decl_list(ostream & o,const func_decl_list *); 68 | virtual void write_pred_decl(ostream & o,const pred_decl *); 69 | virtual void write_func_decl(ostream & o,const func_decl *); 70 | virtual void write_simple_effect(ostream & o,const simple_effect *); 71 | virtual void write_forall_effect(ostream & o,const forall_effect *); 72 | virtual void write_cond_effect(ostream & o,const cond_effect *); 73 | virtual void write_timed_effect(ostream & o,const timed_effect *); 74 | virtual void write_effect_lists(ostream & o,const effect_lists *); 75 | //virtual void write_operator_list(ostream & o,const operator_list *); 76 | virtual void write_operator_(ostream & o,const operator_ *); 77 | virtual void write_action(ostream & o,const action *); 78 | virtual void write_event(ostream & o,const event *); 79 | virtual void write_process(ostream & o,const process *); 80 | virtual void write_durative_action(ostream & o,const durative_action *); 81 | virtual void write_domain(ostream & o,const domain *); 82 | virtual void write_metric_spec(ostream & o,const metric_spec *); 83 | virtual void write_length_spec(ostream & o,const length_spec *); 84 | virtual void write_problem(ostream & o,const problem *); 85 | virtual void write_plan_step(ostream & o,const plan_step *); 86 | }; 87 | 88 | }; 89 | 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/LaTeXSupport.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:20 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | 48 | #ifndef __LATEXSUPPORT 49 | #define __LATEXSUPPORT 50 | 51 | #include 52 | #include 53 | #include 54 | #include "Utils.h" 55 | #include "main.h" 56 | #include "Validator.h" 57 | 58 | 59 | using std::ostream; 60 | using std::string; 61 | using std::vector; 62 | 63 | namespace VAL { 64 | 65 | struct showList { 66 | void operator()(const pair > > > & ps) const 67 | { 68 | if(LaTeX) 69 | { 70 | string s; 71 | *report << ps.first<<" \\>"; 72 | for(vector > >::const_iterator i = ps.second.begin(); i != ps.second.end() ; ++i) 73 | { 74 | s = i->first; 75 | replaceSubStrings(s,"/","/\\-"); 76 | latexString(s); 77 | *report << "\\begin{minipage}[t]{12cm} " << s << " "; 78 | for(vector::const_iterator j = i->second.begin(); 79 | j != i->second.end();++j) 80 | { 81 | *report << *j << " "; 82 | }; 83 | 84 | *report << " \\end{minipage}\\\\\n \\>"; 85 | }; 86 | *report << "\\\\\n"; 87 | } 88 | else 89 | { 90 | cout << "\nValue: " << ps.first << "\n "; 91 | for(vector > >::const_iterator i = ps.second.begin(); 92 | i != ps.second.end();++i) 93 | { 94 | cout << i->first << " "; 95 | copy(i->second.begin(),i->second.end(),ostream_iterator(cout," ")); 96 | cout << "\n"; 97 | }; 98 | }; 99 | }; 100 | }; 101 | 102 | void displayFailedLaTeXList(vector & vs); 103 | 104 | class LaTeXSupport { 105 | private: 106 | int NoGraphPoints; 107 | int noPoints; 108 | int noGCPages; 109 | int noGCPageRows; 110 | vector ganttObjectsAndTypes; 111 | vector ganttObjects; 112 | public: 113 | LaTeXSupport() : NoGraphPoints(500), noGCPages(0), noGCPageRows(0) {}; 114 | void LaTeXHeader(); 115 | void LaTeXPlanReportPrepare(char *); 116 | void LaTeXPlanReport(Validator * v,plan *); 117 | void LaTeXEnd(); 118 | void LaTeXGantt(Validator * v); 119 | void LaTeXGraphs(Validator * v); 120 | void LaTeXDomainAndProblem(); 121 | void LaTeXBuildGraph(ActiveCtsEffects * ace,const State * s); 122 | void setnoGCPages(int g) {noGCPages = g;}; 123 | void setnoGCPageRows(int g) {noGCPageRows = g;}; 124 | void setnoPoints(int n) 125 | { 126 | noPoints = n; 127 | if(noPoints < 10) noPoints = 10; 128 | else if(noPoints > 878) noPoints = 878; 129 | NoGraphPoints = noPoints; 130 | }; 131 | void addGanttObject(char * c) 132 | { 133 | ganttObjectsAndTypes.push_back(c); 134 | }; 135 | }; 136 | 137 | extern LaTeXSupport latex; 138 | 139 | }; 140 | 141 | 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/FuncExp.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:14 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include "FuncExp.h" 48 | #include "State.h" 49 | #include "random.h" 50 | #include "main.h" 51 | #include "RobustAnalyse.h" 52 | 53 | //#define map std::map 54 | namespace VAL { 55 | 56 | double 57 | FuncExp::evaluate(const State * s) const 58 | { 59 | double ans = s->evaluateFE(this); 60 | 61 | if(JudderPNEs && hasChangedCtsly) 62 | { 63 | ans += RobustPNEJudder*(1-2*getRandomNumberUniform()); //if not robustness testing this change will not be activated 64 | }; 65 | return ans; 66 | }; 67 | 68 | string FuncExp::getParameter(int paraNo) const 69 | { 70 | int parameterNo = 1; 71 | for(parameter_symbol_list::const_iterator i = fe->getArgs()->begin(); 72 | i != fe->getArgs()->end();++i) 73 | { 74 | if(paraNo == parameterNo) 75 | { 76 | if(dynamic_cast(*i)) 77 | { 78 | return bindings.find(dynamic_cast(*i))->second->getName(); 79 | } 80 | else 81 | 82 | { 83 | return (*i)->getName(); 84 | 85 | }; 86 | }; 87 | ++parameterNo; 88 | 89 | }; 90 | 91 | return ""; 92 | }; 93 | 94 | bool FuncExp::checkConstantsMatch(const parameter_symbol_list* psl) const 95 | { 96 | const_symbol * aConst; 97 | 98 | parameter_symbol_list::const_iterator ps = psl->begin(); //from event 99 | for(parameter_symbol_list::const_iterator i = fe->getArgs()->begin(); //from func 100 | i != fe->getArgs()->end();++i) 101 | { 102 | if(dynamic_cast(*ps)) 103 | { 104 | 105 | if(const var_symbol * aVariable = dynamic_cast(*i)) 106 | { 107 | aConst = const_cast(bindings.find(aVariable)->second); 108 | } 109 | else 110 | { 111 | aConst = const_cast(dynamic_cast(*i)); 112 | }; 113 | 114 | if(*ps != aConst) return false; 115 | }; 116 | 117 | ++ps; 118 | }; 119 | 120 | return true; 121 | }; 122 | 123 | ostream & operator <<(ostream & o,const FuncExp & fe) 124 | { 125 | fe.write(o); 126 | return o; 127 | }; 128 | 129 | void FuncExp::setChangedCtsly() 130 | { 131 | hasChangedCtsly = true; 132 | }; 133 | 134 | Environment FuncExpFactory::nullEnv; 135 | 136 | FuncExpFactory::~FuncExpFactory() 137 | { 138 | for(map::const_iterator i = funcexps.begin();i != funcexps.end();++i) 139 | delete const_cast(i->second); 140 | }; 141 | 142 | }; 143 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/SASActions.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include "SASActions.h" 28 | #include "ToFunction.h" 29 | #include "instantiation.h" 30 | 31 | using namespace TIM; 32 | using namespace Inst; 33 | 34 | namespace SAS { 35 | 36 | PreMap SASActionTemplate::preMap; 37 | map > SASActionTemplate::otherprecs; 38 | 39 | 40 | bool SegmentRep::growOneLevel(const pddl_type * pt,const TIMobjectSymbol * tob, 41 | FunctionStructure * fs) 42 | { 43 | // Need to be careful here: the valuereps.size will change as new actions are added 44 | // and we don't want to include them at the same level they are activated by an action. 45 | 46 | int last = levelcounts[levelcounts.size()-2]; 47 | int sz = levelcounts[levelcounts.size()-1]; 48 | bool activated = false; 49 | // levelcounts.push_back(sz); 50 | 51 | for(int i = last;i < sz;++i) 52 | { 53 | // cout << "Handling a value: " << pt->getName() << " " << tob->getName() << " " << 54 | // valuereps[i]->getSegment() << " " << *(valuereps[i]->getValue()) << "\n"; 55 | int seg = valuereps[i]->getSegment(); 56 | for(vector >::iterator j = 57 | SASActionTemplate::findOps(pt,seg).begin(); 58 | j != SASActionTemplate::findOps(pt,seg).end();++j) 59 | { 60 | // cout << j->second->getOp()->name->getName() << "\n"; 61 | int k = fs->startFor(j->second->getOp()); 62 | int ke = fs->endFor(j->second->getOp()); 63 | for(OpStore::iterator iop = instantiatedOp::from(k); 64 | k != ke;++k,++iop) 65 | { 66 | // cout << "Considering " << *instantiatedOp::getInstOp(k) << "\n"; 67 | if((*(*iop)->getEnv())[j->first] != tob) 68 | { 69 | // cout << "Irrelevant\n"; 70 | continue; 71 | }; 72 | activated |= fs->tryMatchedPre(k,*iop, 73 | j->first,j->second,valuereps[i]); 74 | }; 75 | }; 76 | }; 77 | return activated; 78 | }; 79 | 80 | bool ValueRep::matches(ValueRep * vrep,FastEnvironment * fenv) 81 | { 82 | if(segment != vrep->segment) return false; 83 | return vel->matches(vrep->vel,fenv); 84 | 85 | }; 86 | 87 | void SASActionTemplate::enact(FastEnvironment * fenv,Reachables & reachables, 88 | vector & others) 89 | { 90 | for(VMap::iterator i = postconditions.begin();i != postconditions.end();++i) 91 | { 92 | RangeRep * rr = reachables[i->first->type][TOB((*fenv)[i->first])]; 93 | for(vector::iterator j = i->second.begin();j != i->second.end();++j) 94 | { 95 | rr->add(*j,fenv); 96 | }; 97 | }; 98 | for(vector::iterator i = otherposts.begin();i != otherposts.end();++i) 99 | { 100 | vector::iterator j = others.begin(); 101 | for(;j != others.end();++j) 102 | { 103 | if((*i)->head == (*j)->head) 104 | { 105 | break; 106 | }; 107 | }; 108 | if(j == others.end()) 109 | { 110 | others.push_back(*i); 111 | }; 112 | }; 113 | }; 114 | 115 | bool SASActionTemplate::checkPre(FunctionStructure * fs,FastEnvironment * fenv, 116 | const var_symbol * v,ValueRep * vrep) 117 | { 118 | // cout << "Checking " << *this << "\n"; 119 | for(vector::iterator i = preconditions[v].begin(); 120 | i != preconditions[v].end();++i) 121 | { 122 | if(vrep->matches(*i,fenv)) return true; 123 | }; 124 | return false; 125 | }; 126 | 127 | ValueRep::ValueRep(ValueRep * vr,FastEnvironment * fenv) : 128 | segment(vr->segment), vel(new ValueElement(vr->vel,fenv)) 129 | {}; 130 | 131 | }; 132 | 133 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/TypeStrip.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL2.2 29 | 30 | $Date: 2009-02-05 10:50:24 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox and Derek Long - PDDL2.2 and VAL 34 | Stephen Cresswell - PDDL2.2 Parser 35 | Richard Howey - Continuous Effects, derived predicates, timed initial literals and LaTeX report in VAL 36 | 37 | maria.fox@cis.strath.ac.uk 38 | derek.long@cis.strath.ac.uk 39 | stephen.cresswell@cis.strath.ac.uk 40 | richard.howey@cis.strath.ac.uk 41 | 42 | By releasing this code we imply no warranty as to its reliability 43 | and its use is entirely at your own risk. 44 | 45 | Strathclyde Planning Group 46 | http://planning.cis.strath.ac.uk 47 | ----------------------------------------------------------------------------*/ 48 | #include 49 | #include 50 | #include 51 | #include "ptree.h" 52 | #include "FlexLexer.h" 53 | #include "TypeStripWC.h" 54 | 55 | using std::ifstream; 56 | using std::ofstream; 57 | using std::cerr; 58 | using std::cout; 59 | using std::ostream; 60 | 61 | extern int yyparse(); 62 | extern int yydebug; 63 | 64 | namespace VAL { 65 | parse_category* top_thing=NULL; 66 | 67 | 68 | 69 | analysis an_analysis; 70 | analysis* current_analysis; 71 | 72 | yyFlexLexer * yfl; 73 | 74 | bool Verbose = false; 75 | ostream * report = & cout; 76 | }; 77 | 78 | char * current_filename; 79 | using namespace VAL; 80 | 81 | int main(int argc,char * argv[]) 82 | { 83 | current_analysis = & an_analysis; 84 | 85 | yfl = new yyFlexLexer; 86 | 87 | ifstream current_in_stream(argv[1]); 88 | yydebug=0; // Set to 1 to output yacc trace 89 | 90 | cout << "Processing file: " << argv[1] << '\n'; 91 | 92 | if (current_in_stream.bad()) 93 | { 94 | cout << "Failed to open\n"; 95 | // Log an error to be reported in summary later 96 | line_no= 0; 97 | log_error(E_FATAL,"Failed to open file"); 98 | } 99 | else 100 | { 101 | line_no= 1; 102 | 103 | // Switch the tokeniser to the current input stream 104 | yfl->switch_streams(¤t_in_stream,&cout); 105 | yyparse(); 106 | 107 | // Output syntax tree 108 | unique_ptr ts 109 | = unique_ptr(new TypeStripWriteController(current_analysis)); 110 | parse_category::setWriteController(ts); 111 | if (top_thing) 112 | { 113 | string nm(argv[1]); 114 | nm += ".untyped"; 115 | ofstream domfile(nm.c_str()); 116 | domfile << *top_thing; 117 | }; 118 | } 119 | // Output the errors from all input files 120 | current_analysis->error_list.report(); 121 | delete yfl; 122 | 123 | for(int i = 2;i < argc;++i) 124 | { 125 | yfl = new yyFlexLexer; 126 | ifstream problem_in_stream(argv[i]); 127 | cout << "Processing file: " << argv[i] << "\n"; 128 | if (problem_in_stream.bad()) 129 | { 130 | cout << "Failed to open\n"; 131 | // Log an error to be reported in summary later 132 | line_no= 0; 133 | log_error(E_FATAL,"Failed to open file"); 134 | } 135 | else 136 | { 137 | line_no= 1; 138 | 139 | // Switch the tokeniser to the current input stream 140 | yfl->switch_streams(&problem_in_stream,&cout); 141 | yyparse(); 142 | 143 | if (top_thing) 144 | { 145 | string nm(argv[2]); 146 | nm += ".untyped"; 147 | ofstream probfile(nm.c_str()); 148 | probfile << *top_thing; 149 | }; 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/Relax.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL2.2 29 | 30 | $Date: 2009-02-05 10:50:22 $ 31 | $Revision: 1.1 $ 32 | 33 | Maria Fox and Derek Long - PDDL2.2 and VAL 34 | Stephen Cresswell - PDDL2.2 Parser 35 | Richard Howey - Continuous Effects, derived predicates, timed initial literals and LaTeX report in VAL 36 | 37 | maria.fox@cis.strath.ac.uk 38 | derek.long@cis.strath.ac.uk 39 | stephen.cresswell@cis.strath.ac.uk 40 | richard.howey@cis.strath.ac.uk 41 | 42 | By releasing this code we imply no warranty as to its reliability 43 | and its use is entirely at your own risk. 44 | 45 | Strathclyde Planning Group 46 | http://planning.cis.strath.ac.uk 47 | ----------------------------------------------------------------------------*/ 48 | #include 49 | #include 50 | #include 51 | #include "ptree.h" 52 | #include "FlexLexer.h" 53 | #include "RelaxTranslator.h" 54 | 55 | using std::ifstream; 56 | using std::ofstream; 57 | using std::cout; 58 | 59 | extern int yyparse(); 60 | extern int yydebug; 61 | 62 | namespace VAL { 63 | 64 | parse_category* top_thing=NULL; 65 | 66 | 67 | analysis an_analysis; 68 | analysis* current_analysis; 69 | 70 | yyFlexLexer * yfl; 71 | 72 | bool Verbose = false; 73 | bool LaTeX = false; 74 | 75 | }; 76 | 77 | 78 | char * current_filename; 79 | using namespace VAL; 80 | 81 | int main(int argc,char * argv[]) 82 | { 83 | current_analysis = & an_analysis; 84 | 85 | yfl = new yyFlexLexer; 86 | 87 | ifstream current_in_stream(argv[1]); 88 | yydebug=0; // Set to 1 to output yacc trace 89 | 90 | cout << "Processing file: " << argv[1] << '\n'; 91 | RelaxTranslator * dyna = 0; 92 | 93 | if (current_in_stream.bad()) 94 | { 95 | cout << "Failed to open\n"; 96 | // Log an error to be reported in summary later 97 | line_no= 0; 98 | log_error(E_FATAL,"Failed to open file"); 99 | } 100 | else 101 | { 102 | line_no= 1; 103 | 104 | // Switch the tokeniser to the current input stream 105 | yfl->switch_streams(¤t_in_stream,&cout); 106 | yyparse(); 107 | 108 | // Output syntax tree 109 | dyna = new RelaxTranslator(current_analysis); 110 | unique_ptr ts 111 | = unique_ptr(dyna); 112 | // NOTE: We pass responsibility for dyna into parse_category. There 113 | // is no need to garbage collect it. BUT we access dyna later through 114 | // this pointer, so beware! 115 | parse_category::setWriteController(ts); 116 | if (top_thing) 117 | { 118 | string nm(argv[1]); 119 | nm += ".rlx"; 120 | ofstream domfile(nm.c_str()); 121 | domfile << *top_thing; 122 | }; 123 | } 124 | // Output the errors from all input files 125 | current_analysis->error_list.report(); 126 | delete yfl; 127 | 128 | for(int i = 2;i < argc;++i) 129 | { 130 | yfl = new yyFlexLexer; 131 | ifstream problem_in_stream(argv[i]); 132 | cout << "Processing file: " << argv[i] << "\n"; 133 | if (problem_in_stream.bad()) 134 | { 135 | cout << "Failed to open\n"; 136 | // Log an error to be reported in summary later 137 | line_no= 0; 138 | log_error(E_FATAL,"Failed to open file"); 139 | } 140 | else 141 | { 142 | line_no= 1; 143 | 144 | // Switch the tokeniser to the current input stream 145 | yfl->switch_streams(&problem_in_stream,&cout); 146 | yyparse(); 147 | 148 | if (top_thing) 149 | { 150 | string nm(argv[2]); 151 | nm += ".rlx"; 152 | ofstream probfile(nm.c_str()); 153 | probfile << *top_thing; 154 | }; 155 | } 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/DYNA.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL2.2 29 | 30 | $Date: 2009-02-05 10:50:11 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox and Derek Long - PDDL2.2 and VAL 34 | Stephen Cresswell - PDDL2.2 Parser 35 | Richard Howey - Continuous Effects, derived predicates, timed initial literals and LaTeX report in VAL 36 | 37 | maria.fox@cis.strath.ac.uk 38 | derek.long@cis.strath.ac.uk 39 | stephen.cresswell@cis.strath.ac.uk 40 | richard.howey@cis.strath.ac.uk 41 | 42 | By releasing this code we imply no warranty as to its reliability 43 | and its use is entirely at your own risk. 44 | 45 | Strathclyde Planning Group 46 | http://planning.cis.strath.ac.uk 47 | ----------------------------------------------------------------------------*/ 48 | #include 49 | #include 50 | #include 51 | #include "ptree.h" 52 | #include "FlexLexer.h" 53 | #include "DYNATranslator.h" 54 | 55 | using std::ifstream; 56 | using std::ofstream; 57 | using std::cout; 58 | 59 | extern int yyparse(); 60 | extern int yydebug; 61 | 62 | namespace VAL { 63 | 64 | parse_category* top_thing=NULL; 65 | 66 | 67 | analysis an_analysis; 68 | analysis* current_analysis; 69 | 70 | yyFlexLexer * yfl; 71 | 72 | bool Verbose = false; 73 | bool LaTeX = false; 74 | 75 | }; 76 | 77 | 78 | char * current_filename; 79 | using namespace VAL; 80 | 81 | int main(int argc,char * argv[]) 82 | { 83 | current_analysis = & an_analysis; 84 | 85 | yfl = new yyFlexLexer; 86 | 87 | ifstream current_in_stream(argv[1]); 88 | yydebug=0; // Set to 1 to output yacc trace 89 | 90 | cout << "Processing file: " << argv[1] << '\n'; 91 | DYNATranslator * dyna = 0; 92 | 93 | if (current_in_stream.bad()) 94 | { 95 | cout << "Failed to open\n"; 96 | // Log an error to be reported in summary later 97 | line_no= 0; 98 | log_error(E_FATAL,"Failed to open file"); 99 | } 100 | else 101 | { 102 | line_no= 1; 103 | 104 | // Switch the tokeniser to the current input stream 105 | yfl->switch_streams(¤t_in_stream,&cout); 106 | yyparse(); 107 | 108 | // Output syntax tree 109 | dyna = new DYNATranslator(current_analysis); 110 | unique_ptr ts 111 | = unique_ptr(dyna); 112 | // NOTE: We pass responsibility for dyna into parse_category. There 113 | // is no need to garbage collect it. BUT we access dyna later through 114 | // this pointer, so beware! 115 | parse_category::setWriteController(ts); 116 | if (top_thing) 117 | { 118 | string nm(argv[1]); 119 | nm += ".dyna"; 120 | ofstream domfile(nm.c_str()); 121 | domfile << *top_thing; 122 | }; 123 | } 124 | // Output the errors from all input files 125 | current_analysis->error_list.report(); 126 | delete yfl; 127 | 128 | for(int i = 2;i < argc;++i) 129 | { 130 | yfl = new yyFlexLexer; 131 | ifstream problem_in_stream(argv[i]); 132 | cout << "Processing file: " << argv[i] << "\n"; 133 | if (problem_in_stream.bad()) 134 | { 135 | cout << "Failed to open\n"; 136 | // Log an error to be reported in summary later 137 | line_no= 0; 138 | log_error(E_FATAL,"Failed to open file"); 139 | } 140 | else 141 | { 142 | line_no= 1; 143 | 144 | // Switch the tokeniser to the current input stream 145 | yfl->switch_streams(&problem_in_stream,&cout); 146 | yyparse(); 147 | 148 | if (top_thing) 149 | { 150 | string nm(argv[2]); 151 | nm += ".dyna"; 152 | ofstream probfile(nm.c_str()); 153 | probfile << *top_thing; 154 | nm += ".durations"; 155 | ofstream dursfile(nm.c_str()); 156 | dursfile << dyna->yieldDurations(); 157 | // Note the access to lpgp even though this was wraped in an 158 | // autopointer inside the current analysis. 159 | }; 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/LPGP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL2.2 29 | 30 | $Date: 2009-02-05 10:50:19 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox and Derek Long - PDDL2.2 and VAL 34 | Stephen Cresswell - PDDL2.2 Parser 35 | Richard Howey - Continuous Effects, derived predicates, timed initial literals and LaTeX report in VAL 36 | 37 | maria.fox@cis.strath.ac.uk 38 | derek.long@cis.strath.ac.uk 39 | stephen.cresswell@cis.strath.ac.uk 40 | richard.howey@cis.strath.ac.uk 41 | 42 | By releasing this code we imply no warranty as to its reliability 43 | and its use is entirely at your own risk. 44 | 45 | Strathclyde Planning Group 46 | http://planning.cis.strath.ac.uk 47 | ----------------------------------------------------------------------------*/ 48 | #include 49 | #include 50 | #include 51 | #include "ptree.h" 52 | #include "FlexLexer.h" 53 | #include "LPGPTranslator.h" 54 | 55 | using std::ifstream; 56 | using std::ofstream; 57 | using std::cout; 58 | 59 | extern int yyparse(); 60 | extern int yydebug; 61 | 62 | namespace VAL { 63 | 64 | parse_category* top_thing=NULL; 65 | 66 | 67 | analysis an_analysis; 68 | analysis* current_analysis; 69 | 70 | yyFlexLexer * yfl; 71 | 72 | bool Verbose = false; 73 | bool LaTeX = false; 74 | 75 | }; 76 | 77 | 78 | char * current_filename; 79 | using namespace VAL; 80 | 81 | int main(int argc,char * argv[]) 82 | { 83 | current_analysis = & an_analysis; 84 | 85 | yfl = new yyFlexLexer; 86 | 87 | ifstream current_in_stream(argv[1]); 88 | yydebug=0; // Set to 1 to output yacc trace 89 | 90 | cout << "Processing file: " << argv[1] << '\n'; 91 | LPGPTranslator * lpgp = 0; 92 | 93 | if (current_in_stream.bad()) 94 | { 95 | cout << "Failed to open\n"; 96 | // Log an error to be reported in summary later 97 | line_no= 0; 98 | log_error(E_FATAL,"Failed to open file"); 99 | } 100 | else 101 | { 102 | line_no= 1; 103 | 104 | // Switch the tokeniser to the current input stream 105 | yfl->switch_streams(¤t_in_stream,&cout); 106 | yyparse(); 107 | 108 | // Output syntax tree 109 | lpgp = new LPGPTranslator(current_analysis); 110 | unique_ptr ts 111 | = unique_ptr(lpgp); 112 | // NOTE: We pass responsibility for lpgp into parse_category. There 113 | // is no need to garbage collect it. BUT we access lpgp later through 114 | // this pointer, so beware! 115 | parse_category::setWriteController(ts); 116 | if (top_thing) 117 | { 118 | string nm(argv[1]); 119 | nm += ".lpgp"; 120 | ofstream domfile(nm.c_str()); 121 | domfile << *top_thing; 122 | }; 123 | } 124 | // Output the errors from all input files 125 | current_analysis->error_list.report(); 126 | delete yfl; 127 | 128 | for(int i = 2;i < argc;++i) 129 | { 130 | yfl = new yyFlexLexer; 131 | ifstream problem_in_stream(argv[i]); 132 | cout << "Processing file: " << argv[i] << "\n"; 133 | if (problem_in_stream.bad()) 134 | { 135 | cout << "Failed to open\n"; 136 | // Log an error to be reported in summary later 137 | line_no= 0; 138 | log_error(E_FATAL,"Failed to open file"); 139 | } 140 | else 141 | { 142 | line_no= 1; 143 | 144 | // Switch the tokeniser to the current input stream 145 | yfl->switch_streams(&problem_in_stream,&cout); 146 | yyparse(); 147 | 148 | if (top_thing) 149 | { 150 | string nm(argv[2]); 151 | nm += ".lpgp"; 152 | ofstream probfile(nm.c_str()); 153 | probfile << *top_thing; 154 | nm += ".durations"; 155 | ofstream dursfile(nm.c_str()); 156 | dursfile << lpgp->yieldDurations(); 157 | // Note the access to lpgp even though this was wraped in an 158 | // autopointer inside the current analysis. 159 | }; 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /SMTPlan/include/SMTPlan/Algebraist.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file describes the Algebraist class. 3 | * This class uses a Computer Algebra System to perform the necessary 4 | * integration and differentiation of continuous change in the PDDL 5 | * domain, before the problem is encoded. 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include "ptree.h" 19 | #include "instantiation.h" 20 | #include "VisitController.h" 21 | #include "FastEnvironment.h" 22 | #include "TIM.h" 23 | 24 | #include "SMTPlan/PlannerOptions.h" 25 | #include "SMTPlan/ProblemInfo.h" 26 | 27 | #ifndef KCL_algebraist 28 | #define KCL_algebraist 29 | 30 | // polynomials over R||Q 31 | using pexpr = piranha::polynomial>; 32 | 33 | namespace SMTPlan 34 | { 35 | 36 | struct SingleFlow 37 | { 38 | std::set operators; 39 | std::set dependencies; 40 | std::vector derivatives; 41 | pexpr polynomial; 42 | }; 43 | 44 | /* 45 | * Describes the continuous change of a singe PDDL function 46 | */ 47 | class FunctionFlow 48 | { 49 | public: 50 | 51 | int f_id; 52 | pexpr function_var; 53 | std::string function_string; 54 | std::vector flows; 55 | bool integrated; 56 | 57 | ~FunctionFlow() {} 58 | 59 | void addExpression(int opID, std::set deps, pexpr &expr); 60 | void createChildren(std::map &allFlows); 61 | bool dependenciesResolved(std::map &allFlows); 62 | void integrate(); 63 | }; 64 | 65 | class Algebraist : public VAL::VisitController 66 | { 67 | public: 68 | 69 | std::map function_flow; 70 | std::map function_id_map; 71 | std::map predicate_head_map; 72 | 73 | private: 74 | 75 | enum AlgState 76 | { 77 | ALG_NONE, 78 | ALG_COLLECT_STATICS, 79 | ALG_PROCESS_FUNCTIONS 80 | }; 81 | 82 | AlgState alg_state; 83 | 84 | /* problem info */ 85 | PlannerOptions * opt; 86 | ProblemInfo * problem_info; 87 | VAL::FastEnvironment * fe; 88 | VAL::analysis * val_analysis; 89 | 90 | /* piranha environment */ 91 | std::string alg_function_symbol; 92 | std::vector alg_expression_stack; 93 | std::set alg_dependency_stack; 94 | 95 | std::map function_var; 96 | pexpr hasht{"hasht"}; 97 | 98 | /* utility method */ 99 | void checkFunction(Inst::PNE * const lit) { 100 | 101 | map::iterator fit = function_var.find(lit->getID()); 102 | if(fit != function_var.end()) return; 103 | 104 | 105 | std::stringstream ss; 106 | ss << (*lit); 107 | pexpr fv = pexpr{ss.str()}; 108 | function_var[lit->getID()] = fv; 109 | function_id_map[ss.str()] = lit->getID(); 110 | predicate_head_map[lit->getID()] = lit->getHead()->getName(); 111 | 112 | map::iterator it = function_flow.find(lit->getID()); 113 | if(it == function_flow.end()) { 114 | FunctionFlow* ff = new FunctionFlow(); 115 | 116 | ff->function_var = function_var[lit->getID()]; 117 | ff->function_string = ss.str(); 118 | ff->f_id = lit->getID(); 119 | ff->integrated = false; 120 | 121 | function_flow[lit->getID()] = ff; 122 | } 123 | }; 124 | 125 | public: 126 | 127 | Algebraist(VAL::analysis* analysis, PlannerOptions &options, ProblemInfo &pi) 128 | { 129 | problem_info = π 130 | val_analysis = analysis; 131 | } 132 | 133 | ~Algebraist() 134 | { 135 | map::iterator it = function_flow.begin(); 136 | for (; it != function_flow.end(); ++it) delete it->second; 137 | } 138 | 139 | /* encoding methods */ 140 | bool processDomain(); 141 | 142 | /* visitor methods */ 143 | virtual void visit_durative_action(VAL::durative_action * da); 144 | 145 | virtual void visit_assignment(VAL::assignment * e); 146 | virtual void visit_forall_effect(VAL::forall_effect * e); 147 | virtual void visit_cond_effect(VAL::cond_effect * e); 148 | virtual void visit_timed_effect(VAL::timed_effect * e); 149 | virtual void visit_timed_initial_literal(VAL::timed_initial_literal * til); 150 | virtual void visit_effect_lists(VAL::effect_lists * e); 151 | 152 | virtual void visit_plus_expression(VAL::plus_expression * s); 153 | virtual void visit_minus_expression(VAL::minus_expression * s); 154 | virtual void visit_mul_expression(VAL::mul_expression * s); 155 | virtual void visit_div_expression(VAL::div_expression * s); 156 | virtual void visit_uminus_expression(VAL::uminus_expression * s); 157 | virtual void visit_int_expression(VAL::int_expression * s); 158 | virtual void visit_float_expression(VAL::float_expression * s); 159 | virtual void visit_special_val_expr(VAL::special_val_expr * s); 160 | virtual void visit_func_term(VAL::func_term * s); 161 | 162 | virtual void visit_preference(VAL::preference *); 163 | virtual void visit_event(VAL::event * e); 164 | virtual void visit_process(VAL::process * p); 165 | virtual void visit_derivation_rule(VAL::derivation_rule * o); 166 | }; 167 | 168 | } // close namespace 169 | 170 | #endif 171 | 172 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/FuncExp.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | /*----------------------------------------------------------------------------- 28 | VAL - The Automatic Plan Validator for PDDL+ 29 | 30 | $Date: 2009-02-05 10:50:14 $ 31 | $Revision: 1.2 $ 32 | 33 | Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL 34 | Stephen Cresswell - PDDL Parser 35 | 36 | maria.fox@cis.strath.ac.uk 37 | derek.long@cis.strath.ac.uk 38 | stephen.cresswell@cis.strath.ac.uk 39 | richard.howey@cis.strath.ac.uk 40 | 41 | By releasing this code we imply no warranty as to its reliability 42 | and its use is entirely at your own risk. 43 | 44 | Strathclyde Planning Group 45 | http://planning.cis.strath.ac.uk 46 | ----------------------------------------------------------------------------*/ 47 | #include 48 | #include 49 | 50 | #include "ptree.h" 51 | #include "Environment.h" 52 | #include "Utils.h" 53 | 54 | #ifndef __FUNCEXP 55 | #define __FUNCEXP 56 | 57 | //#define map std::map 58 | using std::map; 59 | 60 | namespace VAL { 61 | 62 | class State; 63 | extern bool LaTeX; 64 | 65 | 66 | class FuncExp { 67 | private: 68 | const Environment & bindings; 69 | const func_term * fe; 70 | 71 | bool hasChangedCtsly; //for testing robustness w.r.t. numerical accuracy 72 | public: 73 | FuncExp(const func_term * f,const Environment &bs) : 74 | bindings(bs), fe(f), hasChangedCtsly(false) 75 | {}; 76 | 77 | double evaluate(const State * s) const; 78 | string getName() const {return fe->getFunction()->getName();}; 79 | string getParameter(int paraNo) const; 80 | bool checkConstantsMatch(const parameter_symbol_list* psl) const; 81 | void setChangedCtsly(); 82 | 83 | 84 | void write(ostream & o) const 85 | { 86 | string st = "(" + fe->getFunction()->getName(); 87 | for(parameter_symbol_list::const_iterator i = fe->getArgs()->begin(); 88 | i != fe->getArgs()->end();++i) 89 | { 90 | if(dynamic_cast(*i)) 91 | { 92 | st += " " + bindings.find(dynamic_cast(*i))->second->getName(); 93 | } 94 | else 95 | { 96 | st += " " + (*i)->getName(); 97 | }; 98 | }; 99 | st += ")"; 100 | 101 | if(LaTeX) latexString(st); 102 | o << st; 103 | }; 104 | }; 105 | 106 | 107 | ostream & operator <<(ostream & o,const FuncExp & fe); 108 | 109 | class FuncExpFactory { 110 | private: 111 | static Environment nullEnv; 112 | map funcexps; 113 | public: 114 | const FuncExp * buildFuncExp(const func_term * f) 115 | { 116 | string s(f->getFunction()->getName()); 117 | 118 | for(parameter_symbol_list::const_iterator i = f->getArgs()->begin(); 119 | i != f->getArgs()->end();++i) 120 | { 121 | s += (*i)->getName(); 122 | }; 123 | map::const_iterator i1 = funcexps.find(s); 124 | if(i1 != funcexps.end()) 125 | return i1->second; 126 | const FuncExp * p = funcexps[s] = new FuncExp(f,nullEnv); 127 | return p; 128 | }; 129 | const FuncExp * buildFuncExp(const func_term * f,const Environment & bs) 130 | { 131 | string s(f->getFunction()->getName()); 132 | for(parameter_symbol_list::const_iterator i = f->getArgs()->begin(); 133 | i != f->getArgs()->end();++i) 134 | { 135 | if(dynamic_cast(*i)) 136 | { 137 | map::const_iterator j = bs.find(dynamic_cast(*i)); 138 | if(j != bs.end()) 139 | { 140 | s += j->second->getName(); 141 | } 142 | else 143 | { 144 | cout << "Error: could not find parameter "<(*i)->getName()<<"\n"; 145 | exit(-1); 146 | }; 147 | } 148 | else 149 | { 150 | s += (*i)->getName(); 151 | }; 152 | }; 153 | map::const_iterator i1 = funcexps.find(s); 154 | if(i1 != funcexps.end()) 155 | return i1->second; 156 | const FuncExp * p = funcexps[s] = new FuncExp(f,bs); 157 | return p; 158 | }; 159 | 160 | ~FuncExpFactory(); 161 | }; 162 | 163 | }; 164 | 165 | 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/include/DebugWriteController.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #ifndef __DWRITECONTROLLER 28 | #define __DWRITECONTROLLER 29 | 30 | #include "WriteController.h" 31 | 32 | namespace VAL { 33 | 34 | class DebugWriteController : public WriteController { 35 | protected: 36 | int indent; 37 | public: 38 | DebugWriteController() : indent(0) {}; 39 | virtual ~DebugWriteController() {}; 40 | 41 | virtual void write_symbol(ostream & o,const symbol *); 42 | virtual void write_const_symbol(ostream & o,const const_symbol *); 43 | virtual void write_class_symbol(ostream & o,const class_symbol *); 44 | virtual void write_var_symbol(ostream & o,const var_symbol *); 45 | virtual void write_pddl_typed_symbol(ostream & o,const pddl_typed_symbol *); 46 | virtual void write_plus_expression(ostream & o,const plus_expression *); 47 | virtual void write_minus_expression(ostream & o,const minus_expression *); 48 | virtual void write_mul_expression(ostream & o,const mul_expression *); 49 | virtual void write_div_expression(ostream & o,const div_expression *); 50 | virtual void write_uminus_expression(ostream & o,const uminus_expression *); 51 | virtual void write_int_expression(ostream & o,const int_expression *); 52 | virtual void write_float_expression(ostream & o,const float_expression *); 53 | virtual void write_special_val_expr(ostream & o,const special_val_expr *); 54 | virtual void write_func_term(ostream & o,const func_term *); 55 | virtual void write_class_func_term(ostream & o,const class_func_term *); 56 | virtual void write_assignment(ostream & o,const assignment *); 57 | virtual void write_goal_list(ostream & o,const goal_list *); 58 | virtual void write_simple_goal(ostream & o,const simple_goal *); 59 | virtual void write_qfied_goal(ostream & o,const qfied_goal *); 60 | virtual void write_conj_goal(ostream & o,const conj_goal *); 61 | virtual void write_disj_goal(ostream & o,const disj_goal *); 62 | virtual void write_timed_goal(ostream & o,const timed_goal *); 63 | virtual void write_imply_goal(ostream & o,const imply_goal *); 64 | virtual void write_neg_goal(ostream & o,const neg_goal *); 65 | virtual void write_comparison(ostream & o,const comparison *); 66 | virtual void write_proposition(ostream & o,const proposition *); 67 | virtual void write_pred_decl_list(ostream & o,const pred_decl_list *); 68 | virtual void write_func_decl_list(ostream & o,const func_decl_list *); 69 | virtual void write_pred_decl(ostream & o,const pred_decl *); 70 | virtual void write_func_decl(ostream & o,const func_decl *); 71 | virtual void write_simple_effect(ostream & o,const simple_effect *); 72 | virtual void write_forall_effect(ostream & o,const forall_effect *); 73 | virtual void write_cond_effect(ostream & o,const cond_effect *); 74 | virtual void write_timed_effect(ostream & o,const timed_effect *); 75 | virtual void write_timed_initial_literal(ostream & o,const timed_initial_literal *); 76 | virtual void write_effect_lists(ostream & o,const effect_lists *); 77 | virtual void write_operator_list(ostream & o,const operator_list *); 78 | virtual void write_derivations_list(ostream & o,const derivations_list * d); 79 | virtual void write_derivation_rule(ostream & o,const derivation_rule * d); 80 | virtual void write_operator_(ostream & o,const operator_ *); 81 | virtual void write_action(ostream & o,const action *); 82 | virtual void write_event(ostream & o,const event *); 83 | virtual void write_process(ostream & o,const process *); 84 | virtual void write_durative_action(ostream & o,const durative_action *); 85 | virtual void write_class_def(ostream & o,const class_def *); 86 | virtual void write_domain(ostream & o,const domain *); 87 | virtual void write_metric_spec(ostream & o,const metric_spec *); 88 | virtual void write_length_spec(ostream & o,const length_spec *); 89 | virtual void write_problem(ostream & o,const problem *); 90 | virtual void write_plan_step(ostream & o,const plan_step *); 91 | virtual void write_preference(ostream & o,const preference *); 92 | virtual void write_violation_term(ostream & o,const violation_term *); 93 | virtual void write_constraint_goal(ostream & o,const constraint_goal *); 94 | }; 95 | 96 | }; 97 | 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/TIMMain.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Copyright 2008, Strathclyde Planning Group, 3 | * Department of Computer and Information Sciences, 4 | * University of Strathclyde, Glasgow, UK 5 | * http://planning.cis.strath.ac.uk/ 6 | * 7 | * Maria Fox, Richard Howey and Derek Long - VAL 8 | * Stephen Cresswell - PDDL Parser 9 | * 10 | * This file is part of VAL, the PDDL validator. 11 | * 12 | * VAL is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * VAL is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with VAL. If not, see . 24 | * 25 | ************************************************************************/ 26 | 27 | #include 28 | #include "ptree.h" 29 | #include "TIM.h" 30 | 31 | #include "instantiation.h" 32 | #include "SimpleEval.h" 33 | 34 | using namespace TIM; 35 | using namespace VAL; 36 | using namespace Inst; 37 | 38 | int main(int argc,char * argv[]) 39 | { 40 | 41 | performTIMAnalysis(&argv[1]); 42 | 43 | 44 | for_each(TA->pbegin(),TA->pend(), 45 | ptrwriter(cout,"\n")); 46 | for_each(TA->abegin(),TA->aend(), 47 | ptrwriter(cout,"\n")); 48 | /* 49 | SimpleEvaluator::setInitialState(); 50 | for(operator_list::const_iterator os = current_analysis->the_domain->ops->begin(); 51 | os != current_analysis->the_domain->ops->end();++os) 52 | { 53 | cout << (*os)->name->getName() << "\n"; 54 | instantiatedOp::instantiate(*os,current_analysis->the_problem,*theTC); 55 | cout << instantiatedOp::howMany() << " so far\n"; 56 | }; 57 | cout << instantiatedOp::howMany() << "\n"; 58 | instantiatedOp::writeAll(cout); 59 | 60 | cout << "\nList of all literals:\n"; 61 | instantiatedOp::createAllLiterals(current_analysis->the_problem); 62 | instantiatedOp::writeAllLiterals(cout); 63 | 64 | const pred_symbol * p = *(dynamic_cast(current_analysis->pred_tab.symbol_probe("at"))->pBegin()); 65 | set ls1 = instantiatedOp::allLiterals(p); 66 | const pred_symbol * p1 = *(dynamic_cast(current_analysis->pred_tab.symbol_probe("near"))->pBegin()); 67 | set ls2 = instantiatedOp::allLiterals(p1); 68 | 69 | 70 | for(set::iterator i = ls1.begin();i != ls1.end();++i) 71 | { 72 | for(set::iterator j = ls2.begin();j != ls2.end();++j) 73 | { 74 | cout << "Checking " << **i << " and " << **j << "..." 75 | << isMutex((*i)->getHead(),(*i)->begin(),(*i)->end(), 76 | (*j)->getHead(),(*j)->begin(),(*j)->end()) 77 | << "\n"; 78 | }; 79 | }; 80 | 81 | for_each(current_analysis->the_domain->ops->begin(), 82 | current_analysis->the_domain->ops->end(),showMutex); 83 | 84 | VAL::operator_* A = *(current_analysis->the_domain->ops->begin()); 85 | VAL::operator_* B = *(++current_analysis->the_domain->ops->begin()); 86 | vector argsA, argsB; 87 | for(var_symbol_list::iterator i = A->parameters->begin();!(i == A->parameters->end());++i) 88 | { 89 | argsA.push_back(*(theTC->range(*i).begin())); 90 | }; 91 | for(var_symbol_list::iterator i = B->parameters->begin();!(i == B->parameters->end());++i) 92 | { 93 | argsB.push_back(*(theTC->range(*i).begin())); 94 | }; 95 | for_each(argsA.begin(),argsA.end(),ptrwriter(cout," ")); 96 | cout << "\n"; 97 | for_each(argsB.begin(),argsB.end(),ptrwriter(cout," ")); 98 | cout << "\n"; 99 | 100 | cout << "Mutexes for " << A->name->getName() << " and " << B->name->getName() << "\n" << 101 | getMutexes(A,argsA.begin(),argsA.end(), 102 | B,argsB.begin(),argsB.end()) << "\n"; 103 | 104 | 105 | 106 | string args[] = {"truck0","depot0","distributor0"}; 107 | 108 | typedef string * strP; 109 | 110 | cout << *(instantiatedOp::getInstOp(string("drive"),Iterator(args), 111 | Iterator(args+3))) << "\n"; 112 | */ 113 | 114 | domain* the_domain = current_analysis->the_domain; 115 | the_domain->predicates->write(std::cout); 116 | 117 | std::cout << "Print the predicate vars" << std::endl; 118 | 119 | pred_decl_list* predicates = the_domain->predicates; 120 | for (pred_decl_list::const_iterator ci = predicates->begin(); ci != 121 | predicates->end(); ci++) 122 | { 123 | holding_pred_symbol * hps = HPS((*ci)->getPred()); 124 | for(holding_pred_symbol::PIt i = hps->pBegin();i != hps->pEnd();++i) 125 | { 126 | TIMpredSymbol * tps = cTPS(*i); 127 | tps -> write(std::cout); 128 | std::cout << "\nIs definitely static " << 129 | tps->isDefinitelyStatic() << tps->isStatic() << std::endl; 130 | std::cout << ", "; 131 | } 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/Parser/pddl+.lex: -------------------------------------------------------------------------------- 1 | %{ 2 | 3 | #include 4 | 5 | #include 6 | using std::cin; 7 | using std::cout; 8 | using std::cerr; 9 | using std::istream; 10 | using namespace VAL; 11 | extern "C" int yywrap(); 12 | 13 | %} 14 | %option case-insensitive 15 | 16 | char [a-zA-Z_] 17 | digit [0-9] 18 | int -?{digit}* 19 | float -?{digit}+(\.{digit}*)? 20 | string {char}+(-|{char}|{digit})* 21 | whitespace [ \t]+ 22 | nl \n 23 | comment ;.*$ 24 | at_time "at"{whitespace}{float} 25 | 26 | %% 27 | "(" {return OPEN_BRAC;} 28 | ")" {return CLOSE_BRAC;} 29 | "[" {return OPEN_SQ;} 30 | "]" {return CLOSE_SQ;} 31 | ":requirements" {return REQS;} 32 | ":equality" {return EQUALITY;} 33 | ":strips" {return STRIPS;} 34 | ":adl" {return ADL;} 35 | ":typing" {return TYPING;} 36 | ":disjunctive-preconditions" {return DISJUNCTIVE_PRECONDS;} 37 | ":existential-preconditions" {return EXT_PRECS;} 38 | ":universal-preconditions" {return UNIV_PRECS;} 39 | ":quantified-preconditions" {return QUANT_PRECS;} 40 | ":conditional-effects" {return COND_EFFS;} 41 | ":fluents" {return FLUENTS;} 42 | ":numeric-fluents" {return NUMERICFLUENTS;} 43 | ":object-fluents" {return OBJECTFLUENTS;} 44 | ":action-costs" {return ACTIONCOSTS;} 45 | ":time" {return TIME;} 46 | ":preferences" {return PREFERENCES;} 47 | ":constraints" {return CONSTRAINTS;} 48 | ":constants" {return CONSTANTS;} 49 | ":predicates" {return PREDS;} 50 | ":functions" {return FUNCTIONS;} 51 | ":classes" {return CLASSES;} 52 | ":class" {return CLASS;} 53 | ":types" {return TYPES;} 54 | ":durative-actions" {return DURATIVE_ACTIONS;} 55 | ":duration-inequalities" {return DURATION_INEQUALITIES;} 56 | ":continuous-effects" {return CONTINUOUS_EFFECTS;} 57 | ":negative-preconditions" {return NEGATIVE_PRECONDITIONS;} 58 | ":derived-predicates" {return DERIVED_PREDICATES;} 59 | ":timed-initial-literals" {return TIMED_INITIAL_LITERALS;} 60 | "define" {return DEFINE;} 61 | "domain" {return PDDLDOMAIN;} 62 | ":action" {return ACTION;} 63 | ":process" {return PROCESS;} 64 | ":event" {return EVENT;} 65 | ":durative-action" {return DURATIVE_ACTION;} 66 | ":derived" {return DERIVED;} 67 | ":parameters" {return ARGS;} 68 | ":precondition" {return PRE;} 69 | ":condition" {return CONDITION;} 70 | ":start-precondition" {return START_PRE;} 71 | ":end-precondition" {return END_PRE;} 72 | "at start" {return AT_START;} 73 | "at end" {return AT_END;} 74 | "over all" {return OVER_ALL;} 75 | ":effect" {return EFFECTS;} 76 | ":initial-effect" {return INITIAL_EFFECT;} 77 | ":final-effect" {return FINAL_EFFECT;} 78 | ":invariant" {return INVARIANT;} 79 | ":duration" {return DURATION;} 80 | "and" {return AND;} 81 | "or" {return OR;} 82 | "exists" {return EXISTS;} 83 | "forall" {return FORALL;} 84 | "imply" {return IMPLY;} 85 | "not" {return NOT;} 86 | "when" {return WHEN;} 87 | "either" {return EITHER;} 88 | "problem" {return PROBLEM;} 89 | ":domain" {return FORDOMAIN;} 90 | ":objects" {return OBJECTS;} 91 | ":init" {return INITIALLY;} 92 | ":goal" {return GOALS;} 93 | "=" {return EQ;} 94 | ":length" {return LENGTH;} 95 | ":serial" {return SERIAL;} 96 | ":parallel" {return PARALLEL;} 97 | ":metric" {return METRIC;} 98 | "minimize" {return MINIMIZE;} 99 | "maximize" {return MAXIMIZE;} 100 | "is-violated" {return ISVIOLATED;} 101 | "#t" {return HASHT;} 102 | "duration" {return DURATION_VAR;} 103 | "total-time" {return TOTAL_TIME;} 104 | ^"time" {return TIME;} 105 | "number" {return NUMBER;} 106 | "increase" {return INCREASE;} 107 | "decrease" {return DECREASE;} 108 | "scale-up" {return SCALE_UP;} 109 | "scale-down" {return SCALE_DOWN;} 110 | "assign" {return ASSIGN;} 111 | "preference" {return PREFERENCE;} 112 | "always" {return ALWAYS;} 113 | "sometime" {return SOMETIME;} 114 | "within" {return WITHIN;} 115 | "at-most-once" {return ATMOSTONCE;} 116 | "sometime-after" {return SOMETIMEAFTER;} 117 | "sometime-before" {return SOMETIMEBEFORE;} 118 | "always-within" {return ALWAYSWITHIN;} 119 | "hold-during" {return HOLDDURING;} 120 | "hold-after" {return HOLDAFTER;} 121 | "+" {return PLUS;} 122 | "-" {return HYPHEN;} 123 | "*" {return MUL;} 124 | "/" {return DIV;} 125 | ">" {return GREATER;} 126 | ">=" {return GREATEQ;} 127 | "<" {return LESS;} 128 | "<=" {return LESSEQ;} 129 | "?" {return Q;} 130 | ":" {return COLON;} 131 | "." {return DOT;} 132 | ":modules" {return MODULES;} 133 | 134 | {at_time} {unsigned int i; 135 | for(i = 3;i < strlen(yytext);++i) 136 | { 137 | if(yytext[i] != '\t' && yytext[i] != ' ') break; 138 | }; 139 | yylval.fval = atof(yytext+i); 140 | return (AT_TIME); 141 | } 142 | 143 | 144 | {string} {unsigned int i; 145 | yylval.cp = new char[strlen(yytext)+1]; 146 | strcpy(yylval.cp,yytext); 147 | for(i = 0;ifunc_tab.symbol_probe(yylval.cp) != NULL) 153 | return FUNCTION_SYMBOL; 154 | else 155 | return NAME;} 156 | 157 | {whitespace} ; 158 | {comment} ; 159 | {nl} {line_no++;}; 160 | 161 | {int} {yylval.ival = atoi(yytext);return (INTVAL);} 162 | {float} {yylval.fval = atof(yytext);return (FLOATVAL);} 163 | 164 | %% 165 | 166 | 167 | extern "C++" { 168 | int yyFlexLexer::yywrap() 169 | { 170 | return 1; 171 | }; 172 | }; 173 | 174 | -------------------------------------------------------------------------------- /SMTPlan/src/VALfiles/src/pddl+.lex: -------------------------------------------------------------------------------- 1 | %{ 2 | 3 | #include 4 | 5 | #include 6 | using std::cin; 7 | using std::cout; 8 | using std::cerr; 9 | using std::istream; 10 | using namespace VAL; 11 | extern "C" int yywrap(); 12 | 13 | %} 14 | %option case-insensitive 15 | 16 | char [a-zA-Z_] 17 | digit [0-9] 18 | int -?{digit}* 19 | float -?{digit}+(\.{digit}*)? 20 | string {char}+(-|{char}|{digit})* 21 | whitespace [ \t]+ 22 | nl \n 23 | comment ;.*$ 24 | at_time "at"{whitespace}{float} 25 | flawed {digit}+{char}+ 26 | 27 | %% 28 | "(" {return OPEN_BRAC;} 29 | ")" {return CLOSE_BRAC;} 30 | "[" {return OPEN_SQ;} 31 | "]" {return CLOSE_SQ;} 32 | ":requirements" {return REQS;} 33 | ":equality" {return EQUALITY;} 34 | ":strips" {return STRIPS;} 35 | ":adl" {return ADL;} 36 | ":typing" {return TYPING;} 37 | ":disjunctive-preconditions" {return DISJUNCTIVE_PRECONDS;} 38 | ":existential-preconditions" {return EXT_PRECS;} 39 | ":universal-preconditions" {return UNIV_PRECS;} 40 | ":quantified-preconditions" {return QUANT_PRECS;} 41 | ":conditional-effects" {return COND_EFFS;} 42 | ":fluents" {return FLUENTS;} 43 | ":numeric-fluents" {return NUMERICFLUENTS;} 44 | ":object-fluents" {return OBJECTFLUENTS;} 45 | ":action-costs" {return ACTIONCOSTS;} 46 | ":time" {return TIME;} 47 | ":preferences" {return PREFERENCES;} 48 | ":constraints" {return CONSTRAINTS;} 49 | ":constants" {return CONSTANTS;} 50 | ":predicates" {return PREDS;} 51 | ":functions" {return FUNCTIONS;} 52 | ":classes" {return CLASSES;} 53 | ":class" {return CLASS;} 54 | ":types" {return TYPES;} 55 | ":durative-actions" {return DURATIVE_ACTIONS;} 56 | ":duration-inequalities" {return DURATION_INEQUALITIES;} 57 | ":continuous-effects" {return CONTINUOUS_EFFECTS;} 58 | ":negative-preconditions" {return NEGATIVE_PRECONDITIONS;} 59 | ":derived-predicates" {return DERIVED_PREDICATES;} 60 | ":timed-initial-literals" {return TIMED_INITIAL_LITERALS;} 61 | "define" {return DEFINE;} 62 | "domain" {return PDDLDOMAIN;} 63 | ":action" {return ACTION;} 64 | ":process" {return PROCESS;} 65 | ":event" {return EVENT;} 66 | ":durative-action" {return DURATIVE_ACTION;} 67 | ":derived" {return DERIVED;} 68 | ":parameters" {return ARGS;} 69 | ":precondition" {return PRE;} 70 | ":condition" {return CONDITION;} 71 | ":start-precondition" {return START_PRE;} 72 | ":end-precondition" {return END_PRE;} 73 | "at start" {return AT_START;} 74 | "at end" {return AT_END;} 75 | "over all" {return OVER_ALL;} 76 | ":effect" {return EFFECTS;} 77 | ":initial-effect" {return INITIAL_EFFECT;} 78 | ":final-effect" {return FINAL_EFFECT;} 79 | ":invariant" {return INVARIANT;} 80 | ":duration" {return DURATION;} 81 | "and" {return AND;} 82 | "or" {return OR;} 83 | "exists" {return EXISTS;} 84 | "forall" {return FORALL;} 85 | "imply" {return IMPLY;} 86 | "not" {return NOT;} 87 | "when" {return WHEN;} 88 | "either" {return EITHER;} 89 | "problem" {return PROBLEM;} 90 | ":domain" {return FORDOMAIN;} 91 | ":objects" {return OBJECTS;} 92 | ":init" {return INITIALLY;} 93 | ":goal" {return GOALS;} 94 | "=" {return EQ;} 95 | ":length" {return LENGTH;} 96 | ":serial" {return SERIAL;} 97 | ":parallel" {return PARALLEL;} 98 | ":metric" {return METRIC;} 99 | "minimize" {return MINIMIZE;} 100 | "maximize" {return MAXIMIZE;} 101 | "is-violated" {return ISVIOLATED;} 102 | "#t" {return HASHT;} 103 | "duration" {return DURATION_VAR;} 104 | "total-time" {return TOTAL_TIME;} 105 | ^"time" {return TIME;} 106 | "number" {return NUMBER;} 107 | "increase" {return INCREASE;} 108 | "decrease" {return DECREASE;} 109 | "scale-up" {return SCALE_UP;} 110 | "scale-down" {return SCALE_DOWN;} 111 | "assign" {return ASSIGN;} 112 | "preference" {return PREFERENCE;} 113 | "always" {return ALWAYS;} 114 | "sometime" {return SOMETIME;} 115 | "within" {return WITHIN;} 116 | "at-most-once" {return ATMOSTONCE;} 117 | "sometime-after" {return SOMETIMEAFTER;} 118 | "sometime-before" {return SOMETIMEBEFORE;} 119 | "always-within" {return ALWAYSWITHIN;} 120 | "hold-during" {return HOLDDURING;} 121 | "hold-after" {return HOLDAFTER;} 122 | "+" {return PLUS;} 123 | "-" {return HYPHEN;} 124 | "*" {return MUL;} 125 | "/" {return DIV;} 126 | ">" {return GREATER;} 127 | ">=" {return GREATEQ;} 128 | "<" {return LESS;} 129 | "<=" {return LESSEQ;} 130 | "?" {return Q;} 131 | ":" {return COLON;} 132 | "." {return DOT;} 133 | ":modules" {return MODULES;} 134 | 135 | {at_time} {unsigned int i; 136 | for(i = 3;i < strlen(yytext);++i) 137 | { 138 | if(yytext[i] != '\t' && yytext[i] != ' ') break; 139 | }; 140 | yylval.fval = atof(yytext+i); 141 | return (AT_TIME); 142 | } 143 | 144 | 145 | {string} {unsigned int i; 146 | yylval.cp = new char[strlen(yytext)+1]; 147 | strcpy(yylval.cp,yytext); 148 | for(i = 0;ifunc_tab.symbol_probe(yylval.cp) != NULL) 154 | return FUNCTION_SYMBOL; 155 | else 156 | return NAME;} 157 | 158 | {whitespace} ; 159 | {comment} ; 160 | {nl} {line_no++;}; 161 | 162 | {int} {yylval.ival = atoi(yytext);return (INTVAL);} 163 | {float} {yylval.fval = atof(yytext);return (FLOATVAL);} 164 | {flawed} {printf("Illegal symbol: %s\n",yytext); exit(0); return 0;} 165 | 166 | %% 167 | 168 | 169 | extern "C++" { 170 | int yyFlexLexer::yywrap() 171 | { 172 | return 1; 173 | }; 174 | }; 175 | 176 | --------------------------------------------------------------------------------