FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
seldon/include/model.hpp at main · seldon-code/seldon · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
seldon-code
/
seldon
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
7
Code
Issues
4
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
seldon
/
include
/
model.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (43 loc) · 1016 Bytes
Breadcrumbs
seldon
/
include
/
model.hpp
Copy path
File metadata and controls
53 lines (43 loc) · 1016 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
pragma
once
#
include
<
cstddef
>
#
include
<
optional
>
namespace
Seldon
{
/*
Model<T> is a base class from which the acutal models would derive. They have efficient access to a vector of AgentT,
* without any pointer indirections
*/
template
<
typename
AgentT_>
class
Model
{
public:
using
AgentT = AgentT_;
Model
() =
default
;
Model
( std::optional<
size_t
> max_iterations ) : max_iterations( max_iterations ){};
virtual
void
initialize_iterations
()
{
_n_iterations =
0
;
}
virtual
void
iteration
()
{
_n_iterations++;
};
size_t
n_iterations
()
{
return
_n_iterations;
}
virtual
bool
finished
()
{
if
( max_iterations.
has_value
() )
{
return
max_iterations.
value
() <=
n_iterations
();
}
else
{
return
false
;
}
};
virtual
~Model
() =
default
;
private:
std::optional<
size_t
> max_iterations = std::
nullopt
;
size_t
_n_iterations{};
};
}
//
namespace Seldon
Back
|
FazBrowse Home
|
New Git URL