Java Doc for UTILAllocate.java in  » Science » Cougaar12_4 » org » cougaar » lib » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.lib.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.cougaar.lib.util.UTILAllocate

All known Subclasses:   org.cougaar.glm.util.GLMAllocate,
UTILAllocate
public class UTILAllocate (Code)
This class contains utility functions for allocations.


Field Summary
final public static  doubleHIGHEST_CONFIDENCE
    
final public static  doubleMEDIUM_CONFIDENCE
    
protected  UTILExpandexpand
    
protected  Loggerlogger
    

Constructor Summary
public  UTILAllocate(Logger log)
    

Method Summary
protected static  StringARtoString(int[] aspectTypes, double[] aspectValues)
    
public  voidaddQueryResultToAR(PlanElement pe, int aqType, String data)
     Adds data to an auxiliaryQuery.
public  AllocationResultcloneAllocResultAsSuccess(PlanningFactory ldmf, AllocationResult toClone)
    
protected  AllocationResultcreateAllocationResult(boolean isSuccess, PlanningFactory ldmf, int[] aspectarray, double[] resultsarray, double confidence)
    
 Freeform allocation result creation.
public static  ListenumToList(Enumeration e)
    
public static  VectorenumToVector(Enumeration e)
    
public  booleanexceedsPreferences(Task t, Date start, Date end, double cost)
     Handy utility function for checking a task's preferences against start and end dates and cost.
public  booleanexceedsPreferences(Task t, Date start, Date end)
     Handy utility function for checking a task's preferences against start and end dates.
public  booleanexceedsPreferences(Task t, AspectValue[] aspectValues)
     Check a task's preferences against given aspect values.
public  booleanexceedsPreferences(Task t, int[] aspectTypes, double[] aspectValues)
    
 Check a task's preferences against given aspect values.
 Throws an informative exception if somehow the 
 the aspect types being checked are not the same set as the task's 
 preferences.
public  AspectValue[]getAspects(Date start, Date end, double cost)
     Utility function for creating AspectValues from start, end date, and cost.
public  AspectValue[]getAspects(Date start, Date end, double cost, long quantity)
     Utility function for creating AspectValues from start, end date, cost and quantity.
public  AspectValue[]getAspectsFromArrays(int[] aspectarray, double[] resultsarray)
    
public  AspectValue[]getAspectsFromDates(Date start, Date end)
     Utility function for creating AspectValues from start and end date.
public  booleanisFailedPE(PlanElement pe)
     Checks plan element's allocation result to see if it's a failed plan element.
public  VectoriterToVector(Iterator i)
    
public  PlanElementmakeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, Date start, Date end, double cost, double confidence, Role assignedRole)
     Creates an Allocation or FailedAllocation depending on whether start and end dates or cost exceed preference thresholds.
public  PlanElementmakeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, Date start, Date end, double confidence, Role assignedRole)
    
 Creates an Allocation or FailedDisposition 
 with an allocationResult w/ isSuccess=False or True, 
 depending on whether any of the start and end dates 
 exceed preference thresholds.
public  PlanElementmakeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, AspectValue[] aspects, double confidence, Role assignedRole)
     Creates an Allocation or FailedDisposition with an allocationResult w/ isSuccess=False or True, depending on whether any of the aspect values of the allocation exceed any preference thresholds.
public  PlanElementmakeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, int[] aspectarray, double[] resultsarray, double confidence, Role assignedRole)
    
 Creates an Allocation or FailedDisposition with an 
 allocationResult w/ isSuccess=False or True, 
 depending on whether any of the aspect values of the 
 allocation exceed any preference thresholds.
public  DispositionmakeFailedDisposition(UTILPlugin creator, PlanningFactory ldmf, Task t, AllocationResult failedAR)
     This should be used when the preference thresholds are exceeded, or the cumulative score for all preferences exceeds some threshold. This form lets the tasked cluster say how the preferences were exceeded.
Parameters:
  ldmf - PlanningFactory for making the plan elements
Parameters:
  t - Task that failed to be allocated
Parameters:
  failedAR - AllocationResult stating how the preferences would have beenexceeded.
public  DispositionmakeFailedDisposition(UTILPlugin ignoredCreator, PlanningFactory ldmf, Task task)
    
 When you just can't allocate!
 This should be used when the preference thresholds are exceeded, or 
 the cumulative
 score for all preferences exceeds some threshold.
 Generally the other makeFailedDisposition should be used -- 
 the tasking/superior cluster should be told not just that the allocation failed,
 but what aspect values made it fail.
protected  voidprint(AspectValue av, Preference pref, double score, AspectScoreRange definedRange, Enumeration validRanges)
    
protected static  StringprintTypeValue(int type, double value)
    
protected  doublescoreAgainstPreferences(Task t, AllocationResult allocResult)
    
public  doublescoreAgainstPreferences(Task t, Date start, Date end, double cost)
    
public  doublescoreAgainstPreferences(Task t, Date start, Date end)
     Score of a task's preferences against start and end dates.
public  doublescoreAgainstPreferences(Task t, AspectValue[] aspectValues)
     Score a task's preferences against given aspect values.
public  doublescoreAgainstPreferences(Task t, int[] aspectTypes, double[] aspectValues)
    
 Score a task's preferences against given aspect values.
 Throws an informative exception if somehow the 
 the aspect types being checked are not the same set as the task's 
 preferences.

Field Detail
HIGHEST_CONFIDENCE
final public static double HIGHEST_CONFIDENCE(Code)



MEDIUM_CONFIDENCE
final public static double MEDIUM_CONFIDENCE(Code)



expand
protected UTILExpand expand(Code)



logger
protected Logger logger(Code)




Constructor Detail
UTILAllocate
public UTILAllocate(Logger log)(Code)
Set logger




Method Detail
ARtoString
protected static String ARtoString(int[] aspectTypes, double[] aspectValues)(Code)



addQueryResultToAR
public void addQueryResultToAR(PlanElement pe, int aqType, String data)(Code)
Adds data to an auxiliaryQuery.
Parameters:
  pe - the planelement of the task that issued the auxiliary query
Parameters:
  aqType - the AuxiliaryQueryType
Parameters:
  data - the data that answers the query



cloneAllocResultAsSuccess
public AllocationResult cloneAllocResultAsSuccess(PlanningFactory ldmf, AllocationResult toClone)(Code)



createAllocationResult
protected AllocationResult createAllocationResult(boolean isSuccess, PlanningFactory ldmf, int[] aspectarray, double[] resultsarray, double confidence)(Code)
 Freeform allocation result creation.
 Protected because plugin should not need to call this.
 Workaround for COUGAAR bug (MB5.2) where asking for aspect values
 will throw null pointer exception.
 

Parameters:
  isSuccess - sets whether allocation obeyed preferences or not
Parameters:
  ldmf - PlanningFactory for making the plan elements
Parameters:
  aspectarray - - array of aspect type IDs (ints from AspectType)
Parameters:
  resultsarray - - results for those aspects, in same order as aspect types
Parameters:
  confidence - of allocation allocation result with aspect results



enumToList
public static List enumToList(Enumeration e)(Code)



enumToVector
public static Vector enumToVector(Enumeration e)(Code)
Is there a better place for this?



exceedsPreferences
public boolean exceedsPreferences(Task t, Date start, Date end, double cost)(Code)
Handy utility function for checking a task's preferences against start and end dates and cost.
Parameters:
  t - task to check
Parameters:
  start - date to check against preferences
Parameters:
  end - date to check against preferences
Parameters:
  cost - - the monetary cost of a potential allocation true if either the start or end dates or cost lie outside the task's preferences.



exceedsPreferences
public boolean exceedsPreferences(Task t, Date start, Date end)(Code)
Handy utility function for checking a task's preferences against start and end dates.
Parameters:
  t - task to check
Parameters:
  start - date to check against preferences
Parameters:
  end - date to check against preferences true if either the start or end dates lie outside the task's preferences.



exceedsPreferences
public boolean exceedsPreferences(Task t, AspectValue[] aspectValues)(Code)
Check a task's preferences against given aspect values.
Parameters:
  t - task to check
Parameters:
  aspectValues - array of AspectValues boolean -- true if exceeds any preference
See Also:   org.cougaar.planning.ldm.plan.AspectType
See Also:   org.cougaar.planning.ldm.plan.AspectValue



exceedsPreferences
public boolean exceedsPreferences(Task t, int[] aspectTypes, double[] aspectValues)(Code)
 Check a task's preferences against given aspect values.
 Throws an informative exception if somehow the 
 the aspect types being checked are not the same set as the task's 
 preferences.  E.g. if the task has only a START_TIME preference
 and one of the allocation aspects is COST.  
 This should never happen -- one
 should only assign aspects against a task's preferences.
 If debug is set, warns to stdout if set of preferences types doesn't match set
 of aspect values.
 

Parameters:
  t - task to check
Parameters:
  aspectTypes - array of aspect types
Parameters:
  aspectValues - array of aspect values boolean -- true if any preference is exceeded
See Also:   org.cougaar.planning.ldm.plan.AspectType



getAspects
public AspectValue[] getAspects(Date start, Date end, double cost)(Code)
Utility function for creating AspectValues from start, end date, and cost.
Parameters:
  start - date
Parameters:
  end - date
Parameters:
  cost - AspectValue array representing dates and cost.



getAspects
public AspectValue[] getAspects(Date start, Date end, double cost, long quantity)(Code)
Utility function for creating AspectValues from start, end date, cost and quantity.
Parameters:
  start - date
Parameters:
  end - date
Parameters:
  cost -
Parameters:
  quantity - AspectValue array representing dates, cost, and quantity.



getAspectsFromArrays
public AspectValue[] getAspectsFromArrays(int[] aspectarray, double[] resultsarray)(Code)
Utility function for creating AspectValues from type and value arrays
Parameters:
  aspectarray - type array
Parameters:
  resultsarray - value array AspectValue array



getAspectsFromDates
public AspectValue[] getAspectsFromDates(Date start, Date end)(Code)
Utility function for creating AspectValues from start and end date.
Parameters:
  start - date
Parameters:
  end - date AspectValue array representing dates.



isFailedPE
public boolean isFailedPE(PlanElement pe)(Code)
Checks plan element's allocation result to see if it's a failed plan element.
Parameters:
  pe - the allocation to check true if the allocation need to be rescindedAlso returns false if there is no report alloc resultattached to allocation
See Also:   org.cougaar.lib.filter.UTILAllocatorPluginAdapter.handleRescindedAlloc
See Also:   org.cougaar.lib.callback.UTILAllocationCallback.reactToChangedAlloc
See Also:   org.cougaar.lib.util.UTILAllocate.makeAllocation



iterToVector
public Vector iterToVector(Iterator i)(Code)
Is there a better place for this?



makeAllocation
public PlanElement makeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, Date start, Date end, double cost, double confidence, Role assignedRole)(Code)
Creates an Allocation or FailedAllocation depending on whether start and end dates or cost exceed preference thresholds.
Parameters:
  ldmf - the PlanningFactory
Parameters:
  plan - the log plan
Parameters:
  t - the task to allocate
Parameters:
  asset - the asset assigned to handle the task
Parameters:
  start - - start date of allocation
Parameters:
  end - - end date of allocation
Parameters:
  cost - - the monetary cost of the allocation
Parameters:
  confidence - in the allocation PlanElement = Allocation or a FailedDisposition



makeAllocation
public PlanElement makeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, Date start, Date end, double confidence, Role assignedRole)(Code)
 Creates an Allocation or FailedDisposition 
 with an allocationResult w/ isSuccess=False or True, 
 depending on whether any of the start and end dates 
 exceed preference thresholds.
 Automates the checking of an allocation against its preferences
 Plugins should never have to create AllocationResults directly.
 If you want to find the score of a task-allocation result pair 
 before making the REAL allocation, you can call scoreAgainstPreferences
 (GSS).
 Note that returned Allocations will ALWAYS have
 an AllocationResult with isSuccess = TRUE.
 FailedDispositions will ALWAYS have isSuccess = FALSE.
 

Parameters:
  ldmf - the PlanningFactory
Parameters:
  plan - the log plan
Parameters:
  t - the task to allocate
Parameters:
  asset - the asset assigned to handle the task
Parameters:
  start - - start date of allocation
Parameters:
  end - - end date of allocation
Parameters:
  confidence - in the allocation PlanElement = Allocation or a FailedDisposition



makeAllocation
public PlanElement makeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, AspectValue[] aspects, double confidence, Role assignedRole)(Code)
Creates an Allocation or FailedDisposition with an allocationResult w/ isSuccess=False or True, depending on whether any of the aspect values of the allocation exceed any preference thresholds. This automates the checking of an allocation against its preferences. Plugins should never have to create AllocationResults directly. If you want to find the score of a task-allocation result pair before making the REAL allocation, you can call scoreAgainstPreferences (GSS). Note that returned Allocations will ALWAYS have an AllocationResult with isSuccess = TRUE. FailedDispositions will ALWAYS have isSuccess = FALSE.
Parameters:
  ldmf - the PlanningFactory
Parameters:
  plan - the log plan
Parameters:
  t - the task to allocate
Parameters:
  asset - the asset assigned to handle the task
Parameters:
  aspects - AspectValue array -- aspect represented as aspectValues
Parameters:
  confidence - in the allocation PlanElement = Allocation or a FailedDisposition



makeAllocation
public PlanElement makeAllocation(UTILPlugin creator, PlanningFactory ldmf, Plan plan, Task t, Asset asset, int[] aspectarray, double[] resultsarray, double confidence, Role assignedRole)(Code)
 Creates an Allocation or FailedDisposition with an 
 allocationResult w/ isSuccess=False or True, 
 depending on whether any of the aspect values of the 
 allocation exceed any preference thresholds.
 Also will automatically create a FailedDisposition if the asset
 passed in is null.
 This automates the checking of an allocation against its preferences.
 Plugins should never have to create AllocationResults directly.
 If you want to find the score of a task-allocation result pair 
 before making the REAL allocation, you can call scoreAgainstPreferences
 (GSS).
 Note that returned Allocations will ALWAYS have
 an AllocationResult with isSuccess = TRUE.
 FailedDispositions will ALWAYS have isSuccess = FALSE.
 

Parameters:
  ldmf - the PlanningFactory
Parameters:
  plan - the log plan
Parameters:
  t - the task to allocate
Parameters:
  asset - the asset assigned to handle the task (Ignored if failed allocation.)
Parameters:
  aspectarray - - array of aspect types
Parameters:
  resultsarray - - array of aspect values
Parameters:
  confidence - in the allocation PlanElement = Allocation or a FailedDisposition



makeFailedDisposition
public Disposition makeFailedDisposition(UTILPlugin creator, PlanningFactory ldmf, Task t, AllocationResult failedAR)(Code)
This should be used when the preference thresholds are exceeded, or the cumulative score for all preferences exceeds some threshold. This form lets the tasked cluster say how the preferences were exceeded.
Parameters:
  ldmf - PlanningFactory for making the plan elements
Parameters:
  t - Task that failed to be allocated
Parameters:
  failedAR - AllocationResult stating how the preferences would have beenexceeded. FailedDisposition
See Also:   UTILAllocate.makeFailedDisposition(PlanningFactory,Task)



makeFailedDisposition
public Disposition makeFailedDisposition(UTILPlugin ignoredCreator, PlanningFactory ldmf, Task task)(Code)
 When you just can't allocate!
 This should be used when the preference thresholds are exceeded, or 
 the cumulative
 score for all preferences exceeds some threshold.
 Generally the other makeFailedDisposition should be used -- 
 the tasking/superior cluster should be told not just that the allocation failed,
 but what aspect values made it fail.  This function does not let you specify
 the aspect results.
 

Parameters:
  ignoredCreator - - currently ignored slot that could be used for debugging
Parameters:
  ldmf - PlanningFactory for making the plan elements
Parameters:
  task - Task that failed to be allocated FailedDisposition
See Also:   UTILAllocate.makeFailedDisposition(PlanningFactory,Task,AllocationResult)



print
protected void print(AspectValue av, Preference pref, double score, AspectScoreRange definedRange, Enumeration validRanges)(Code)



printTypeValue
protected static String printTypeValue(int type, double value)(Code)



scoreAgainstPreferences
protected double scoreAgainstPreferences(Task t, AllocationResult allocResult)(Code)
Score of a task's preferences against an allocation result the total score of the allocation result against the task's preferences



scoreAgainstPreferences
public double scoreAgainstPreferences(Task t, Date start, Date end, double cost)(Code)
Score of a task's preferences against start and end dates, and cost
Parameters:
  t - task to check
Parameters:
  start - date to score against preferences
Parameters:
  end - date to score against preferences
Parameters:
  cost - - the monetary cost of a potential allocation double score



scoreAgainstPreferences
public double scoreAgainstPreferences(Task t, Date start, Date end)(Code)
Score of a task's preferences against start and end dates. Hoefully this form would be called most often...
Parameters:
  t - task to check
Parameters:
  start - date to score against preferences
Parameters:
  end - date to score against preferences double score



scoreAgainstPreferences
public double scoreAgainstPreferences(Task t, AspectValue[] aspectValues)(Code)
Score a task's preferences against given aspect values.
Parameters:
  t - task to check
Parameters:
  aspectValues - array of AspectValues double -- the score
See Also:   org.cougaar.planning.ldm.plan.AspectType
See Also:   org.cougaar.planning.ldm.plan.AspectValue



scoreAgainstPreferences
public double scoreAgainstPreferences(Task t, int[] aspectTypes, double[] aspectValues)(Code)
 Score a task's preferences against given aspect values.
 Throws an informative exception if somehow the 
 the aspect types being checked are not the same set as the task's 
 preferences.  E.g. if the task has only a START_TIME preference
 and one of the allocation aspects is COST, then this method
 will throw an exception.  This should never happen -- one
 should only assign aspects against a task's preferences.
 Protects against COUGAAR bug : sometimes preference weight
 gets lost... (ends up = 0).
 

Parameters:
  t - task to check
Parameters:
  aspectTypes - array of aspect types
Parameters:
  aspectValues - array of aspect values double -- score of these aspect values against the task's preferences
See Also:   org.cougaar.planning.ldm.plan.AspectType
See Also:   org.cougaar.planning.ldm.plan.AspectValue
See Also:   org.cougaar.planning.ldm.plan.Preference



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.