What you’ll build |
|
What you’ll need |
|
Code |
You can download the initial code from here. |
Collapsible sections introduced by |
Planning domain and problem
The planning domain that we are considering concerns the (strongly simplified) domain of house building. A set of predicates are used to describe states and goals of this domain. A set of operations that the agent can use are also defined.
Predicates for describing goals and beliefs (click on
to access the detail)
|
|
Operations (click on
to access the detail)
|
|
QUESTION 1: Modeling the Planning domain and problem (click on
to access the detail)
Given the predicates and operations given above, your tasks are:
-
to write the Planning domain representation in
pddl
in the filehouse_building_domain.pddl
Note: even if each of the predicate and operation that are considered in the problem don’t need any parameter, we considered that each of them has one to be able to use javagp, program that we will use to compute the plan from this representation.
-
to write the Problem domain representation in
pddl
in the filepb1.pddl
for the following situations:-
initial state: the field has been bought
-
final state: the house is built
-
-
You can use the online pddl editor
Document to return |
---|
The |
QUESTION 2: Computing the plan (click on
to access the detail)
From the modeling done in the previous section, your task is to compute the plan using javagp, implemented version of GraphPlan. It uses different heuristics and you can use it on domains and problems written in PDDL compliant form.
-
Download code for javagp
-
Test and validate your domain and problems representation by launching the javagp graphplan planner on them.
Note: to use JavaGP on a domain and problem written in PDDL Language, execute the following command line in the javagp directory:
java -jar javagp.jar -d house_building_domain.pddl -p pb1.pddl
Document to return |
---|
In the accompanying document submitted on e-campus, provide your answer to the following questions: * computed plan from the |
Programming the agent
Now that we have the plan computed from the initial state, goal and operations, let’s turn to its programming in an agent with the Jason
agent programming language. In order to introduce a level of adaptation in the acting part, the operations that are considered in the plan are programmed as Jason subgoals
in a Jason Plan
.
In order to simplify the modeling and the management, we let aside the parameters introduced in the modeling of the operators and predicates in the previous section.
QUESTION 3: Agent definition (click on
to access the detail)
-
If not already done, download and extract the following code, open the folder.
-
Open the
build_house.jcm
mas build_house { agent wood_concrete_seller agent company : companyv1.asl { focus: building_area.houseA } workspace building_area { artifact houseA: simulator.House } }
-
In the code of the agent, look at the plan corresponding to the one you computed (what are the triggering event, the context, the body of this jason plan?).
-
For each of the subgoals created in the body of this plan, there is a jason plan for achieving each of them. Achieving each of these subgoals in our case corresponds to execute the following external actions (each of this external action corresponds to the call of an operation executed on the artifact of type
House
created in the environment.House
is an /artifact/, java class defined in thesrc/env
folder):-
prepareSite
-
layFloors
-
buildWalls
-
buildRoof
-
fitWindows
-
fitDoors
-
installElectricalSystem
-
installPlumbing
-
paintExterior
-
paintInterior
-
-
Execute and test your agent. You should see the house built on the GUI.
Document to return |
---|
The |
QUESTION 4: Living in the best of the possible worlds (click on
to access the detail)
-
Make a new version of
companyv1.asl
tocompanyv2.asl
. -
Adapt the
build_house.jcm
file so that you can execute this new version of the agent, as follows:
mas build_house { agent wood_concrete_seller agent company : companyv2.asl { focus: building_area.houseA } workspace building_area { artifact houseA: simulator.House } }
-
Execute some of the goals in parallel as the modeling of the operations permits it.
-
Add some comments in the code to explain and justify your choices
-
Execute the agent in the environment
Document to return |
---|
The |
QUESTION 5: Living in a more realistic worlds (click on
to access the detail)
In the previous execution of the agent, every operation executed as if it was in an "ideal world" where all the resources are available and all the actions can execute. However this is not exactly the case in real world situations.
For instance, let’s consider that the site cannot be prepared if the weather is not fine (belief weather(fine)
). How could we change the definition of the plan aiming at realizing the operation prepare_site.
Using the definition of contingency plans, add plans to handle such a situation by blocking the execution of the plan till the belief weather(fine)
becomes true (to that aim, you can use the Jason internal action
.wait(aPredicate)
).
-
Make a new version of
companyv2.asl
tocompanyv3.asl
. -
Adapt the
build_house.jcm
file so that you can execute this new version of the agent as follows:
mas build_house { agent wood_concrete_seller agent company : companyv3.asl { focus: building_area.houseA } workspace building_area { artifact houseA: simulator.House } }
-
Modify the agent code to handle the weather not fine for site preparation
-
Test this new version of the agent
-
Note: In order to make the agent believe that the weather is fine, you can create an agent alice sending it a message telling it that the weather is fine. You can dynamically create this new agent by using the kbd:[New REPL agent] in the console (e.g. agent
alice
) that sends the following message tocompany
agent:
.send(company, tell, weather(fine)).
With this example, we clearly see how the agent executing a predefined plan is able to adapt its execution according to the current context of execution.
Document to return |
---|
The |
QUESTION 6: Living in a world where resources are distributed (click on
to access the detail)
Using the same method, modify and adapt the corresponding plans conditioning the achievement of build_roofs
and build_walls
to the availability of woods and concrete in the stock (beliefs stock(wood)
, stock(concrete)
).
Checking of availability of woods or concrete in your company may be done using a question goal (i.e. goals introduced by ?
).
In order to renew its stock the agent will send a message to the agent wood_concrete_seller
.
To make it simple (you can make it more complex if you wish so), the wood_concrete_seller
agent just sends a message telling that stock(concrete)
and stock(woods)
have been renewed, and this each time an agent requests for it.
Let’s remind that sending a message can be realized with the Jason internal action .send
(see the slides for the different types of messages that can be sent).
Use the verbs corresponding to the type of behaviour that the wood_concrete_seller
executes when receiving the message.
-
Make a new version of
companyv3.asl
tocompanyv4.asl
. -
Adapt the
build_house.jcm
file so that you can execute this new version of the agent as follows:
mas build_house { agent wood_concrete_seller agent company : companyv4.asl { focus: building_area.houseA } workspace building_area { artifact houseA: simulator.House } }
-
Make a generic behaviour (
Jason
plan) so that when the company receives a message from the seller, it updates the stock with the corresponding product. -
Test and execute it.
Document to return |
---|
The |