every disk rests on peg-c

blocks archetype · 8 snapshots · plan: findActionPath

    teach it something, then ask it to solve again

    tmct>

    PDDL + OWL/RDF plan artifact

    ;; tmct plan artifact — PDDL-style action sequence + OWL/RDF ontology tags
    ;; goal: every disk rests on peg-c
    ;; because: you taught me the "move onto" rule and 3 ordering facts.
    
    (define (problem tmct-plan)
      (:domain tmct-taught-domain)
    
      ;; :objects — individuals grounded through the taught class hierarchy
      (:objects
        disk-1 disk-2 disk-3 - disk
        peg-a peg-b peg-c - peg
      )
    
      ;; :ontology — the real rdf:type/rdfs:subClassOf rows compileDomain folded
      ;; into domain.classMembers (rdf:type = individual->class, rdfs:subClassOf =
      ;; class->superclass)
      (:ontology
        (rdf:type disk-1 disk)
        (rdf:type disk-2 disk)
        (rdf:type disk-3 disk)
        (rdf:type peg-a peg)
        (rdf:type peg-b peg)
        (rdf:type peg-c peg)
      )
    
      ;; :ordering — the real mgx:*-than facts the taught precondition consulted
      (:ordering
        (mgx:smaller-than disk-1 disk-2)
        (mgx:smaller-than disk-1 disk-3)
        (mgx:smaller-than disk-2 disk-3)
      )
    
      ;; :init — state@0, the taught starting board (real mgx:* predicate tags)
      (:init
        (mgx:rest-on disk-1 disk-2)
        (mgx:rest-on disk-2 disk-3)
        (mgx:rest-on disk-3 peg-a)
      )
    
      ;; :goal
      (:goal (and
        (mgx:rest-on disk-1 peg-c)
        (mgx:rest-on disk-2 peg-c)
        (mgx:rest-on disk-3 peg-c)
      ))
    )
    
    ;; action sequence — findActionPath's own shortest path (7 moves)
    
    (:action move-onto-step1
      :label "move disk-1 onto peg-c"
      :subject disk-1
      :target peg-c
      :precondition (and
        (mgx:rest-on disk-1 disk-2)
      )
      :effect (and
        (not (mgx:rest-on disk-1 disk-2))
        (mgx:rest-on disk-1 peg-c)
      )
    )
    
    (:action move-onto-step2
      :label "move disk-2 onto peg-b"
      :subject disk-2
      :target peg-b
      :precondition (and
        (mgx:rest-on disk-2 disk-3)
      )
      :effect (and
        (not (mgx:rest-on disk-2 disk-3))
        (mgx:rest-on disk-2 peg-b)
      )
    )
    
    (:action move-onto-step3
      :label "move disk-1 onto disk-2"
      :subject disk-1
      :target disk-2
      :precondition (and
        (mgx:rest-on disk-1 peg-c)
      )
      :effect (and
        (not (mgx:rest-on disk-1 peg-c))
        (mgx:rest-on disk-1 disk-2)
      )
    )
    
    (:action move-onto-step4
      :label "move disk-3 onto peg-c"
      :subject disk-3
      :target peg-c
      :precondition (and
        (mgx:rest-on disk-3 peg-a)
      )
      :effect (and
        (not (mgx:rest-on disk-3 peg-a))
        (mgx:rest-on disk-3 peg-c)
      )
    )
    
    (:action move-onto-step5
      :label "move disk-1 onto peg-a"
      :subject disk-1
      :target peg-a
      :precondition (and
        (mgx:rest-on disk-1 disk-2)
      )
      :effect (and
        (not (mgx:rest-on disk-1 disk-2))
        (mgx:rest-on disk-1 peg-a)
      )
    )
    
    (:action move-onto-step6
      :label "move disk-2 onto disk-3"
      :subject disk-2
      :target disk-3
      :precondition (and
        (mgx:rest-on disk-2 peg-b)
      )
      :effect (and
        (not (mgx:rest-on disk-2 peg-b))
        (mgx:rest-on disk-2 disk-3)
      )
    )
    
    (:action move-onto-step7
      :label "move disk-1 onto disk-2"
      :subject disk-1
      :target disk-2
      :precondition (and
        (mgx:rest-on disk-1 peg-a)
      )
      :effect (and
        (not (mgx:rest-on disk-1 peg-a))
        (mgx:rest-on disk-1 disk-2)
      )
    )