-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- EXNN.Nodes.Loader register all node servers iterating through genomes
- EXNN.Trainer iteratively signals sensors to start propagation of impulses - server_for resolution moved to the EXNN.NodeSupervisor.Forwarder
- Loading branch information
Showing
11 changed files
with
155 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule EXNN.Nodes.Loader do | ||
|
||
def start_link do | ||
# implement state dump for restarts | ||
result = Agent.get(EXNN.Connectome, &(&1)) | ||
|> Enum.each(®ister/1) | ||
{result, self} | ||
end | ||
|
||
def register({id, genome}) do | ||
EXNN.Nodes.register(genome) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
defmodule EXNN.Trainer do | ||
use GenServer | ||
|
||
@train_interval 200 | ||
|
||
def start_link do | ||
GenServer.start_link(__MODULE__, | ||
:ok, | ||
name: __MODULE__) | ||
end | ||
|
||
def init(:ok) do | ||
stream = Stream.repeatedly(&train/0) | ||
{:ok, %{stream: stream}} | ||
end | ||
|
||
def train do | ||
EXNN.Config.sensors |> Enum.each(&train/1) | ||
# :timer.sleep @train_interval | ||
end | ||
|
||
def train(sensor_id) do | ||
GenServer.cast sensor_id, {:signal, {self, :sync}} | ||
end | ||
|
||
# public api | ||
def iterate(cycles) do | ||
GenServer.call __MODULE__, {:iterate, cycles} | ||
end | ||
|
||
# server callbacks | ||
def handle_call({:iterate, num}, _from, state) do | ||
report = Stream.take(state.stream, num) |> Stream.run() | ||
{:reply, report, state} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters