jadex.examples.cleanerworld.single
Agent Cleaner
- agent Cleaner
The cleaner world as single agent version.
It has these goals:
a) maintain its battery state.
b) clean-up waste and carry it to the wastebin.
c) patrol at night.
Configuration Summary |
default configuration |
default
|
daytime
belief boolean daytime
- Default fact:
true
my_location
belief Location my_location
- Default fact:
new Location(0, 0)
wastebin_location
belief Location wastebin_location
- Default fact:
new Location(0.25, 0.25)
chargingstation_location
belief Location chargingstation_location
- Default fact:
new Location(0.25, 0.75)
speed
belief double speed
- state info
- Default fact:
0.1
vision
belief double vision
- Default fact:
0.1
chargestate
belief double chargestate
- Default fact:
0.80
carrieswaste
belief boolean carrieswaste
- Default fact:
false
is_loading
belief boolean is_loading
- Belief only present to allow old version of cleaner to work, LoadBatteryPlan accesses
- Default fact:
false
gui
belief CleanerGui gui
- Default fact:
new CleanerGui($agent.getExternalAccess())
waste_locations
beliefset Location waste_locations
known_waste_locations
beliefset Location known_waste_locations
patrolpoints
beliefset Location patrolpoints
- Default facts:
new Location(0.1, 0.1)
new Location(0.1, 0.9)
new Location(0.3, 0.9)
new Location(0.3, 0.1)
new Location(0.5, 0.1)
new Location(0.5, 0.9)
new Location(0.7, 0.9)
new Location(0.7, 0.1)
new Location(0.9, 0.1)
new Location(0.9, 0.9)
performlookforwaste
performgoal performlookforwaste()
- BDI flags:
- retry: true
- retry delay: 0
- exclude: never
- random selection: false
- post to all: false
- Context Condition:
$beliefbase.daytime
performpatrol
performgoal performpatrol()
- BDI flags:
- retry: true
- retry delay: 0
- exclude: never
- random selection: false
- post to all: false
- Context Condition:
!$beliefbase.daytime
achievecleanup
achievegoal achievecleanup(Location waste_location)
- Parameters:
- in parameter
waste_location
Default value:
select one Location $waste from $beliefbase.known_waste_locations
order by $waste.getDistance($beliefbase.my_location)
- BDI flags:
- retry: true
- retry delay: 0
- exclude: when_failed
- random selection: false
- post to all: false
- Context Condition:
$beliefbase.daytime
- Creation Condition:
$beliefbase.getBeliefSet("known_waste_locations").size()>0
- Drop Condition:
!$beliefbase.carrieswaste &&
!$beliefbase.getBeliefSet("known_waste_locations").containsFact($goal.waste_location)
- Deliberation:
- cardinality 1
- inhibits
performlookforwaste
- inhibits
achievecleanup
$beliefbase.carrieswaste ||
$beliefbase.my_location.getDistance($goal.waste_location)
< $beliefbase.my_location.getDistance($ref.waste_location)
achievemoveto
achievegoal achievemoveto(Location location)
- Parameters:
- in parameter
location
- BDI flags:
- retry: true
- retry delay: 0
- exclude: when_tried
- random selection: false
- post to all: false
- Target Condition:
$beliefbase.my_location.isNear($goal.location)
maintainbatteryloaded
maintaingoal maintainbatteryloaded()
- BDI flags:
- retry: true
- retry delay: 0
- exclude: when_tried
- random selection: false
- post to all: false
- recur: false
- recur delay: 0
- Maintain Condition:
$beliefbase.chargestate > 0.2
- Target Condition:
$beliefbase.chargestate >= 1.0
- Deliberation:
- inhibits
achievecleanup
- inhibits
performlookforwaste
- inhibits
performpatrol
randomwalk
standard plan randomwalk()
- Plan body:
- Plan trigger:
- Goals:
performlookforwaste
patrol
standard plan patrol()
- Plan body:
- Plan trigger:
- Goals:
performpatrol
cleanup
standard plan cleanup(Location waste_location)
- Parameters:
- in parameter
waste_location
(goal mappings: achievecleanup.waste_location)
- Plan body:
- Plan trigger:
- Goals:
achievecleanup
loadbattery
standard plan loadbattery()
- Plan body:
- Plan trigger:
- Goals:
maintainbatteryloaded
moveto
standard plan moveto(Location location)
- Parameters:
- in parameter
location
(goal mappings: achievemoveto.location)
- Plan body:
- Plan trigger:
- Goals:
achievemoveto
cleanup_waste_beliefs
standard plan cleanup_waste_beliefs()
- Remove vanished wastes from the beliefset "known_waste_locations".
Uses the "query_all_vanished_wastes" to determine the vanished wastes.
- Plan body:
- Plan trigger:
- Condition
(select one Location $known_waste
from $beliefbase.known_waste_locations
where
$known_waste.isNear($beliefbase.my_location, $beliefbase.vision)
&&
(select one Location $waste from $beliefbase.waste_locations
where $waste.isNear($known_waste)
) == null
) != null
wasteseen
standard plan wasteseen()
- Add newly seen waste positions to the known_waste_locations beliefset.
Uses the "query_new_waste_location" to determine the new wastes.
- Plan body:
- Plan trigger:
- Condition
(select one Location $wasteloc
from $beliefbase.waste_locations
where $wasteloc.isNear($beliefbase.my_location, $beliefbase.vision) &&
!$beliefbase.getBeliefSet("known_waste_locations").containsFact($wasteloc))
!= null
query_all_vanished_wastes
expression query_all_vanished_wastes
- Expression:
select Location $known_waste from $beliefbase.known_waste_locations
where $known_waste.isNear($beliefbase.my_location, $beliefbase.vision)
&& (select one Location $waste from $beliefbase.waste_locations
where $waste.isNear($known_waste)) == null
query_new_waste_location
expression query_new_waste_location
- Expression:
select Location $wasteloc from $beliefbase.waste_locations
where $wasteloc.isNear($beliefbase.my_location, $beliefbase.vision) &&
!$beliefbase.getBeliefSet("known_waste_locations").containsFact($wasteloc)
nearest_waste
expression nearest_waste
- Expression:
select one Location $loc
from $beliefbase.waste_locations
where $loc.isNear($mouseloc, $tol.doubleValue())
- Parameter:
Location $mouseloc
- Parameter:
Double $tol
default
default configuration default
- Initial Goals:
- performlookforwaste
- performpatrol
- maintainbatteryloaded
Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples. Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.