geppetto a language for modeling the behavior of intelligent agents
DESCRIPTION
Geppetto A Language for Modeling the Behavior of Intelligent Agents. By Paul Holmes and Mitchell Aharon. Motivation. Exploring the link between biological intelligence and artificial intelligence. Program Structure. Language Architecture. Entities. Language Architecture. Entities. States. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/1.jpg)
GeppettoA Language for Modeling the Behavior of
Intelligent Agents
By Paul Holmes and Mitchell Aharon
![Page 2: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/2.jpg)
Motivation
Exploring the link between biological intelligence and artificial intelligence
![Page 3: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/3.jpg)
Program Structure
• Property state(string s {“hunting", “eating"});• entity fox {state (s=“hunting”)};
Declarations
• fox.state == “hunting” -> printStatus();Rules• int printStatus() { print “Fox is “ + fox.state); return
0; }Code
![Page 4: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/4.jpg)
Language Architecture
Entities
![Page 5: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/5.jpg)
Language Architecture
Entities States
![Page 6: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/6.jpg)
Language Architecture
Entities States
Rules
![Page 7: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/7.jpg)
Package HierarchyGeppetto
Domain
Declaration
Expression
Parser
Statement
![Page 8: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/8.jpg)
Translator Architecture
![Page 9: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/9.jpg)
Project Management“Nothing is particularly hard if you divide it into small parts.” – Henry Ford
“Begin at the beginning, and go on till you come to the end: then stop” – Lewis Carroll, Alice’s Adventures in Wonderland
![Page 10: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/10.jpg)
Tools
![Page 11: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/11.jpg)
Runtime Environment
• Geppetto interpreter is a Java program• Executed just like any Java program:
java –jar geppetto.jar myprogram.gep
![Page 12: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/12.jpg)
Test Plan• Mostly trial and error• Used toString() to dump contents of AST to console• Added syntax to .gep files for testing as they were coded
![Page 13: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/13.jpg)
Project DemoPredator-Prey Simulation
Featuring Fox & Rabbit
![Page 14: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/14.jpg)
property type(string s {"predator", "prey"});
property state(string s {"foraging", "hunting", "relaxing", "fleeing", "dead"});
property pos(int x{1-10}, int y{1-10});
Anatomy of a Geppetto Fileentity fox {type(s="predator"), state(s="hunting"), pos(x=7, y=5)};entity rabbit {type(s="prey"), state(s="foraging"), pos(x=1, y=1)};
rule (true) -> printStatus(); rule sameLocation (fox.state.s == "hunting" && fox.pos.x == rabbit.pos.x && fox.pos.y == rabbit.pos.y) -> eat();rule differentLocation (fox.state.s == "hunting" && (fox.pos.x != rabbit.pos.x || fox.pos.y != rabbit.pos.y)) -> approach();
int printStatus() { print("fox: state: " + fox.state.s + ", x=" + fox.pos.x + ", y=" + fox.pos.y); print("rabbit: state: " + rabbit.state.s + ", x=" + rabbit.pos.x + ", y=" + rabbit.pos.y); return 0;}
int eat() { print("Gotcha! on cycle " + cycle); fox.state.s = "relaxing"; rabbit.state.s = "dead"; printStatus(); end;}
int approach() { print("Moving toward prey..."); if (fox.pos.x > rabbit.pos.x) fox.pos.x = fox.pos.x - 1; if (fox.pos.x < rabbit.pos.x) fox.pos.x = fox.pox.x + 1;
if (fox.pos.y > rabbit.pos.y) fox.pos.y = fox.pos.y - 1; if (fox.pos.y < rabbit.pos.y) fox.pos.y = fox.pos.y + 1; return 0;}
![Page 15: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/15.jpg)
property type(string s {"predator", "prey"});
property state(string s {"foraging", "hunting",
"relaxing", "fleeing", "dead"});
property pos(int x{1-10}, int y{1-10});
Properties
![Page 16: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/16.jpg)
entity fox {type(s="predator"),
state(s="hunting"), pos(x=7, y=5)};
entity rabbit {type(s="prey"),
state(s="foraging"), pos(x=1, y=1)};
Entities
![Page 17: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/17.jpg)
rule (true) -> printStatus();
rule sameLocation (fox.state.s == "hunting" &&
fox.pos.x == rabbit.pos.x && fox.pos.y ==
rabbit.pos.y) -> eat();
rule differentLocation (fox.state.s == "hunting" &&
(fox.pos.x != rabbit.pos.x || fox.pos.y !=
rabbit.pos.y)) -> approach();
Rules
![Page 18: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/18.jpg)
int printStatus() {
print("fox: state: " + fox.state.s + ", x=" + fox.pos.x + ", y=" + fox.pos.y);
print("rabbit: state: " + rabbit.state.s + ", x=" + rabbit.pos.x + ", y=" + rabbit.pos.y);
return 0;
}
int eat() {
print("Gotcha! on cycle " + cycle);
fox.state.s = "relaxing";
rabbit.state.s = "dead";
printStatus();
end;
}
int approach() {
print("Moving toward prey...");
if (fox.pos.x > rabbit.pos.x)
fox.pos.x = fox.pos.x - 1;
if (fox.pos.x < rabbit.pos.x)
fox.pos.x = fox.pox.x + 1;
if (fox.pos.y > rabbit.pos.y)
fox.pos.y = fox.pos.y - 1;
if (fox.pos.y < rabbit.pos.y)
fox.pos.y = fox.pos.y + 1;
return 0;
}
Code
![Page 19: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/19.jpg)
Running program...
fox: state: hunting, x=7, y=5
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=6, y=4
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=5, y=3
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=4, y=2
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=3, y=1
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=2, y=1
rabbit: state: foraging, x=1, y=1
Moving toward prey...
fox: state: hunting, x=1, y=1
rabbit: state: foraging, x=1, y=1
Gotcha!
fox: state: relaxing, x=1, y=1
rabbit: state: dead, x=1, y=1
End statement encountered. Terminating program.
Program execution complete.
Output
![Page 20: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/20.jpg)
Geppetto’s Purpose
![Page 21: Geppetto A Language for Modeling the Behavior of Intelligent Agents](https://reader036.vdocuments.net/reader036/viewer/2022062811/56815f6a550346895dce6e85/html5/thumbnails/21.jpg)
…though hopefully it won’t come to this…