-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment.py
30 lines (24 loc) · 1.08 KB
/
environment.py
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
import random
import numpy as np
class SimulatedEnvironment:
def __init__(self, network):
self.network = network
self.agent_position = 0 # Example state variable
def update_position(self, movement):
self.agent_position += movement
def generate_sensory_input(self):
# Generate sensory input based on the current state
sensory_input = {}
for neuron in self.network.sensory_neurons:
# Sensory input generation logic goes here
# For demonstration, using random inputs as before
choice = random.choice(['uniform', 'normal', 'sin_wave', 'cos_wave'])
if choice == 'uniform':
sensory_input[neuron] = random.uniform(-1.0, 1.0)
elif choice == 'normal':
sensory_input[neuron] = np.random.normal(0, 0.5)
elif choice == 'sin_wave':
sensory_input[neuron] = np.sin(random.uniform(0, np.pi))
elif choice == 'cos_wave':
sensory_input[neuron] = np.cos(random.uniform(0, np.pi))
return sensory_input