![]() | ||||||
#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
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. | |
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. |
|
|
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 |
|
||||||||||||
|
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) |
|
||||||||||||||||
|
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) |
|
|
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. |
|
|
Clears all existing allocations. Clears all existing allocations, moving all resources in all areas back to the unallocated pool. Author: Andre Oboler (ASO) |
|
|
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) |
|
|
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) |
|
|
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. |
|
|
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. |
|
|
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. |
|
||||||||||||||||||||
|
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) |
|
||||||||||||||||
|
Moves an amount of a resource between areas. Move all of this resource from fromArea to toArea. Author: Andre Oboler (ASO) |
|
||||||||||||
|
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. |
|
|
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. |
|
||||||||||||
|
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. |
|
||||||||||||
|
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) |
|
||||||||||||||||
|
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) |
| (SARBayes) | Main | Related Pages | Class List | Hierarchy | Methods | Files |
|---|