| org.cougaar.lib.vishnu.client.VishnuPlugin org.cougaar.lib.vishnu.client.VishnuAggregatorPlugin
All known Subclasses: org.cougaar.logistics.plugin.trans.TransportAggregatorPlugin, org.cougaar.lib.vishnu.client.custom.CustomVishnuAggregatorPlugin,
VishnuAggregatorPlugin | public class VishnuAggregatorPlugin extends VishnuPlugin implements UTILAggregatorPlugin,UTILExpansionListener(Code) | | Aggregator version of ALP-Vishnu Bridge.
The key thing to note is that the asset in the task->asset
association is on the WITH preposition of the generated MPTask.
This is critical, because the allocator downstream will look for this
prep and pluck the asset off to make the allocation.
Uses the assigned start and end times to set the preferences and
allocation results.
Adjust preferences so that the start time preference is the assigned
start time, and the end time preference has a best date that is the
assigned end time. The early and late dates of the end time preference
are the same as the first parent task. (This isn't very important, as the
downstream allocator should just allocate to the start and best times.)
Many times subclasses will want to redefine
interestingTask and interestingAsset to filter
what goes to the Vishnu scheduler. If you do, it's good form to call
super.interestingTask().
See Also: org.cougaar.lib.vishnu.client.VishnuPlugin.interestingAsset See Also: |
Method Summary | |
protected void | addAggregations(NewComposition comp, Vector parentTasks, Date start, Date end) | protected AssetGroup | addToDirectObject(Task task, Vector objects) Add objects to task's direct object
Parameters: task - to add the objects to Parameters: objects - to add to the task's d.o. | public boolean | addToPrevious(Vector tasklist, Asset anAsset, Date start, Date end, Date setupStart, Date wrapupEnd) Fixes up the following when additional tasks are added to a previous
assignment:
1) Adds to the d.o. | protected void | addToPreviousSetupWrapup(Asset anAsset, Asset directObject, Date start, Date end, String info) Update the directObject of the setup and wrapup tasks when we get new assignments
to an existing mission. | public void | changeExpansion(Expansion exp) | protected void | checkMPTaskDO(MPTask mpTask) post-condition check : MPTask d.o. | protected void | cleanupAggregation(Asset a, List tasklist, List aggResults) hook for post-publish processing
Default does nothing. | protected UTILAggregationCallback | createAggCallback() | protected UTILFilterCallback | createThreadCallback(UTILGenericListener bufferingThread) Callback for input tasks
Creates an instance of the WorkflowCallback, which means the plugin
is looking for tasks that are part of workflows. | protected XMLResultHandler | createXMLResultHandler() | protected Vector | enumToVector(Enumeration en) | protected MPTask | findMPTask(List results) | protected boolean | forgetTripletToTask(Object subtask) | protected AspectValue[] | getAVsForAgg(Asset a, List g, Date start, Date end) Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Gets the preferences and makes aspect values that echo them. | protected UTILAggregationCallback | getAggCallback() | protected Map | getAspectValuesMap(List g, Date start, Date end) Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Gets the preferences and makes aspect values that echo them. | protected Asset | getAssetFromMPTask(MPTask combinedTask) Defines how to get the asset representing the task->asset association. | protected Vector | getDirectObjectsForAgg(List parentTasks) | protected Task | getEncapsulatedTask(Asset asset, Date start, Date end) | protected Enumeration | getEnumWithNewParents(Vector oldParents, Vector tasklist) | protected MPTask | getMPTask(UID parentUID) | protected Vector | getPreferencesForAgg(Asset a, List g, Date start, Date end) Adjust preferences so that the start time preference is the assigned
start time, and the end time preference has a best date that is the
assigned end time. | protected Vector | getPrepPhrasesForAgg(Asset a, List g)
Defines how the MPTask holds the asset for the task->asset association. | protected Verb | getVerbForAgg(List g) | protected UTILFilterCallback | getWorkflowCallback() | public void | handleConstraintViolation(Expansion exp, List violatedConstraints) | public void | handleFailedExpansion(Expansion exp, List failedSubTasks) | public void | handleIllFormedTask(Task t) | public void | handleMultiAssignment(Vector tasks, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd, boolean assetWasUsedBefore) define in subclass -- create an aggregation
The parameters are what got returned from the vishnu scheduler. | public void | handleRemovedAggregation(Aggregation agg) | public boolean | handleRescindedAggregation(Aggregation agg) | public void | handleSuccessfulAggregation(Aggregation agg) | public void | handleSuccessfulExpansion(Expansion exp, List successfulSubtasks) | public boolean | interestingExpandedTask(Task t) Implemented for ExpansionListener
Interested in expansions created by this plugin, labeled with a VISHNU prep. | public boolean | interestingParentTask(Task t) Should almost always call interestingTask. | public void | localSetup() | protected AspectValue[] | makeAVsFromPrefs(Vector prefs) Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Takes the preferences and makes aspect values that echo them. | protected AspectValue[] | makeAVsFromPrefs(Vector prefs, Date start, Date end) | public void | makePlanElement(Vector tasklist, Asset anAsset, Date start, Date end, Date setupStart, Date wrapupEnd, boolean assetWasUsedBefore)
Background : the missions for a conveyance (ship, plane, truck)
are represented by MPTasks which assign an asset group of items
to a conveyance for a certain period of time. | public boolean | needToRescind(Aggregation agg) | public void | publishChangedExpansion(Expansion exp) | protected void | publishList(List toPublish) publish the generated plan elements, compositions, and tasks
Also informs of failed tasks. | public void | publishRemovalOfAggregation(Aggregation aggToRemove) | protected void | rememberTripletToTask(String taskKey, Task subtask) Update both tripletToTask and taskToTriplet maps - add the subtask to them
with the asset-start-end triplet key. | protected AssetGroup | removeFromDirectObject(Task removedTask, MPTask mpTask) Remove the parent task's direct object from the child mpTask's group
of direct objects. | public void | reportChangedAggregation(Aggregation agg) | public void | reportChangedExpansion(Expansion exp) Implemented for ExpansionListener
Report to superior that the expansion has changed. | public void | setupFilters() adds the aggregation filter and two map filters
- one filter looks for MPTasks and keeps track of a map of uid->MPTask,
which is used when we need to add new parent tasks to an existing MPTask.
- one filter looks for subtasks of the MPTask and updates the triplet->task
and task->triplet maps when tasks are removed. | public boolean | wantToChangeExpansion(Expansion exp) |
propagateRescindPastAggregation | boolean propagateRescindPastAggregation(Code) | | |
taskToTriplet | protected Map taskToTriplet(Code) | | |
tripletToTask | protected Map tripletToTask(Code) | | |
addToDirectObject | protected AssetGroup addToDirectObject(Task task, Vector objects)(Code) | | Add objects to task's direct object
Parameters: task - to add the objects to Parameters: objects - to add to the task's d.o. AssetGroup with objects added to it |
addToPrevious | public boolean addToPrevious(Vector tasklist, Asset anAsset, Date start, Date end, Date setupStart, Date wrapupEnd)(Code) | | Fixes up the following when additional tasks are added to a previous
assignment:
1) Adds to the d.o. of the transport task allocated to the asset
2) (Optional) If setup task, adds to the d.o. of the task
3) (Optional) If wrapup task, adds to the d.o. of the task
4) Adds to the d.o. of the mp task
5) Makes Mp task parent task list reflect new parent tasks
6) Makes aggregations connecting parent tasks to mp task
Parameters: tasklist - - tasks for this asset Parameters: anAsset - that these tasks are grouped for/assigned to Parameters: start - time start Parameters: end - time end Parameters: setupStart - setup start Parameters: wrapupEnd - wrapup end |
addToPreviousSetupWrapup | protected void addToPreviousSetupWrapup(Asset anAsset, Asset directObject, Date start, Date end, String info)(Code) | | Update the directObject of the setup and wrapup tasks when we get new assignments
to an existing mission. publishChanges the task.
We need a triplet - the assigned asset and the start and end dates to unique identify
a setup or wrapup task. These come from the anAsset, start, and end parameters.
First looks in the tripletToTask map, and if can't find the task there, looks at the
asset's role schedule, which is problematic (the allocator must have run), see above
discussion. The only time the tripletToTask map will be empty will be after rehydration.
Parameters: anAsset - - first part of the triplet key Parameters: start - - second part of the triplet key Parameters: end - - third part of the triplet key Parameters: directObject - contains the additional assets to add to the direct object of the updated task |
checkMPTaskDO | protected void checkMPTaskDO(MPTask mpTask)(Code) | | post-condition check : MPTask d.o. should be the sum of all parents' d.o.s
no more, no less
|
cleanupAggregation | protected void cleanupAggregation(Asset a, List tasklist, List aggResults)(Code) | | hook for post-publish processing
Default does nothing.
might want to do : Task mpTask = findMPTask (aggResults);
|
createThreadCallback | protected UTILFilterCallback createThreadCallback(UTILGenericListener bufferingThread)(Code) | | Callback for input tasks
Creates an instance of the WorkflowCallback, which means the plugin
is looking for tasks that are part of workflows.
Parameters: bufferingThread - -- the thread the callback informs when there are new input tasks UTILFilterCallback -- an instance of UTILWorkflowCallback |
createXMLResultHandler | protected XMLResultHandler createXMLResultHandler()(Code) | | creates an XMLResultHandler specially for this plugin
|
forgetTripletToTask | protected boolean forgetTripletToTask(Object subtask)(Code) | | Update both tripletToTask and taskToTriplet maps - remove the subtask from them
|
getAVsForAgg | protected AspectValue[] getAVsForAgg(Asset a, List g, Date start, Date end)(Code) | | Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Gets the preferences and makes aspect values that echo them. At this
point the start and end time preferences have been set to the assigned
times.
Parameters: a - - the asset associated with the MPTask Parameters: g - - parent task list AspectValue[] - returned aspect values |
getAspectValuesMap | protected Map getAspectValuesMap(List g, Date start, Date end)(Code) | | Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Gets the preferences and makes aspect values that echo them. At this
point the start and end time preferences have been set to the assigned
times.
Does not create excess aspect value arrays.
Parameters: g - - parent task list AspectValue[] - returned aspect values |
getAssetFromMPTask | protected Asset getAssetFromMPTask(MPTask combinedTask)(Code) | | Defines how to get the asset representing the task->asset association.
Should be in sync with getPrepPhrasesForAgg, which attaches the prep.
See Also: VishnuAggregatorPlugin.getPrepPhrasesForAgg Parameters: combinedTask - - the MPTask generated by the plugin the asset on the task |
getDirectObjectsForAgg | protected Vector getDirectObjectsForAgg(List parentTasks)(Code) | | Aggregates direct objects of parent tasks into a vector
aggregate of parent direct objects |
getEncapsulatedTask | protected Task getEncapsulatedTask(Asset asset, Date start, Date end)(Code) | | Look for a plan element on the role schedule of the asset
that covers exactly the same span of time
Parameters: asset - to look at role schedule Parameters: start - time of pe on role schedule Parameters: end - time of pe on role schedule task that is on role schedule of asset from exactly start to end |
getMPTask | protected MPTask getMPTask(UID parentUID)(Code) | | very expensive - must examine every object on the blackboard - avoid if possible
Parameters: parentUID - - uid of MPTask we want from the blackboard MPTask with UID equal to the param parentUID |
getPreferencesForAgg | protected Vector getPreferencesForAgg(Asset a, List g, Date start, Date end)(Code) | | Adjust preferences so that the start time preference is the assigned
start time, and the end time preference has a best date that is the
assigned end time. The early and late dates of the end time preference
are the same as the first parent task. (This isn't very important, as the
downstream allocator should just allocate to the start and best times.)
If there is a quantity preference on the first task, will calculate an aggregate
quantity preference. Assumes then that all tasks will have a quantity pref.
Parameters: a - - the asset associated with the MPTask Parameters: g - - parent task list Parameters: start - - the date for the START_TIME preference Parameters: end - - the best date for the END_TIME preference Vector - list of preferences for the MPTask |
getPrepPhrasesForAgg | protected Vector getPrepPhrasesForAgg(Asset a, List g)(Code) | |
Defines how the MPTask holds the asset for the task->asset association.
Should be in sync with getAssetFromMPTask, which accesses the prep.
Critical, because the allocator downstream will look for this prep and
pluck the asset off to make the allocation.
See Also: VishnuAggregatorPlugin.getAssetFromMPTask Parameters: a - - asset to attach to task Parameters: g - - parent tasks the original set of prep phrases from the first parent task PLUS the WITHprep with the asset |
getVerbForAgg | protected Verb getVerbForAgg(List g)(Code) | | Defines the verb of the MPTask
Transport by default
Verb - Transport |
handleConstraintViolation | public void handleConstraintViolation(Expansion exp, List violatedConstraints)(Code) | | |
handleFailedExpansion | public void handleFailedExpansion(Expansion exp, List failedSubTasks)(Code) | | |
handleIllFormedTask | public void handleIllFormedTask(Task t)(Code) | | |
handleMultiAssignment | public void handleMultiAssignment(Vector tasks, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd, boolean assetWasUsedBefore)(Code) | | define in subclass -- create an aggregation
The parameters are what got returned from the vishnu scheduler.
Parameters: tasks - tasks to be aggregated together and assigned to asset Parameters: asset - asset handling task Parameters: start - of main task Parameters: end - of main task Parameters: setupStart - start of setup task Parameters: wrapupEnd - end of wrapup task |
handleRemovedAggregation | public void handleRemovedAggregation(Aggregation agg)(Code) | | implemented for AggregationListener
Cleans up maps of triplets to tasks, task to mptasks
|
handleRescindedAggregation | public boolean handleRescindedAggregation(Aggregation agg)(Code) | | implemented for AggregationListener
|
handleSuccessfulAggregation | public void handleSuccessfulAggregation(Aggregation agg)(Code) | | implemented for AggregationListener
|
handleSuccessfulExpansion | public void handleSuccessfulExpansion(Expansion exp, List successfulSubtasks)(Code) | | |
interestingExpandedTask | public boolean interestingExpandedTask(Task t)(Code) | | Implemented for ExpansionListener
Interested in expansions created by this plugin, labeled with a VISHNU prep.
(That's how it knows which to be interested in.)
|
interestingParentTask | public boolean interestingParentTask(Task t)(Code) | | Should almost always call interestingTask.
|
localSetup | public void localSetup()(Code) | | |
makeAVsFromPrefs | protected AspectValue[] makeAVsFromPrefs(Vector prefs)(Code) | | Create aspect values so that the start time aspect is the assigned
start time, and the end time aspect is the
assigned end time.
(The downstream allocator should just echo these values.)
Takes the preferences and makes aspect values that echo them. At this
point the start and end time preferences have been set to the assigned
times.
Parameters: prefs - - the preferences associated with the MPTask AspectValue[] - returned aspect values |
makeAVsFromPrefs | protected AspectValue[] makeAVsFromPrefs(Vector prefs, Date start, Date end)(Code) | | replace start and end time aspect values with those from the assignment
|
makePlanElement | public void makePlanElement(Vector tasklist, Asset anAsset, Date start, Date end, Date setupStart, Date wrapupEnd, boolean assetWasUsedBefore)(Code) | |
Background : the missions for a conveyance (ship, plane, truck)
are represented by MPTasks which assign an asset group of items
to a conveyance for a certain period of time. We want to prevent
the case where multiple MPTasks together represent one actual
mission, i.e. they are for the same conveyance and the same period
of time. It's better for memory footprint, simplicity, and the
asset usage display in the TPFDD Viewer.
See bug #11866 : https://bugs.ultralog.net/show_bug.cgi?id=11866
Makes an aggregation given a list of assignments.
Makes an aggregation with a medium confidence and publishes it.
Also makes an expansion of the MPTask. This may be a 1-to-1,
1-to-2, or 1-to-3 expansion depending on the dates. If the
setup start is before the task start, then a separate setup task
is created and added to the expansion. Similarly for wrapup.
These dates are different if the vishnu scheduling specs define
setup (e.g. fueling an airplane) or wrapup (e.g. servicing an airplane)
durations. See referenced Vishnu documentation for details on specs.
Calls the base class function makeSetupWrapupExpansion.
Adds to a previously created MPTask when new tasks are assigned to an
asset.
Parameters: tasklist - - tasks for this asset Parameters: anAsset - that these tasks are grouped for Parameters: start - time start Parameters: end - time end Parameters: setupStart - setup start Parameters: wrapupEnd - wrapup end See Also: org.cougaar.planning.ldm.plan.Aggregation See Also: org.cougaar.planning.ldm.plan.MPTask See Also: org.cougaar.lib.vishnu.client.VishnuPlugin.makeSetupWrapupExpansion See Also:
* Click here for more on setup and wrapup specifications. See Also: VishnuAggregatorPlugin.addToPrevious |
needToRescind | public boolean needToRescind(Aggregation agg)(Code) | | implemented for AggregationListener
|
publishChangedExpansion | public void publishChangedExpansion(Expansion exp)(Code) | | |
publishList | protected void publishList(List toPublish)(Code) | | publish the generated plan elements, compositions, and tasks
Also informs of failed tasks.
Parameters: toPublish - stuff to publish |
publishRemovalOfAggregation | public void publishRemovalOfAggregation(Aggregation aggToRemove)(Code) | | implemented for AggregationListener
|
rememberTripletToTask | protected void rememberTripletToTask(String taskKey, Task subtask)(Code) | | Update both tripletToTask and taskToTriplet maps - add the subtask to them
with the asset-start-end triplet key.
|
removeFromDirectObject | protected AssetGroup removeFromDirectObject(Task removedTask, MPTask mpTask)(Code) | | Remove the parent task's direct object from the child mpTask's group
of direct objects.
Parameters: removedTask - to task with the direct object to remove Parameters: mpTask - to remove the direct object from AssetGroup with objects removed from it |
reportChangedAggregation | public void reportChangedAggregation(Aggregation agg)(Code) | | implemented for AggregationListener
|
reportChangedExpansion | public void reportChangedExpansion(Expansion exp)(Code) | | Implemented for ExpansionListener
Report to superior that the expansion has changed. Usually just a pass
through to the UTILPluginAdapter's updateAllocationResult.
Parameters: exp - Expansion that has changed. See Also: org.cougaar.lib.callback.UTILExpansionListener |
setupFilters | public void setupFilters()(Code) | | adds the aggregation filter and two map filters
- one filter looks for MPTasks and keeps track of a map of uid->MPTask,
which is used when we need to add new parent tasks to an existing MPTask.
- one filter looks for subtasks of the MPTask and updates the triplet->task
and task->triplet maps when tasks are removed. These are also used
when we need to add new parent tasks to an existing MPTask and its subtasks.
See Also: VishnuAggregatorPlugin.forgetTripletToTask |
wantToChangeExpansion | public boolean wantToChangeExpansion(Expansion exp)(Code) | | |
Methods inherited from org.cougaar.lib.vishnu.client.VishnuPlugin | protected void appendGlobalDataFormat(Document problemFormatDoc)(Code)(Java Doc) protected void attachAssociatedFiles(Document problemFormatDoc)(Code)(Java Doc) public void clearChangedAssets()(Code)(Java Doc) protected void clearTasks()(Code)(Java Doc) protected UTILAssetCallback createAssetCallback()(Code)(Java Doc) protected SchedulerLifecycle createDirectMode()(Code)(Java Doc) protected DirectResultHandler createDirectResultHandler()(Code)(Java Doc) protected SchedulerLifecycle createExternalMode()(Code)(Java Doc) protected SchedulerLifecycle createInternalMode()(Code)(Java Doc) protected Task createMainTask(Task task, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd)(Code)(Java Doc) protected Task createSetupTask(Task task, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd)(Code)(Java Doc) protected VishnuComm createVishnuComm()(Code)(Java Doc) protected VishnuConfig createVishnuConfig()(Code)(Java Doc) protected VishnuDomUtil createVishnuDomUtil()(Code)(Java Doc) protected Task createWrapupTask(Task task, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd)(Code)(Java Doc) protected XMLProcessor createXMLProcessor()(Code)(Java Doc) protected XMLResultHandler createXMLResultHandler()(Code)(Java Doc) protected Collection getAllAssets()(Code)(Java Doc) protected UTILAssetCallback getAssetCallback()(Code)(Java Doc) public Asset getAssetForKey(StringKey key)(Code)(Java Doc) public Collection getChangedAssets()(Code)(Java Doc) public XMLizer getDataXMLizer()(Code)(Java Doc) public int getNumAssets()(Code)(Java Doc) public int getNumTasks()(Code)(Java Doc) protected Vector getPreferences(Task parentTask, Date readyAt, Date earliest, Date best, Date latest)(Code)(Java Doc) protected Vector getPrepPhrases(Task parentTask, Asset a)(Code)(Java Doc) public boolean getRunDirectly()(Code)(Java Doc) public Task getTaskForKey(StringKey key)(Code)(Java Doc) public String getTaskName()(Code)(Java Doc) public Collection getTasks()(Code)(Java Doc) public void handleAssignment(org.cougaar.planning.ldm.plan.Task task, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd, String contribs, String taskText)(Code)(Java Doc) public void handleChangedAssets(Enumeration changedAssets)(Code)(Java Doc) public void handleIllFormedTask(Task t)(Code)(Java Doc) protected void handleImpossibleTasks(Collection impossibleTasks)(Code)(Java Doc) public void handleMultiAssignment(Vector tasks, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd, boolean assetWasUsedBefore)(Code)(Java Doc) public void handleNewAssets(Enumeration newAssets)(Code)(Java Doc) protected void handleRemovedTasks(Enumeration removedTasks)(Code)(Java Doc) protected void initializeWithStoredFormat()(Code)(Java Doc) public boolean interestingAsset(Asset a)(Code)(Java Doc) public boolean interestingTask(Task t)(Code)(Java Doc) public void localSetup()(Code)(Java Doc) protected List makeSetupWrapupExpansion(Task task, Asset asset, Date start, Date end, Date setupStart, Date wrapupEnd)(Code)(Java Doc) protected void prepareData(List stuffToSend, Document objectFormatDoc)(Code)(Java Doc) protected void prepareObjectFormat(List tasks)(Code)(Java Doc) protected Document prepareStoredObjectFormat()(Code)(Java Doc) public void prepareVishnuObjects(List tasksAndResources, Collection changedAssets, List vishnuTasks, List vishnuResources, List changedVishnuResources, Document objectFormat, SchedulingData schedData)(Code)(Java Doc) public void processTasks(List tasks)(Code)(Java Doc) protected void publishAddWithCheck(Object obj)(Code)(Java Doc) public void publishSubtasks(boolean wantConfidence, Task t, List subtasks)(Code)(Java Doc) public void removeTask(StringKey key)(Code)(Java Doc) protected Map sendFormat(Collection templates, String assetClassName)(Code)(Java Doc) protected void setUIDToObjectMap(Collection objects, Map UIDtoObject)(Code)(Java Doc) public void setupFilters()(Code)(Java Doc) protected void unfreezeTasks(Collection tasks)(Code)(Java Doc) protected void waitForAnswer()(Code)(Java Doc)
|
|
|