Scippy

UG

Ubiquity Generator framework

SelectionHeap Class Referenceabstract

class Selection Heap More...

#include <bbParaSolverPool.h>

Inheritance diagram for SelectionHeap:
AscendingSelectionHeap DescendingSelectionHeap

Public Types

enum  ResultOfInsert { SUCCEEDED , FAILED_BY_FULL }
 results of insert More...
 

Public Member Functions

 SelectionHeap (std::size_t size)
 constructor More...
 
virtual ~SelectionHeap ()
 destructor More...
 
ResultOfInsert insert (BbParaSolverPoolElementPtr solver)
 insert BbParaSolverPoolElementPtr to Selection Heap More...
 
BbParaSolverPoolElementPtr top () const
 obtain top priority BbParaSolverPoolElementPtr More...
 
BbParaSolverPoolElementPtr get (int i) const
 obtain i-th in heap BbParaSolverPoolElementPtr More...
 
BbParaSolverPoolElementPtr remove ()
 remove top priority BbParaSolverPoolElementPtr from Selection Heap More...
 
void resize (std::size_t size)
 resize Selection Heap More...
 
std::size_t getHeapSize () const
 get current used heap size More...
 
std::size_t getMaxHeapSize () const
 get max heap size More...
 
virtual void updateDualBoundValue (BbParaSolverPoolElementPtr solver, double value)=0
 update selection heap by a new dual bound value of this Solver More...
 
virtual void deleteElement (BbParaSolverPoolElementPtr solver)=0
 delete BbParaSolverPoolElementPtr from Selection Heap More...
 
virtual void upHeap (std::size_t pos)=0
 up heap More...
 
virtual void downHeap (std::size_t pos)=0
 down heap More...
 
const std::string toString ()
 stringfy of this object for debugging More...
 

Protected Attributes

std::size_t maxHeapSize
 maximum size of this heap More...
 
std::size_t heapSize
 current used heap size More...
 
BbParaSolverPoolElementPtrheap
 heap : contents are BbParaSolverPoolElementPtr More...
 

Detailed Description

class Selection Heap

Definition at line 865 of file bbParaSolverPool.h.

Member Enumeration Documentation

◆ ResultOfInsert

results of insert

Enumerator
SUCCEEDED 

SUCCEEDED.

FAILED_BY_FULL 

FAILED_BY_FULL.

Definition at line 873 of file bbParaSolverPool.h.

Constructor & Destructor Documentation

◆ SelectionHeap()

SelectionHeap ( std::size_t  size)

constructor

constructor of selection heap

Parameters
sizeheap size

Definition at line 53 of file bbParaSolverPool.cpp.

References SelectionHeap::heap, SelectionHeap::heapSize, and SelectionHeap::maxHeapSize.

◆ ~SelectionHeap()

~SelectionHeap ( )
virtual

destructor

destructor of selection heap

Definition at line 63 of file bbParaSolverPool.cpp.

References SelectionHeap::heap.

Member Function Documentation

◆ deleteElement()

virtual void deleteElement ( BbParaSolverPoolElementPtr  solver)
pure virtual

delete BbParaSolverPoolElementPtr from Selection Heap

Parameters
solverSolver pool element to be deleted

Implemented in DescendingSelectionHeap, and AscendingSelectionHeap.

Referenced by BbParaSolverPool::inactivateSolver(), BbParaSolverPool::resetCountersInSolver(), and BbParaSolverPool::solverDied().

◆ downHeap()

virtual void downHeap ( std::size_t  pos)
pure virtual

down heap

Parameters
posstart position to down heap

Implemented in DescendingSelectionHeap, and AscendingSelectionHeap.

Referenced by SelectionHeap::remove().

◆ get()

BbParaSolverPoolElementPtr get ( int  i) const

obtain i-th in heap BbParaSolverPoolElementPtr

Returns
ith in heap BbParaSolverPoolElementPtr

Definition at line 914 of file bbParaSolverPool.h.

References SelectionHeap::heap.

Referenced by BbParaSolverPool::getGoodSolverSolvingEssentialNode().

◆ getHeapSize()

◆ getMaxHeapSize()

std::size_t getMaxHeapSize ( ) const

get max heap size

Returns
max heap size

Definition at line 949 of file bbParaSolverPool.h.

References SelectionHeap::maxHeapSize.

◆ insert()

insert BbParaSolverPoolElementPtr to Selection Heap

Returns
succeeded or fail because of full

insert BbParaSolverPoolElementPtr to selection heap

Parameters
inSolverSolver pool element to be inserted

Definition at line 84 of file bbParaSolverPool.cpp.

References SelectionHeap::FAILED_BY_FULL, SelectionHeap::heap, SelectionHeap::heapSize, SelectionHeap::maxHeapSize, SelectionHeap::SUCCEEDED, and SelectionHeap::upHeap().

Referenced by BbParaRacingSolverPool::activate(), and BbParaSolverPool::activateSolver().

◆ remove()

remove top priority BbParaSolverPoolElementPtr from Selection Heap

Returns
removed top priority BbParaSolverPoolElementPtr

remove the top priority element form selection heap

Definition at line 96 of file bbParaSolverPool.cpp.

References SelectionHeap::downHeap(), SelectionHeap::heap, SelectionHeap::heapSize, and BbParaSolverPoolElement::setSelectionHeapElement().

◆ resize()

void resize ( std::size_t  size)

resize Selection Heap

resize selection heap

Parameters
sizenew size

Definition at line 70 of file bbParaSolverPool.cpp.

References SelectionHeap::heap, and SelectionHeap::maxHeapSize.

◆ top()

◆ toString()

◆ updateDualBoundValue()

virtual void updateDualBoundValue ( BbParaSolverPoolElementPtr  solver,
double  value 
)
pure virtual

update selection heap by a new dual bound value of this Solver

Parameters
solverSolver pool element to be updated
valuedual bound value

Implemented in DescendingSelectionHeap, and AscendingSelectionHeap.

Referenced by BbParaRacingSolverPool::updateSolverStatus(), and BbParaSolverPoolForMinimization::updateSolverStatus().

◆ upHeap()

virtual void upHeap ( std::size_t  pos)
pure virtual

up heap

Parameters
posstart position to up heap

Implemented in DescendingSelectionHeap, and AscendingSelectionHeap.

Referenced by SelectionHeap::insert().

Member Data Documentation

◆ heap

◆ heapSize

◆ maxHeapSize

std::size_t maxHeapSize
protected