Helios++
Helios software for LiDAR simulations
|
Min dragger drags the minimum element. The first time next is called the minimum element is returned, the second time the second minimum element is returned and so on. More...
#include <MinDragger.hpp>
Public Member Functions | |
MinDragger (vector< E > x) | |
Build a minimum dragger. More... | |
virtual | ~MinDragger () |
Default destructor. | |
bool | hasNext () override |
![]() | |
E | next () override |
Implementation of next method for optimization draggers. More... | |
Protected Member Functions | |
virtual void | initialize () |
Initialize the minimum dragger to the initial status. More... | |
E | pick () override |
Pick the minimum element inside \([a, b]\) indices. More... | |
void | update () override |
Update the minimum dragger status which basically means updating \(a\) and \(b\) values while partially sorting the collection. More... | |
virtual void | partialSort () |
Do a partial sort. More... | |
Protected Attributes | |
vector< E > | x |
The collection (as vector) to min-drag from. | |
size_t | stopSize |
The number of elements in the collection x, minus 1. More... | |
bool | initialized = false |
Specify if the min dragger has been initialized (true) or nor (false). More... | |
size_t | a = 0 |
The start index. | |
size_t | b = 0 |
The end index. | |
size_t | c = 0 |
The current index. | |
Min dragger drags the minimum element. The first time next is called the minimum element is returned, the second time the second minimum element is returned and so on.
E | Type of elements to drag |
|
inline |
|
inlineoverridevirtual |
|
protectedvirtual |
Initialize the minimum dragger to the initial status.
The initialize method is called on first invocation to update method.
|
protectedvirtual |
Do a partial sort.
Let \(\alpha = \min(\{x_a, \ldots, x_b\})\) and \(\beta = \max(\{x_a, \ldots, x_b\})\). Now, the \(x\) vector is updated swapping element at \(a\) with \(\alpha\) element and then swapping element at \(b\) with \(\beta\) element.
|
inlineoverrideprotectedvirtual |
Pick the minimum element inside \([a, b]\) indices.
Implements SurfaceInspector::util::draggers::OptimizationDragger< E >.
|
overrideprotectedvirtual |
Update the minimum dragger status which basically means updating \(a\) and \(b\) values while partially sorting the collection.
First call to update method will invoke initialize.
Implements SurfaceInspector::util::draggers::OptimizationDragger< E >.
|
protected |
Specify if the min dragger has been initialized (true) or nor (false).
A min dragger is mean to be initialized after calling update method for the first time.
|
protected |
The number of elements in the collection x, minus 1.
It is necessary to handle iterative dragging.