| org.cougaar.logistics.plugin.trans.AmmoLowFidelityExpanderPlugin org.cougaar.logistics.plugin.trans.AmmoProjectionExpanderPlugin
AmmoProjectionExpanderPlugin | public class AmmoProjectionExpanderPlugin extends AmmoLowFidelityExpanderPlugin (Code) | | Takes PROJECT_SUPPLY tasks
and converts them into TRANSPORT tasks with a RESERVATION prep.
|
Method Summary | |
protected void | addContentsInfo(GLMAsset container, String nomen, String typeID, String unit, double massInSTons) | protected void | addToEstimatedAR(PlanElement exp, AspectValue rate) | protected AggregateAsset | createDeliveredAsset(Task originalTask, Asset originalAsset, int quantity) | protected Task | createSubtask(Task parentTask, Asset directObject, Date early, Date best, Date late, long bestTime, long daysSoFar, Date lastBestDate, String itemNomen, double massInSTons) Create the transport reservation subtask of the parent. | protected UTILFilterCallback | createThreadCallback(UTILGenericListener bufferingThread) | protected void | dealWithReservedTask(Task task, Task reservedTask, Task reservedParent)
Called from processTasks. | protected Collection | findForPreps(Task task) Look on task for what unit the ammo is for. | protected long | getBestTime(Date early, Date best, long daysSoFar) | protected double | getContainerTons(Container container) | public Date | getEarlyDate(Task t) | public Date | getLateDate(Task t) | protected Date | getLatestParentEndDate(Task transport, Task reserved) Must check best dates of Supply task parents. | protected Date | getLatestParentEndDate(Task transport, String reservedAmmoType) Must check best dates of Supply task parents. | protected List | getMatchingTasksByType(Task task, Collection units, boolean isReserved) Find those tasks of the same ammo type and try to find tasks that overlap in
time with the given task. | protected Asset | getMilvanDirectObject(String itemNomen, String itemID, String unit, double massInSTons) | protected Task | getParentTask(Task child) Queries the uid->task map for the parent task of the child... | protected double | getScaledRate(PlanElement planElement)
scale the rate to make it the rate over the time of the performance of the
task, so that when the inventory does days*rate, they come up with the original
requested quantity. | public Vector | getSubtasks(Task parentTask) Implemented for UTILExpanderPlugin interface
Break up project supply tasks into reserved transport tasks for
discrete periods of time. | protected Asset | getTrimmedDirectObject(Asset directObject, double factor) Assumes the direct object is either an asset group or a container (milvan). | protected Collection | getTypesInContainer(Task task) | protected Enumeration | getValidEndDateRanges(Preference endDatePref) | public void | handleProjectSupplyTask(Task t) | public void | handleTransportTask(Task task1, Map reservedToActual) | public boolean | interestingTask(Task task) State that we are interested in all transport tasks
Parameters: task - the task to test. | public boolean | isEqual(AllocationResult thisAR, AllocationResult that) checks to see if the AllocationResult is equal to this one.
We have to use this copy of the AllocationResult.isEqual because we want to
to skip equals comparison of DEMANDRATE and START_TIME aspects. | protected boolean | isReservedTask(Task task) | public void | localSetup() | protected GLMAsset | makeMilvan() | protected String | makeMilvanID() | protected AllocationResult | makeSuccessfulDisposition(Task task) | public boolean | nearlyEquals(AspectValue[] avs1, AspectValue[] avs2) checks to see that two aspect value arrays are equal
skips comparison of DEMANDRATE and START_TIME aspects. | protected int | numTasksInWorkflow(Workflow workflow) | protected boolean | ownWorkflow(Task task) | public void | processTasks(List tasks) | public void | reportChangedExpansion(Expansion cpe)
Report to superior that the expansion has changed. | protected String | reportContentTypes(Task task, Task examinedTask) | public void | setLoggingService(LoggingService bs) rely upon load-time introspection to set these services -
don't worry about revokation. | public void | setupFilters() | protected boolean | taskInWorkflow(Task task, Workflow workflow) | protected boolean | transportDateWithinReservedWindow(Task transport, Task reserved) Must check best dates of Supply task parents. | protected String | uids(String[] array) | protected String | uidsWorkflow(Task task) | protected void | updateMap(Map reservedToActual, Task actual, Task reserved) |
AMMO_CATEGORY_CODE | final public static String AMMO_CATEGORY_CODE(Code) | | |
CHUNK_DAYS | public long CHUNK_DAYS(Code) | | |
FIND_FOR_UNIT_PREP_ON_TASK | protected boolean FIND_FOR_UNIT_PREP_ON_TASK(Code) | | |
MILLIS_PER_DAY | public static long MILLIS_PER_DAY(Code) | | |
PACKING_LIMIT | final public static double PACKING_LIMIT(Code) | | |
SECS_PER_DAY | public static double SECS_PER_DAY(Code) | | |
TASK_TRANSMISSION_DELAY | final public static long TASK_TRANSMISSION_DELAY(Code) | | |
childToParent | protected Map childToParent(Code) | | |
createDeliveredAsset | protected AggregateAsset createDeliveredAsset(Task originalTask, Asset originalAsset, int quantity)(Code) | | create aggregate asset aggregating the direct object's prototype *
|
createSubtask | protected Task createSubtask(Task parentTask, Asset directObject, Date early, Date best, Date late, long bestTime, long daysSoFar, Date lastBestDate, String itemNomen, double massInSTons)(Code) | | Create the transport reservation subtask of the parent.
|
dealWithReservedTask | protected void dealWithReservedTask(Task task, Task reservedTask, Task reservedParent)(Code) | |
Called from processTasks.
Compares transport reservation and overlapping actual transport task.
Creates a replacement for existing reserved task, if there is any time
span left where it doesn't overlap the actual task. If the actual completely
overlaps the reservation, creates a successful disposition for the task.
If there is partial overlap, adjusts the earliest arrival date on the reserved task
to be equal to the best date of the actual and updates the contents pg of the direct
object to indicate a smaller weight.
As a convenience, adds the START prep to the reserved task, indicating the start
of the period of the reservation. This is used in transportDateWithinReservedWindow to
determine if an actual falls in the span of a reservation and to indicate whether
a transport task is indeed a reservation.
Parameters: task - actual transport task Parameters: reservedTask - reserved transport task to be replaced |
findForPreps | protected Collection findForPreps(Task task)(Code) | | Look on task for what unit the ammo is for. Generally this will be 191-ORDN.
If FIND_FOR_UNIT_PREP_ON_TASK is false, just use agent identifier (OSC).
|
getBestTime | protected long getBestTime(Date early, Date best, long daysSoFar)(Code) | | make sure best time is before or equal to best time on task
|
getContainerTons | protected double getContainerTons(Container container)(Code) | | assumes only one type of ammo in container -- true for reservations
|
getLatestParentEndDate | protected Date getLatestParentEndDate(Task transport, Task reserved)(Code) | | Must check best dates of Supply task parents.
Remember to round to end of day! A task arriving at midnight + 1 sec
of a day counts for the whole day against the projection.
|
getLatestParentEndDate | protected Date getLatestParentEndDate(Task transport, String reservedAmmoType)(Code) | | Must check best dates of Supply task parents.
|
getMatchingTasksByType | protected List getMatchingTasksByType(Task task, Collection units, boolean isReserved)(Code) | | Find those tasks of the same ammo type and try to find tasks that overlap in
time with the given task.
Parameters: task - to look for matching tasks for Parameters: units - units the task is for Parameters: isReserved - is the task a reserved (project supply child) task List of tasks that are for the same type of ammo, same unit, and for an overlapping period of time |
getParentTask | protected Task getParentTask(Task child)(Code) | | Queries the uid->task map for the parent task of the child...
must do this since child task has a uid reference to the parent task not
an actual reference.
|
getScaledRate | protected double getScaledRate(PlanElement planElement)(Code) | |
scale the rate to make it the rate over the time of the performance of the
task, so that when the inventory does days*rate, they come up with the original
requested quantity.
The problem is that we're translating from one meaning of start and end date to another.
The start->end date window on a project supply task means "I need X widgets per day, each
day, over this period." The transportation start->end window means "The move started on this
day and ended on this other day." So they mean different things.
|
getSubtasks | public Vector getSubtasks(Task parentTask)(Code) | | Implemented for UTILExpanderPlugin interface
Break up project supply tasks into reserved transport tasks for
discrete periods of time. Takes the (demand rate X period) of the project
supply task and breaks this up total ammo up across several subtasks, one
per month.
Called from handleTask, which is called from HandleProjectSupplyTask
See Also: AmmoProjectionExpanderPlugin.handleProjectSupplyTask transport subtasks for the parent project supply |
getTrimmedDirectObject | protected Asset getTrimmedDirectObject(Asset directObject, double factor)(Code) | | Assumes the direct object is either an asset group or a container (milvan).
If it's a container, updates the contentsPG to reflect a new weight that is the
old multiplied by factor (0.0 < factor < 1.0).
Called from dealWithReservedTask.
Parameters: directObject - old container or asset group Parameters: factor - to reduce container weight by new or old milvan with updated contentsPG See Also: AmmoProjectionExpanderPlugin.dealWithReservedTask |
getTypesInContainer | protected Collection getTypesInContainer(Task task)(Code) | | all the ammo types inside the task's milvan |
handleProjectSupplyTask | public void handleProjectSupplyTask(Task t)(Code) | | Handle a task with verb Supply
|
handleTransportTask | public void handleTransportTask(Task task1, Map reservedToActual)(Code) | |
find matching reservation transport task
see if date overlaps
if it does, publish remove it and replace it with one with altered date span and quantity
OK - could be MUCH more efficient - blackboard queries are extremely slow!
|
interestingTask | public boolean interestingTask(Task task)(Code) | | State that we are interested in all transport tasks
Parameters: task - the task to test. true if the tasks verb is SUPPLY, false otherwise |
isEqual | public boolean isEqual(AllocationResult thisAR, AllocationResult that)(Code) | | checks to see if the AllocationResult is equal to this one.
We have to use this copy of the AllocationResult.isEqual because we want to
to skip equals comparison of DEMANDRATE and START_TIME aspects. (why?)
Mainly we need our own version of AspectValue.nearlyEquals
Parameters: thisAR - Parameters: that - boolean |
isReservedTask | protected boolean isReservedTask(Task task)(Code) | | |
localSetup | public void localSetup()(Code) | | |
makeMilvan | protected GLMAsset makeMilvan()(Code) | | An ancillary method that creates an asset that represents a MILVAN
(military container) carrying ammunition
|
makeSuccessfulDisposition | protected AllocationResult makeSuccessfulDisposition(Task task)(Code) | | Makes allocation result with aspect values that echo the task preferences
Parameters: task - to dispose successful allocation result with aspect values taken from task prefs |
nearlyEquals | public boolean nearlyEquals(AspectValue[] avs1, AspectValue[] avs2)(Code) | | checks to see that two aspect value arrays are equal
skips comparison of DEMANDRATE and START_TIME aspects.
We have to skip start time, since it doesn't mean the same in the inventory world
as in the transportation world.
Parameters: avs1 - first set Parameters: avs2 - second set true if the same |
numTasksInWorkflow | protected int numTasksInWorkflow(Workflow workflow)(Code) | | |
ownWorkflow | protected boolean ownWorkflow(Task task)(Code) | | |
reportChangedExpansion | public void reportChangedExpansion(Expansion cpe)(Code) | |
Report to superior that the expansion has changed.
An override is needed here for two reasons :
1) to add the DEMANDRATE preference value into the allocation result,
since downstream plugins won't set this aspect.
2) echo the start time preference in the allocation result (why?)
No allocation results flow upward unless reported confidence reaches 100%.
Parameters: cpe - Expansion that has changed. See Also: org.cougaar.lib.filter.UTILPluginAdapter.updateAllocationResult |
reportContentTypes | protected String reportContentTypes(Task task, Task examinedTask)(Code) | | a report on all the ammo types inside both tasks' milvan |
setLoggingService | public void setLoggingService(LoggingService bs)(Code) | | rely upon load-time introspection to set these services -
don't worry about revokation.
|
setupFilters | public void setupFilters()(Code) | | Uses a special callback that maintains two maps :
a uidToTask map so we can do parent task lookup efficiently AND
a typeToTasks map so we can look up a list of tasks by what ammo type they are
See Also: AmmoProjectionExpanderPlugin.getMatchingTasksByType |
transportDateWithinReservedWindow | protected boolean transportDateWithinReservedWindow(Task transport, Task reserved)(Code) | | Must check best dates of Supply task parents.
Fix for bug #12467 and #12468.
The problem is that the packer can aggregate supply tasks for two different ammo types
into one milvan, and the EARLIER of the two dates becomes the END_TIME best for the
MP Transport task. It was this time I was using to determine overlap of the Transport
Reservation that's derived from the ProjectSupply.
E.g. the packer can make:
Parent #1 : C380 arrive at 10/18
Parent #2 : A986 arrive at 10/15
-> MPTask with milvan arrive at 10/15 - don't want to make parent #2 be late
So when we try to find the overlap with a Reservation:
C380 from 9/25->10/20
if we use the MPTask's arrival time, the overlap results in a Reservation
from 10/15->10/20 not from 10/18->10/20.
Since the packer may do different packings from run-to-run, the quantities of Reserved
ammo varies from run to run (and potentially the # of milvans).
Parameters: transport - - actual transport task Parameters: reserved - projected transport task true if transport task overlaps in time with the reserved task |
updateMap | protected void updateMap(Map reservedToActual, Task actual, Task reserved)(Code) | | |
|
|