ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Paradigms.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File Paradigms.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
53/*--------------------------------------------------------------------------*/
54/*----------------------------- DEFINITIONS --------------------------------*/
55/*--------------------------------------------------------------------------*/
56
57#ifndef __ADS_Paradigms
58 #define __ADS_Paradigms
59/* self-identification: #endif constant */
60
61/*--------------------------------------------------------------------------*/
62/*------------------------------ INCLUDES ----------------------------------*/
63/*--------------------------------------------------------------------------*/
64
65#include "ADS/Contract.h"
66
67#include <optional>
68#include <utility>
69#include <vector>
70
71/*--------------------------------------------------------------------------*/
72/*--------------------------- NAMESPACE ------------------------------------*/
73/*--------------------------------------------------------------------------*/
74
75namespace ADS
76{
77
94template< class Z , class Next , class Last , class A , class O >
95auto enumerateSearch( Z z , Next && next , Last && last , A && a , O && o )
96 -> std::optional< decltype( o( z ) ) >;
97
117template< class Z , class Next , class Last , class A , class O , class M ,
118 class B >
119auto enumerateOptimize( Z z , Next && next , Last && last , A && a , O && o ,
120 M && m , B && better )
121 -> std::optional< decltype( o( z ) ) >;
122
141template< class N , class C , class P , class L , class V >
142bool backtrack( const N & node , C && children , P && prune , L && leaf ,
143 V && visit );
144
162template< class X , class Cand , class Best >
163std::vector< X > greedy( int k , Cand && candidates , Best && best );
164
180template< class X , class S , class D , class V , class C >
181auto divideEtImpera( const X & x , S && small , D && direct , V && divide ,
182 C && combine ) -> decltype( direct( x ) );
183
198template< class T , class B >
199std::vector< T > maximal( const std::vector< T > & X , B && better );
200
201/*--------------------------------------------------------------------------*/
202
203} // end( namespace ADS )
204
205/*--------------------------------------------------------------------------*/
206/*-------------------------- IMPLEMENTATION --------------------------------*/
207/*--------------------------------------------------------------------------*/
208
209#include "ADS/algorithm/impl/Paradigms.tpp"
210
211/*--------------------------------------------------------------------------*/
212
213#endif /* Paradigms.h included */
214
215/*--------------------------------------------------------------------------*/
216/*-------------------------- End File Paradigms.h --------------------------*/
217/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::vector< X > greedy(int k, Cand &&candidates, Best &&best)
the greedy scheme: for each of stages, the best of the values candidates( i , x ) admissible after t...
std::vector< T > maximal(const std::vector< T > &X, B &&better)
the elements of that are maximal for the partial order better( a , b ), i.e., strictly better than
auto enumerateSearch(Z z, Next &&next, Last &&last, A &&a, O &&o) -> std::optional< decltype(o(z)) >
the enumerative search from the first object : the answer of the first with , next( z ) after unti...
bool backtrack(const N &node, C &&children, P &&prune, L &&leaf, V &&visit)
the backtracking from the node : prune( N ) rejects and its subtree, a leaf goes to visit( N ),...
auto enumerateOptimize(Z z, Next &&next, Last &&last, A &&a, O &&o, M &&m, B &&better) -> std::optional< decltype(o(z)) >
the enumerative optimization: the answer of an admissible object of with no admissible one better,...
auto divideEtImpera(const X &x, S &&small, D &&direct, V &&divide, C &&combine) -> decltype(direct(x))
divide et impera: direct( x ) if small( x ), else the combination of the solutions of the instances t...
auto children(Tree< T > *t)
the children of , from the leftmost, as a range
Definition Tree.h:409
Definition ADT.h:96