Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
ABMEv
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
bvictor
ABMEv
Commits
ef82da8a
Commit
ef82da8a
authored
Oct 20, 2020
by
Victor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to include discretespace
parent
d4c1e4ec
Pipeline
#76099
passed with stage
in 18 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
src/ABMEv.jl
src/ABMEv.jl
+1
-1
src/ABMEv_Space.jl
src/ABMEv_Space.jl
+11
-1
test/space_agent.jl
test/space_agent.jl
+4
-0
No files found.
src/ABMEv.jl
View file @
ef82da8a
...
...
@@ -22,7 +22,7 @@ module ABMEv
@reexport
using
Distributions
,
DataFrames
export
GraphSpace
,
ContinuousSegment
,
DiscreteSegment
,
RealSpace
,
export
GraphSpace
,
ContinuousSegment
,
DiscreteSegment
,
RealSpace
,
NaturalSpace
,
AbstractSpacesTuple
,
get_inc
export
update_rates!
export
AbstractAgent
,
Agent
,
get_fitness
,
get_x
,
get_t
,
get_dim
,
...
...
src/ABMEv_Space.jl
View file @
ef82da8a
...
...
@@ -47,9 +47,11 @@ end
"""
$(TYPEDEF)
A real pace with dimension N and type T
A real
s
pace with dimension N and type T
"""
struct
RealSpace
{
N
,
T
}
<:
AbstractSpace
{
N
,
T
,
IsFinite
{
false
}}
end
struct
NaturalSpace
{
N
,
T
}
<:
AbstractSpace
{
N
,
T
,
IsFinite
{
false
}}
end
# TODO: find a way to put a type on D in get_inc
...
...
@@ -61,6 +63,14 @@ function _get_inc(D,s::AbstractSpace{Dim,T,I}) where {Dim,T<:AbstractFloat,I<:Is
end
end
function
_get_inc
(
D
,
s
::
AbstractSpace
{
Dim
,
T
,
I
})
where
{
Dim
,
T
<:
Integer
,
I
<:
IsFinite
{
false
}}
if
Dim
>
1
return
Tuple
(
round
.
(
T
,
D
.*
randn
(
Float32
,
Dim
)))
else
return
round
(
D
*
randn
(
Float32
))
end
end
"""
$(SIGNATURES)
Returns increment corresponding to space `s`
...
...
test/space_agent.jl
View file @
ef82da8a
...
...
@@ -7,6 +7,7 @@ mysegment = DiscreteSegment(1,10)
mygraph
=
GraphSpace
(
SimpleGraph
(
10
,
10
))
real2d
=
RealSpace
{
2
,
Float64
}()
myline
=
RealSpace
{
1
,
Float16
}()
mydiscreteline
=
NaturalSpace
{
1
,
Int8
}()
mycontinuoussegment
=
ContinuousSegment
(
-
1.
,
1.
)
myspace
=
(
mysegment
,
mygraph
,
myline
)
myspace2
=
(
mysegment
,
mycontinuoussegment
,
real2d
)
...
...
@@ -23,8 +24,11 @@ myspace2 = (mysegment,mycontinuoussegment,real2d)
# increment on infinite spaces
@test
ABMEv
.
_get_inc
(
0.
,
myline
)
≈
(
0.
)
@test
ABMEv
.
_get_inc
(
0.
,
mydiscreteline
)
≈
(
0.
)
@test
!
(
ABMEv
.
_get_inc
(
1.
,
myline
)
≈
0.
)
@test
!
(
get_inc
(
1
,
1.
,
myline
)
≈
0.
)
@test
!
(
get_inc
(
1
,
1.
,
mydiscreteline
)
≈
0.
)
@test
typeof
(
ABMEv
.
_get_inc
([
1.
,
0.
],
real2d
))
==
Tuple
{
Float64
,
Float64
}
@test
typeof
(
get_inc
([
1.
,
0.
],[
1.
,
0.
],
real2d
))
==
Tuple
{
Float64
,
Float64
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment