Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
floor_simulation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maximilian Gruber
floor_simulation
Commits
74220392
Commit
74220392
authored
5 years ago
by
Maximilian Gruber
Browse files
Options
Downloads
Patches
Plain Diff
Initial draft of agentMET4FOF connector
parent
e38549c2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run_agents.py
+52
-0
52 additions, 0 deletions
run_agents.py
with
52 additions
and
0 deletions
run_agents.py
0 → 100644
+
52
−
0
View file @
74220392
import
glob
import
os
import
numpy
as
np
import
pandas
as
pd
# import directly from git folder
import
sys
sys
.
path
.
append
(
"
../agentMET4FOF
"
)
from
agentMET4FOF.agents
import
AgentMET4FOF
,
AgentNetwork
,
MonitorAgent
from
agentMET4FOF.streams
import
DataStreamMET4FOF
class
SensorAgent
(
AgentMET4FOF
):
def
init_parameters
(
self
,
sampling_period
=
1.0
):
self
.
sampling_period
=
sampling_period
def
on_received_message
(
self
,
message
):
# do something
self
.
send_output
(
1.0
)
class
SensorStream
(
DataStreamMET4FOF
):
def
__init__
(
self
,
sensor_id
=
""
):
x
=
np
.
random
.
random
(
300
)
y
=
None
self
.
set_data_source
(
x
,
y
)
def
main
():
# start agent network server
agentNetwork
=
AgentNetwork
([
SensorAgent
,
SensorStream
])
# init agents
monitor_agent
=
agentNetwork
.
add_agent
(
agentType
=
MonitorAgent
)
sensor_agent
=
agentNetwork
.
add_agent
(
agentType
=
SensorAgent
)
# connect
agentNetwork
.
bind_agents
(
sensor_agent
,
monitor_agent
)
# set all agents states to "Running"
agentNetwork
.
set_running_state
()
# allow for shutting down the network after execution
return
agentNetwork
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment