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:
SimpleSchemeBoard
public class SchemeBoard extends OrgArt
Artifact to manage a scheme instance.
Operations (see details in the methods list below):
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 thebidis a performance goal ando = obligation(Ag,_,satisfied(Sch,bid), TTF)if thebidis 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.UpdateGuiThreadNested classes/interfaces inherited from class cartago.Artifact
cartago.Artifact.AbstractAsyncProcess -
Field Summary
Fields Modifier and Type Field Description protected static jason.asSyntax.AtomaEnabledprotected static jason.asSyntax.AtomaSatisfiedprotected static jason.asSyntax.AtomaWaitingprivate java.util.List<cartago.ObsProperty>goalStObsPropsprotected java.util.logging.Loggerloggerstatic java.lang.StringobsPropCommitmentstatic java.lang.StringobsPropGroupsstatic java.lang.StringobsPropSpecstatic jason.asSyntax.PredicateIndicatorpiGoalStateprotected static java.util.Collection<SchemeBoard>schBoardsprotected SchemespecFields inherited from class ora4mas.nopl.OrgArt
dfpListeners, gui, myNPLListener, nengine, normativeEvtListeners, oeId, orgBoardName, orgState, ownerAgent, running, runningDestroy, sglDestroyed, sglNormFailure, sglOblCreated, sglOblFulfilled, sglOblInactive, sglOblUnfulfilled, sglSanction, updateGUIThreadFields inherited from class cartago.Artifact
observabilityRadius, position, thisOpId -
Constructor Summary
Constructors Constructor Description SchemeBoard() -
Method Summary
Modifier and Type Method Description voidaddMission(java.lang.String missionId)protected booleanaddMissionsInDot()voidadmCommand(java.lang.String cmd)Commands that the owner of the scheme can perform.voidagKilled(java.lang.String agName)voidcommitMission(java.lang.String mission)The agent executing this operation tries to commit to a mission in the scheme.protected voidcommitMission(java.lang.String ag, java.lang.String mission)voiddebug(java.lang.String kind)voiddestroy()The agent executing this operation tries to delete the scheme board artifactprotected voidenableSatisfied(java.lang.String goal)org.w3c.dom.ElementgetAsDOM(org.w3c.dom.Document document)java.lang.StringgetAsDot()(package private) java.util.List<jason.asSyntax.Literal>getGoalStates()protected java.util.logging.LoggergetLogger()java.lang.StringgetNPLSrc()static java.util.Collection<SchemeBoard>getSchemeBoards()SchemegetSchState()SchemegetSpec()voidgetState(cartago.OpFeedbackParam<Scheme> s)protected java.lang.StringgetStyleSheetName()voidgoalAchieved(java.lang.String goal)The agent executing this operation set the goal as performed by it.protected voidgoalDone(java.lang.String agent, java.lang.String goal)voidinit(java.lang.String osFile, java.lang.String schType)Initialises the scheme artifactvoidinteractionCommand(java.lang.String cmd)protected booleanisObsPropEqualsGoal(jason.asSyntax.Literal g, cartago.ObsProperty op)booleanisWellFormed()voidleaveMission(java.lang.String mission)The agent executing this operation tries to leave/remove its mission in the schemevoidmergeState(java.lang.Object s)(package private) voidremoveResponsibleGroup(java.lang.String grId)protected voidreorganise()voidresetGoal(java.lang.String goal)The agent executing this operation reset some goal.voidsetArgumentValue(java.lang.String goal, java.lang.String var, java.lang.Object value)The agent executing this operation sets a value for a goal argument.voidsetCardinality(java.lang.String element, java.lang.String id, int min, int max)protected voidupdateGoalArgsObsProp()protected voidupdateGoalStateObsProp()protected voidupdateRolePlayers(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, notifyDFPListeners, notifyNormativeEventListeners, ora4masOperationTemplate, postReorgUpdates, setOrgBoardName, setOwner, specToStr, subscribeDFP, subscribeNormativeEvents, updateGuiOEMethods 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, updatePositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface npl.DynamicFactsProvider
consultFromCollection, consultFromProviders
-
Field Details
-
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
-
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
-
-
Constructor Details
-
SchemeBoard
public SchemeBoard()
-
-
Method Details
-
getSchemeBoards
-
getLogger
protected java.util.logging.Logger getLogger() -
getSchState
-
getSpec
-
init
public void init(java.lang.String osFile, java.lang.String schType) throws npl.parser.ParseException, MoiseExceptionInitialises 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 -
agKilled
public void agKilled(java.lang.String agName) -
commitMission
public void commitMission(java.lang.String mission) throws cartago.CartagoExceptionThe 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
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.CartagoExceptionThe 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.CartagoExceptionThe 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.CartagoExceptionThe 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
-
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.ParseExceptionCommands 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.CartagoExceptionjason.asSyntax.parser.ParseExceptionMoiseExceptionjason.NoValueExceptionnpl.parser.ParseException
-
addMission
public void addMission(java.lang.String missionId) throws MoiseException, npl.parser.ParseException- Throws:
MoiseExceptionnpl.parser.ParseException
-
setCardinality
public void setCardinality(java.lang.String element, java.lang.String id, int min, int max) throws MoiseException, npl.parser.ParseException- Throws:
MoiseExceptionnpl.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.CartagoExceptionjason.asSyntax.parser.ParseException
-
updateRolePlayers
protected void updateRolePlayers(java.lang.String grId, java.util.Collection<Player> rp) throws npl.NormativeFailureException, cartago.CartagoException- Throws:
npl.NormativeFailureExceptioncartago.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() -
getNPLSrc
public java.lang.String getNPLSrc() -
getStyleSheetName
protected java.lang.String getStyleSheetName()- Specified by:
getStyleSheetNamein classOrgArt
-
isWellFormed
public boolean isWellFormed() -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document) -
addMissionsInDot
protected boolean addMissionsInDot() -
getAsDot
public java.lang.String getAsDot()
-