ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
Nondeterminism.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*------------------------- File Nondeterminism.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
30
/*--------------------------------------------------------------------------*/
31
/*----------------------------- DEFINITIONS --------------------------------*/
32
/*--------------------------------------------------------------------------*/
33
34
#ifndef __ADS_Nondeterminism
35
#define __ADS_Nondeterminism
36
/* self-identification: #endif constant */
37
38
/*--------------------------------------------------------------------------*/
39
/*------------------------------ INCLUDES ----------------------------------*/
40
/*--------------------------------------------------------------------------*/
41
42
#include "
ADS/Contract.h
"
43
44
#include <cstddef>
45
#include <vector>
46
47
/*--------------------------------------------------------------------------*/
48
/*--------------------------- NAMESPACE ------------------------------------*/
49
/*--------------------------------------------------------------------------*/
50
51
namespace
ADS
52
{
53
55
class
Chooser
56
{
57
58
/*--------------------------------------------------------------------------*/
59
public
:
77
int
choice
(
int
k );
78
101
template
<
class
A >
102
bool
run
( A && alg ,
long
* runs =
nullptr
);
103
105
[[nodiscard]] std::vector< int >
choices
(
void
)
const
;
106
107
/*--------------------------------------------------------------------------*/
108
private
:
109
std::vector< std::pair< int , int > > f_path;
110
std::size_t f_depth = 0;
111
112
};
// end( class Chooser )
113
114
/*--------------------------------------------------------------------------*/
115
116
}
// end( namespace ADS )
117
118
/*--------------------------------------------------------------------------*/
119
/*-------------------------- IMPLEMENTATION --------------------------------*/
120
/*--------------------------------------------------------------------------*/
121
122
#include "ADS/complexity/impl/Nondeterminism.tpp"
123
124
/*--------------------------------------------------------------------------*/
125
126
#endif
/* Nondeterminism.h included */
127
128
/*--------------------------------------------------------------------------*/
129
/*----------------------- End File Nondeterminism.h ------------------------*/
130
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::Chooser
the simulation of choice(), success and failure
Definition
Nondeterminism.h:56
ADS::Chooser::choices
std::vector< int > choices(void) const
the choices of the last run, the successful one after a YES
ADS::Chooser::run
bool run(A &&alg, long *runs=nullptr)
whether some sequence of choices makes alg( *this ) return true; the runs made go to *runs,...
ADS::Chooser::choice
int choice(int k)
the choice among that the current sequence makes at this depth, 0 the first time the depth is reache...
ADS
Definition
ADT.h:96
ADS
complexity
Nondeterminism.h
Generated by
1.17.0