Package ora4mas.nopl
Class SchemeBoard
- java.lang.Object
-
- cartago.Artifact
-
- ora4mas.nopl.OrgArt
-
- ora4mas.nopl.SchemeBoard
-
- All Implemented Interfaces:
ToXML
,npl.DynamicFactsProvider
- Direct Known Subclasses:
LightSchemeBoard
public class SchemeBoard extends OrgArt
Artifact to manage a scheme instance.
Operations (see details in the methods list below):- commitMission
- leaveMission
- goalAchieved
- setArgumentValue
- resetGoal
- destroy
- commitment(ag,mission,sch): agent ag is committed to the mission in the scheme (we have as many obs prop as commitments).
e.g.
commitment(bob,mission1,s1)
- groups: a list of groups responsible for the scheme.
e.g.
groups([g1])
- goalState(schId, goal, list of committed agents, list of agents that performed the goal, state); where states are: waiting, enabled, satisfied).
e.g.
goalState(s1,g5,[alice,bob],[alice],satisfied)
- specification: the specification of the scheme in the OS (a prolog like representation).
- obligation(ag,reason,goal,deadline): current active obligations.
e.g.
obligation(bob,ngoal(s1,mission1,g5),done(s1,bid,bob),1475417322254)
- permission(ag,reason,goal,deadline): current active permission.
- goalArgument(schemeId, goalId, argId, value): value of goals' arguments, defined by the operation setArgumentValue
e.g.
goalArgument(sch1, winner, "W", "Bob")
- oblCreated(o): the obligation o is created.
- oblFulfilled(o): the obligation o is fulfilled
- oblUnfulfilled(o): the obligation o is unfulfilled (e.g. by timeout).
- oblInactive(o): the obligation o is inactive (e.g. its maintenance condition does not hold anymore).
e.g.
o = obligation(Ag,_,done(Sch,bid,Ag), TTF)
if thebid
is a performance goal ando = obligation(Ag,_,satisfied(Sch,bid), TTF)
if thebid
is an achievement goal. - normFailure(f): the failure f has happened (e.g. due some regimentation).
e.g.
f = fail(mission_permission(Ag,M,Sch))
. The f comes from the normative program.
- Author:
- Jomi
- See Also:
Scheme
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ora4mas.nopl.OrgArt
OrgArt.Ora4masWSPRuleEngine, OrgArt.UpdateGuiThread
-
-
Field Summary
Fields Modifier and Type Field Description protected static jason.asSyntax.Atom
aEnabled
protected static jason.asSyntax.Atom
aSatisfied
protected static jason.asSyntax.Atom
aWaiting
private java.util.List<cartago.ObsProperty>
goalStObsProps
protected java.util.logging.Logger
logger
static java.lang.String
obsPropCommitment
static java.lang.String
obsPropGroups
static java.lang.String
obsPropSpec
static jason.asSyntax.PredicateIndicator
piGoalState
protected static java.util.Collection<SchemeBoard>
schBoards
protected Scheme
spec
-
Fields inherited from class ora4mas.nopl.OrgArt
dfpListeners, gui, myNPLListener, nengine, oeId, orgBoardName, orgState, ownerAgent, running, runningDestroy, sglDestroyed, sglNormFailure, sglOblCreated, sglOblFulfilled, sglOblInactive, sglOblUnfulfilled, updateGUIThread
-
-
Constructor Summary
Constructors Constructor Description SchemeBoard()
-
Method Summary
Modifier and Type Method Description void
addMission(java.lang.String missionId)
protected boolean
addMissionsInDot()
void
admCommand(java.lang.String cmd)
Commands that the owner of the scheme can perform.void
agKilled(java.lang.String agName)
void
commitMission(java.lang.String mission)
The agent executing this operation tries to commit to a mission in the scheme.protected void
commitMission(java.lang.String ag, java.lang.String mission)
void
debug(java.lang.String kind)
void
destroy()
The agent executing this operation tries to delete the scheme board artifactprotected void
enableSatisfied(java.lang.String goal)
org.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
java.lang.String
getAsDot()
(package private) java.util.List<jason.asSyntax.Literal>
getGoalStates()
protected java.util.logging.Logger
getLogger()
java.lang.String
getNPLSrc()
static java.util.Collection<SchemeBoard>
getSchemeBoards()
Scheme
getSchState()
Scheme
getSpec()
void
getState(cartago.OpFeedbackParam<Scheme> s)
protected java.lang.String
getStyleSheetName()
void
goalAchieved(java.lang.String goal)
The agent executing this operation set the goal as performed by it.protected void
goalDone(java.lang.String agent, java.lang.String goal)
void
init(java.lang.String osFile, java.lang.String schType)
Initialises the scheme artifactvoid
interactionCommand(java.lang.String cmd)
protected boolean
isObsPropEqualsGoal(jason.asSyntax.Literal g, cartago.ObsProperty op)
boolean
isWellFormed()
void
leaveMission(java.lang.String mission)
The agent executing this operation tries to leave/remove its mission in the schemevoid
mergeState(java.lang.Object s)
(package private) void
removeResponsibleGroup(java.lang.String grId)
protected void
reorganise()
void
resetGoal(java.lang.String goal)
The agent executing this operation reset some goal.void
setArgumentValue(java.lang.String goal, java.lang.String var, java.lang.Object value)
The agent executing this operation sets a value for a goal argument.void
setCardinality(java.lang.String element, java.lang.String id, int min, int max)
protected void
updateGoalArgsObsProp()
protected void
updateGoalStateObsProp()
protected void
updateRolePlayers(java.lang.String grId, java.util.Collection<Player> rp)
-
Methods inherited from class ora4mas.nopl.OrgArt
consult, debug, fixAgName, fixOSFile, getArtId, getDebugText, getNormativeEngine, getNormIdTerm, getNSTransformer, getOEId, getOpUserName, getParser, getStyleSheet, getTermsAsProlog, getTermsAsProlog, initNormativeEngine, initWspRuleEngine, installNormativeSignaler, isRelevant, isUserAllowed, notifyListeners, ora4masOperationTemplate, postReorgUpdates, setOrgBoardName, setOwner, specToStr, subscribeDFP, updateGuiOE
-
Methods inherited from class cartago.Artifact
await, await, await_time, beginExtSession, commit, defineNewOp, defineObsProperty, defineOp, delay, dispose, dispose, endExtSession, endExtSessionWithFailure, execInternalOp, execLinkedOp, execLinkedOp, failed, failed, getCreatorId, getCurrentOpAgentBody, getCurrentOpAgentId, getId, getLinkedArtifacts, getManualSrcFile, getObservabilityRadius, getObsProperty, getObsPropertyByTemplate, getOpKey, getPosition, hasObsProperty, hasObsPropertyByTemplate, isLinked, log, lookupArtifact, makeArtifact, removeObsProperty, removeObsPropertyByTemplate, removeOp, setupOperations, setupPosition, signal, signal, updateObservabilityRadius, updateObsProperty, updatePosition
-
-
-
-
Field Detail
-
spec
protected Scheme spec
-
obsPropSpec
public static final java.lang.String obsPropSpec
- See Also:
- Constant Field Values
-
obsPropGroups
public static final java.lang.String obsPropGroups
- See Also:
- Constant Field Values
-
obsPropCommitment
public static final java.lang.String obsPropCommitment
- See Also:
- Constant Field Values
-
piGoalState
public static final jason.asSyntax.PredicateIndicator piGoalState
-
schBoards
protected static java.util.Collection<SchemeBoard> schBoards
-
logger
protected java.util.logging.Logger logger
-
goalStObsProps
private java.util.List<cartago.ObsProperty> goalStObsProps
-
aWaiting
protected static final jason.asSyntax.Atom aWaiting
-
aEnabled
protected static final jason.asSyntax.Atom aEnabled
-
aSatisfied
protected static final jason.asSyntax.Atom aSatisfied
-
-
Method Detail
-
getSchemeBoards
public static java.util.Collection<SchemeBoard> getSchemeBoards()
-
getSchState
public Scheme getSchState()
-
getSpec
public Scheme getSpec()
-
init
public void init(java.lang.String osFile, java.lang.String schType) throws npl.parser.ParseException, MoiseException
Initialises the scheme artifact- Parameters:
osFile
- the organisation specification file (path and file name)schType
- the type of the scheme (as defined in the OS)- Throws:
npl.parser.ParseException
- if the OS file is not correctMoiseException
- if schType was not specified
-
reorganise
protected void reorganise() throws java.lang.Exception
- Throws:
java.lang.Exception
-
debug
public void debug(java.lang.String kind)
-
destroy
public void destroy()
The agent executing this operation tries to delete the scheme board artifact
-
commitMission
public void commitMission(java.lang.String mission) throws cartago.CartagoException
The agent executing this operation tries to commit to a mission in the scheme.Verifications:
- mission max cardinality
- mission permission (if the agent plays a role that permits it to commit to the mission)
- Parameters:
mission
- the mission being committed to- Throws:
npl.NormativeFailureException
- the failure produced if the adoption breaks some regimentationcartago.CartagoException
- some cartago problem
-
commitMission
protected void commitMission(java.lang.String ag, java.lang.String mission) throws cartago.CartagoException
- Throws:
cartago.CartagoException
-
leaveMission
public void leaveMission(java.lang.String mission) throws cartago.CartagoException, MoiseException
The agent executing this operation tries to leave/remove its mission in the schemeVerifications:
- the agent must be committed to the mission
- the mission's goals have to be satisfied (otherwise the agent is obliged to commit again to the mission)
- Parameters:
mission
- the mission being removed- Throws:
npl.NormativeFailureException
- the failure produced if the remove breaks some regimentationcartago.CartagoException
- some cartago problemMoiseException
- some moise inconsistency (the agent is not committed to the mission)
-
goalAchieved
public void goalAchieved(java.lang.String goal) throws cartago.CartagoException
The agent executing this operation set the goal as performed by it.Verifications:
- the agent must be committed to the goal
- the goal has to be enabled
- Throws:
cartago.CartagoException
-
goalDone
protected void goalDone(java.lang.String agent, java.lang.String goal) throws cartago.CartagoException
- Throws:
cartago.CartagoException
-
setArgumentValue
public void setArgumentValue(java.lang.String goal, java.lang.String var, java.lang.Object value) throws cartago.CartagoException
The agent executing this operation sets a value for a goal argument.- Parameters:
goal
- The goal to which the value should be addedvar
- name of the variable to which the value is modifiedvalue
- value set to the variable of the goal- Throws:
cartago.CartagoException
-
resetGoal
public void resetGoal(java.lang.String goal) throws cartago.CartagoException
The agent executing this operation reset some goal. It becomes not achieved, also goals that depends on it or sub-goals are set as unachieved- Parameters:
goal
- The goal to be reset- Throws:
cartago.CartagoException
-
getState
public void getState(cartago.OpFeedbackParam<Scheme> s)
-
mergeState
public void mergeState(java.lang.Object s)
-
admCommand
public void admCommand(java.lang.String cmd) throws cartago.CartagoException, jason.asSyntax.parser.ParseException, jason.NoValueException, MoiseException, npl.parser.ParseException
Commands that the owner of the scheme can perform.- Parameters:
cmd
- , possible values (as strings): commitMission(, ), goalDone( , ) -- for performance goals --, goalSatisfied( ) -- for achievement goals -- setCardinality( , , , ) [element type=mission] - Throws:
cartago.CartagoException
jason.asSyntax.parser.ParseException
MoiseException
jason.NoValueException
npl.parser.ParseException
-
addMission
public void addMission(java.lang.String missionId) throws MoiseException, npl.parser.ParseException
- Throws:
MoiseException
npl.parser.ParseException
-
setCardinality
public void setCardinality(java.lang.String element, java.lang.String id, int min, int max) throws MoiseException, npl.parser.ParseException
- Throws:
MoiseException
npl.parser.ParseException
-
enableSatisfied
protected void enableSatisfied(java.lang.String goal)
-
interactionCommand
public void interactionCommand(java.lang.String cmd) throws cartago.CartagoException, jason.asSyntax.parser.ParseException
- Throws:
cartago.CartagoException
jason.asSyntax.parser.ParseException
-
updateRolePlayers
protected void updateRolePlayers(java.lang.String grId, java.util.Collection<Player> rp) throws npl.NormativeFailureException, cartago.CartagoException
- Throws:
npl.NormativeFailureException
cartago.CartagoException
-
removeResponsibleGroup
void removeResponsibleGroup(java.lang.String grId) throws cartago.CartagoException
- Throws:
cartago.CartagoException
-
updateGoalArgsObsProp
protected void updateGoalArgsObsProp()
-
updateGoalStateObsProp
protected void updateGoalStateObsProp()
-
isObsPropEqualsGoal
protected boolean isObsPropEqualsGoal(jason.asSyntax.Literal g, cartago.ObsProperty op)
-
getGoalStates
java.util.List<jason.asSyntax.Literal> getGoalStates()
-
getStyleSheetName
protected java.lang.String getStyleSheetName()
- Specified by:
getStyleSheetName
in classOrgArt
-
isWellFormed
public boolean isWellFormed()
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
-
addMissionsInDot
protected boolean addMissionsInDot()
-
-