What is planning
“Planning is a discipline of Artificial Intelligence that aims at the development of generic algorithms allowing autonomous systems to choose and organize their actions to achieve a goal by anticipating their effects
---------- (Ghallab, M. and al., 2004)”
From automated planning in a nutshell
Planning languages
人们输入高层指令,由编译器抽象后编译。
youtube IIT AI tutorial
(extention courses)
- assumptions:
- space is finite
- fully observable : perfect perception
- static: only agent can change the world
- deterministic: action won’t fail
- simple goal: goals only be tested in final state. We do not have trajectory constraints. Also, we do not relax our goal(soft constraint).
- plan as sequence, not networks.
- do not do thing in parallel, i.e., durative actions.
- effects: modify the state by adding the predicate if true, deleting the predicate if false
PDDL syntax
PDDL 就是一门语言,跟一般的面向对象语言一样有自己的语法规则。
‘-’ 代表从属关系,city, place, physobj 等属于object
(:types city place physobj - object
package vehicle - physobj
truck airplane - vehicle
airport location - place
)
‘?’代表变量,放在谓语(predicates,(templates for logical facts))中
(:predicates (in-city ?loc - place ?city - city)
(at ?obj - physobj ?loc - place)
(in ?pkg - package ?veh - vehicle))
初始状态
初始状态是一系列ground predicates的集合。 ground predicates中变量不需要加‘?’ ,因为都是真的。
(:init (in-city cdg paris)
(in-city lhr london)
(in-city north paris)
(in-city south paris)
(at plane lhr)
(at truck cdg)
(at p1 lhr)
(at p2 lhr)
)
domain file
- 首先定义一系列object, 包含 robot, 地点,pkg
;; Defining types
(:types
robot - agent
conveyor unit - location
piece operation tray - object
)
- 定义一些约束, 比如最后需要停止
(:constants
stop - operation
)
之后需要对domain建模了。
- 定义一些predicates, 也是词汇表,类似于cpp的class定义数据结构以及一些状态的assertion(盘子在机器人上)。
(:predicates
;robot
(robot_available ?robot - robot)
;; is the robot available? capacity is one
(robot_at ?robot - robot ?l - location)
;; location of a robot. Either a conveyor or a unit
;conveyor
(conveyor_accepted_piece ?piece - piece ?conv - conveyor)
;; constraint on admissible pieces
(conveyor_available ?conv - conveyor)
;; is the conveyor available? capacity is one
(conveyor_unit ?conv - conveyor ?unit - unit)
;; "one-to-many" relation between units and conveyors
...
)
- 之后要定义一些action,比如运输盘子之类。
(:action drop_tray_on_conveyor
:parameters (?robot - robot ?conv - conveyor ?tray - tray ?piece - piece)
:precondition (and (conveyor_available ?conv)
(robot_at ?robot ?conv)
(tray_on_robot ?tray ?robot)
(conveyor_accepted_piece ?piece ?conv)
(piece_on ?piece ?tray)
)
:effect (and (not (conveyor_available ?conv))
(not (tray_on_robot ?tray ?robot))
(tray_on_conv ?tray ?conv)
(robot_available ?robot))
)
PDDL4J web
PDDL WEB EDITOR
下面隆重介绍一款PDDL网页编辑器以及solver生成器:planning.domains。开发者在youtube上有一段教学,我直接搬运过来。
episode 1
打开网页,选择editor进入。
选择“load”,输入远程仓库密码zs0KNVYtQr。
看到许多现成的pddl文件。将其导入vscode:
将会自动打开vscode并提示你下载插件。
你可以打开pddl的problem文件,选择在线找solver:
找到了!虽然本小白看不太懂。