![]() | ||||||
#include <UserDef.h>
Inheritance diagram for UserDef:


UserDef:
Allocation class for user-specified allocations. This class allows the user to create an allocation from scratch, or to import an existing allocation and tweak it. This class is needed because search managers will almost always be aware of more constraints than the current program can handle.
Note: The calcAllocation function does nothing in UserDef.
Author : Andre Oboler
Definition at line 80 of file UserDef.h.
Public Member Functions | |
| UserDef (const int p_no_resources, const int p_no_areas, const Array2D &p_effectiveness, const valarray< double > p_available, const valarray< double > p_POC) | |
| Make a user-defined allocn: ie an empty allocn matrix of the correct size. | |
| UserDef (const UserDef &p_allocation) | |
| UserDef (Allocation &oldAllocation) | |
| Create a UserDef Allocation from an existing allocation (of another type). | |
| ~UserDef () | |
| Empty destructor for UserDef. | |
| void | clearAll () |
| Clears all existing allocations. | |
| void | clearArea (const int area) |
| Unassigns all resources in an area. | |
| void | calcAllocation (void) |
| In UserDef, calcAllocation does nothing. | |
| void | clearResource (const int resource) |
| Unassigns all of a resource, making it unallocated. | |
| void | remove (const int fromArea, const int resource, const double amount) |
| Remove part of this resource (to the unallocated pool). | |
| void | remove (const int fromArea, const int resource) |
| Remove all of this resource (to the unallocated pool). | |
| void | add (const int toArea, const int resource, const double amount) |
| Assign some of this resource from unallocated pool to area toArea. | |
| void | add (const int toArea, const int resource) |
| Assign whatever remains of this resource to area toArea. | |
| void | move (const int fromArea, const int toArea, const int resource) |
| Moves an amount of a resource between areas. | |
| void | move (const int fromArea, const int toArea, const int resource, const double amount) |
| Moves an amount of a resource between areas. | |
Protected Member Functions | |
| ActiveArea * | firstArea (void) const |
| Returns the area number of the first area in this allocation. | |
| ActiveArea * | nextArea (const int currentArea) const |
| Given an area number, returns the next area with an assignment. | |
| AreaAssignment * | firstArea (const int resource) const |
| Returns the first AreaAssignment for a given resource. | |
| AreaAssignment * | nextArea (const int resource, const int currentArea) const |
| Given a resource and area, returns next AreaAssignment for this resource. | |
| ResourceAssignment * | firstRes (const int area) const |
| Given an area, returns the first resource assigned there. | |
| ResourceAssignment * | nextRes (const int area, const int currentResource) const |
| Given a resource & area, returns the next resource assigned there. | |
Private Member Functions | |
| UserDef & | operator= (const UserDef &p_allocation) |
| bool | isValidArea (const int area) const |
| Checks to see the chosen area is valid. | |
| bool | isValidResource (const int resource) const |
| Checks to see the chosen resource is valid. | |
Private Attributes | |
| Array2D | myAssignments |
| The set of assignments, stored as a simple matrix. | |
| valarray< double > | myUnallocatedResources |
Friends | |
| class | AreaIterator |
| So that the AreaIterator can access the first and next functions. | |
| class | ResourceIterator |
| So that the ResourceIterator can access the first and next functions. | |
| class | ActiveAreasIterator |
| So that the ActiveAreasIterator can access the first and next fnctns. | |
|
||||||||||||||||||||||||
|
Make a user-defined allocn: ie an empty allocn matrix of the correct size. The from-scratch constructor. Makes a user-defined allocation: an empty allocation matrix of the right size. The user may fill this with the methods of UserDef. Definition at line 86 of file UserDef.cpp. |
|
|
Create a UserDef Allocation from an existing allocation (of another type). Makes a user-defined allocation from an existing allocation (of any type). The user may then modify this allocation. 18apr03: crt simplified & debugged 01may03: crt even further simplified thx to njh Definition at line 111 of file UserDef.cpp. References ResourceIterator::atEnd(), ActiveAreasIterator::atEnd(), ActiveArea::getActiveAreaNum(), ResourceAssignment::getResourceNum(), ResourceAssignment::getTime(), and myAssignments. |
|
||||||||||||
|
Assign whatever remains of this resource to area toArea. Assign whatever remains (unallocated) of this resource to the requested area. Specifically, moves all of a resource from UNALLOCATED_AREA to another area. Author: Andre Oboler (ASO) Definition at line 327 of file UserDef.cpp. References move(). |
|
||||||||||||||||
|
Assign some of this resource from unallocated pool to area toArea. Assign some of a resource to the specified area. Move a resource from the unallocated area to another area. Author: Andre Oboler (ASO) Definition at line 311 of file UserDef.cpp. References move(). Referenced by testCase(). |
|
|
In UserDef, calcAllocation does nothing. UserDef provides "calcAllocaton" just to keep the coding standard. Since the allocation "algorithm" for UserDef is wired through the keyboard (ie, it's the user), this routine does nothing. Implements Allocation. Definition at line 157 of file UserDef.cpp. |
|
|
Clears all existing allocations. Clears all existing allocations, moving all resources in all areas back to the unallocated pool. Author: Andre Oboler (ASO) Definition at line 437 of file UserDef.cpp. References myAssignments, Allocation::myNumAreas, Allocation::myNumResources, and remove(). |
|
|
Unassigns all resources in an area. Unassigns all resources in area. Specifically, it moves all resources in area to UNALLOCATED_AREA. Note: This code could use the first area and next area function but that adds extra overhead (in calling the functions) for no apparent again. Author: Andre Oboler (ASO) Definition at line 406 of file UserDef.cpp. References isValidArea(), myAssignments, Allocation::myNumResources, and remove(). |
|
|
Unassigns all of a resource, making it unallocated. Unassigns all of a resource. Moves all instances of a resource to the unallocated area. Author: Andre Oboler (ASO) Definition at line 376 of file UserDef.cpp. References myAssignments, Allocation::myNumAreas, and remove(). |
|
|
Returns the first AreaAssignment for a given resource. Returns the first AreaAssignment (an area and a time) for a given resource. If this resource is not assigned to any area, returns NULL. If the resource is invalid, returns NULL.
Implements Allocation. Definition at line 504 of file UserDef.cpp. References isValidResource(), myAssignments, and Allocation::myNumAreas. |
|
|
Returns the area number of the first area in this allocation. Returns the area number of the first area in this allocation. If the allocation is empty, returns NULL. Author: Andre Oboler (ASO) Implements Allocation. Definition at line 469 of file UserDef.cpp. References myAssignments, Allocation::myNumAreas, and Allocation::myNumResources. |
|
|
Given an area, returns the first resource assigned there. Given an area, it returns the first resource assigned to that area (returned as a ResourceAssignment with the resource and time). If there are no resources, it returns NULL.
Implements Allocation. Definition at line 628 of file UserDef.cpp. References isValidArea(), myAssignments, and Allocation::myNumResources. |
|
|
Checks to see the chosen area is valid. Helper function that checks to see that the chosen area is valid. It does not consider the UNALLOCATED_AREA to be valid, so you must check for that separately in some of the move functions. This function makes code a little clearer and easier to change. crt Definition at line 173 of file UserDef.cpp. References Allocation::myNumAreas. Referenced by clearArea(), firstRes(), move(), nextArea(), and nextRes(). |
|
|
Checks to see the chosen resource is valid. Helper function that checks to see that the chosen resource is valid. Just cleans up other code a little to have this. crt Definition at line 186 of file UserDef.cpp. References Allocation::myNumResources. Referenced by firstArea(), move(), nextArea(), and nextRes(). |
|
||||||||||||||||||||
|
Moves an amount of a resource between areas. Moves amount of resource from fromArea to toArea. This is the basic movement code, all other movement code should call this to ensure the range checking only needs to be coded once and changed once if the specs change. Author: Andre Oboler (ASO) Definition at line 205 of file UserDef.cpp. References Allocation::forceRecalc, isValidArea(), isValidResource(), myAssignments, and myUnallocatedResources. |
|
||||||||||||||||
|
Moves an amount of a resource between areas. Move all of this resource from fromArea to toArea. Author: Andre Oboler (ASO) Definition at line 293 of file UserDef.cpp. |
|
||||||||||||
|
Given a resource and area, returns next AreaAssignment for this resource. Given a resource and an area, returns the next area (and time) that this resource is assigned to. If there are no more areas or if the resource is not assigned to any more areas, returns NULL.
Implements Allocation. Definition at line 588 of file UserDef.cpp. References isValidArea(), isValidResource(), myAssignments, and Allocation::myNumAreas. |
|
|
Given an area number, returns the next area with an assignment. Given an area number, returns the next area that has something assigned to it in this set of allocations. If there is no following area has resources assigned to it, the function returns NULL. NOTE: This function searches by AREA, that is, it searches through all resources in area N before trying area N+1. Etc.
Implements Allocation. Definition at line 545 of file UserDef.cpp. References isValidArea(), myAssignments, Allocation::myNumAreas, and Allocation::myNumResources. |
|
||||||||||||
|
Given a resource & area, returns the next resource assigned there. Given a resource and an area, it returns the next resource assigned to that area (as a ResourceAssignment). If there are no next resources, it returns NULL.
Implements Allocation. Definition at line 667 of file UserDef.cpp. References isValidArea(), isValidResource(), myAssignments, and Allocation::myNumResources. |
|
||||||||||||
|
Remove all of this resource (to the unallocated pool). Unassign all of a resource from the specified area. That is, move all of a resource from a specified area to UNALLOCATED_AREA Author: Andre Oboler (ASO) Definition at line 359 of file UserDef.cpp. References move(). |
|
||||||||||||||||
|
Remove part of this resource (to the unallocated pool). Unassigns a specified amount of the specified resource. That is, moves some of a resource from an area back to the UNALLOCATED_AREA. Author: Andre Oboler (ASO) Definition at line 343 of file UserDef.cpp. References move(). Referenced by clearAll(), clearArea(), clearResource(), and testCase(). |
|
|
myUnallocatedResources stores the number of unallocated hours for each resource. As hours are assigned this value must be adjusted. Definition at line 142 of file UserDef.h. Referenced by move(). |
| (SARBayes) | Main | Related Pages | Class List | Hierarchy | Methods | Files |
|---|