Public Types | |
using | LedAndMeasurement = std::pair< Led &, LedMeasurement const & > |
using | LedMeasDistance = std::tuple< std::size_t, std::size_t, float > |
using | HeapValueType = LedMeasDistance |
using | HeapType = std::vector< HeapValueType > |
using | size_type = HeapType::size_type |
Public Member Functions | |
AssignMeasurementsToLeds (LedGroup &leds, LedMeasurementVec const &measurements, const std::size_t numBeacons, float blobMoveThresh, bool verbose=false) | |
void | populateStructures () |
Must call first, and only once. More... | |
size_type | discardInvalidEntries (bool verbose=false) |
bool | resumbitMeasurement (LedMeasurement const &meas) |
bool | hasMoreMatches (bool verbose=false) |
LedAndMeasurement | getMatch (bool verbose=false) |
Requires that hasMoreMatches() has been run and returns true. More... | |
bool | haveMadeMaxMatches () const |
size_type | maxMatches () const |
bool | empty () const |
Is our heap of possibilities empty? More... | |
size_type | size () const |
Entries in the heap of possibilities. More... | |
size_type | theoreticalMaxSize () const |
double | heapSizeFraction () const |
The fraction of the theoretical max that the size is. More... | |
size_type | numUnclaimedLedObjects () const |
void | eraseUnclaimedLedObjects (bool verbose=false) |
size_type | numUnclaimedMeasurements () const |
template<typename F > | |
void | forEachUnclaimedMeasurement (F &&op) |
size_type | numCompletedMatches () const |
Definition at line 75 of file AssignMeasurementsToLeds.h.
|
inline |
Must call first, and only once.
Clean up LEDs and populate their ref vector.
Populate the measurement ref vector.
Do the O(n * m) distance computation to populate the vector that will become our min-heap.
WARNING: watch the order of arguments to this function, since the type of the indices is identical...
Turn that vector into our min-heap.
More efficient to do this one-time 3N=O(n) operation, than repeatedly push_heap (2log(N)=O(log n)) as we go, because:
Definition at line 96 of file AssignMeasurementsToLeds.h.
|
inline |
Discards invalid entries (those where either the LED or the measurement, or both, have already been assigned) from the heap, and returns the count of entries so discarded.
Great, we found one!
Definition at line 145 of file AssignMeasurementsToLeds.h.
|
inline |
In case a measurement update goes bad, we can try to "un-mark" a measurement as consumed.
Un-count the match.
Restore the entry in the refs table.
Definition at line 178 of file AssignMeasurementsToLeds.h.
|
inline |
Searches the heap, discarding now-invalid entries, until it finds an entry where both the LED and the measurement are unclaimed, or it runs out of entries.
Early out: We've already matched up all of one type or another.
Definition at line 208 of file AssignMeasurementsToLeds.h.
|
inline |
Requires that hasMoreMatches() has been run and returns true.
Mark that we've used this LED and measurement.
Postcondition check - shouldn't be valid anymore, we just consumed it.
Now, remove this entry from the heap.
Count it
and return the reward.
Definition at line 232 of file AssignMeasurementsToLeds.h.
|
inline |
Have we made as many matches as we possibly can? (that is, the minimum of the number of LED objects and the number of measurements)
Not terribly harmful here, just illogical, so assert instead of unconditional check and throw.
Definition at line 273 of file AssignMeasurementsToLeds.h.
|
inline |
The maximum number of matches theoretically achievable with this input: the minimum of the number of LED objects and the number of measurements
Definition at line 285 of file AssignMeasurementsToLeds.h.
|
inline |
Is our heap of possibilities empty?
Not terribly harmful here, just illogical, so assert instead of unconditional check and throw.
Definition at line 288 of file AssignMeasurementsToLeds.h.
|
inline |
Entries in the heap of possibilities.
Not terribly harmful here, just illogical, so assert instead of nconditional check and throw.
Definition at line 298 of file AssignMeasurementsToLeds.h.
|
inline |
This is the size it could have potentially been, had all LEDs been within the distance threshold. (O(n m))
Definition at line 309 of file AssignMeasurementsToLeds.h.
|
inline |
The fraction of the theoretical max that the size is.
Not terribly harmful here, just illogical, so assert instead of unconditional check and throw.
Definition at line 314 of file AssignMeasurementsToLeds.h.
|
inline |
already used
Definition at line 330 of file AssignMeasurementsToLeds.h.
|
inline |