Created
August 16, 2014 02:52
-
-
Save anonymous/5b9b2c55a7684f5386e2 to your computer and use it in GitHub Desktop.
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
construct_Cortex(Agent_Id, Generation, SpecCon) -> | |
Cx_Id = {{origin, generate_UniqueId()}, cortex}, | |
Morphology = SpecCon#constraint.morphology, | |
Sensors = [S#sensor{id = {{-1, generate_UniqueId()}, sensor}, cx_id = Cx_Id} | |
|| S <- morphology:get_InitSensors(Morphology)], | |
Actuators = [A#actuator{id = {{-1, generate_UniqueId()}, actuator}, cx_id = Cx_Id} | |
|| A <- morphology:get_InitActuators(Morphology)], | |
N_Ids = construct_InitialNeuroLayer(Cx_Id, Generation, SpecCon, Sensors, | |
Actuators, [], []), | |
S_Ids = [S#sensor.id || S <- Sensors], | |
A_Ids = [A#sensor.id || A <- Actuators], | |
Cortex = #cortex{ | |
id = Cx_Id, | |
agent_id = Agent_Id, | |
neuron_ids = N_Ids, | |
sensor_ids = S_Ids, | |
actuator_ids = A_Ids}, | |
write(Cortex), | |
{Cx_Id, [{0, N_Ids}]}. | |
................................ | |
-module(morphology). | |
-compile(export_all). | |
-include("records.hrl"). | |
get_InitSensors(Morphology) -> | |
Sensors = morphology:Morphology(sensors), | |
[lists:nth(1, Sensors)]. | |
get_InitActuators(Morphology) -> | |
Actuators = morphology:Morphology(actuators), | |
[lists:nth(1, Actuators)]. | |
get_Sensors(Morphology) -> | |
morphology:Morphology(sensors). | |
get_Actuators(Morphology) -> | |
morphology:Morphology(actuators). | |
xor_mimic(sensors) -> | |
[#sensor{name = xor_GetInput, scape = {private, xor_sim}, vl = 2}]; | |
xor_mimic(actuators) -> | |
[#sensor{name = xor_SendOutput, scape = {private, xor_sim}, vl = 1}]. | |
generate_id() -> | |
{MegaSeconds, Seconds, MicroSeconds} = now(), | |
1 / (MegaSeconds * 1000000 + Seconds + MicroSeconds / 1000000). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment