Skip to content

Instantly share code, notes, and snippets.

@guicho271828
Created August 15, 2019 21:59
Show Gist options
  • Save guicho271828/33dc4ae2c441adbeb00151f52071982f to your computer and use it in GitHub Desktop.
Save guicho271828/33dc4ae2c441adbeb00151f52071982f to your computer and use it in GitHub Desktop.
Blocksworld
;; -*- mode : lisp -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 4 Op-blocks world
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (domain BLOCKS)
(:requirements :strips)
(:predicates (on ?x ?y)
(ontable ?x)
(clear ?x)
(handempty)
(holding ?x))
(:action pick-up
:parameters (?x)
:precondition (and (clear ?x) (ontable ?x) (handempty))
:effect
(and (not (ontable ?x))
(not (clear ?x))
(not (handempty))
(holding ?x)))
(:action put-down
:parameters (?x)
:precondition (holding ?x)
:effect
(and (not (holding ?x))
(clear ?x)
(handempty)
(ontable ?x)))
(:action stack
:parameters (?x ?y)
:precondition (and (holding ?x) (clear ?y))
:effect
(and (not (holding ?x))
(not (clear ?y))
(clear ?x)
(handempty)
(on ?x ?y)))
(:action unstack
:parameters (?x ?y)
:precondition (and (on ?x ?y) (clear ?x) (handempty))
:effect
(and (holding ?x)
(clear ?y)
(not (clear ?x))
(not (handempty))
(not (on ?x ?y)))))
;; -*- mode : lisp -*-
(define (problem BLOCKS-10-0)
(:domain BLOCKS)
(:objects D A H G B J E I F C )
(:INIT (CLEAR C)
(CLEAR F)
(ONTABLE I)
(ONTABLE F)
(ON C E)
(ON E J)
(ON J B)
(ON B G)
(ON G H)
(ON H A)
(ON A D)
(ON D I)
(HANDEMPTY))
(:goal (AND (ON D C)
(ON C F)
(ON F J)
(ON J E)
(ON E H)
(ON H B)
(ON B A)
(ON A G)
(ON G I))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment