def testInstantiate(self):
        # TODO -- come up with a real test here (or series of tests.
        n = 2**2
        A = [[randint(-1,2) for j in range(n+1)] for i in range(n)]
        input = inputs.build_random_input()

        networks = constraints.instantiate(A, input)
        lyaps = [simulator.measure_lyapunov(network) for network in networks]
Example #2
0
def fitness(o, num_instances=constants.num_instances):
    if "fitness" in o:
        return o["fitness"]
    net = network.instantiate(o["weights"], o["input"])
    return simulator.measure_lyapunov(net)
 def test_ANN_lyapunov_7(self):
     self.assertTrue(simulator.measure_lyapunov(self.get_test_network(7)) < 0)
 def test_logistic_lyapunov_4(self):
     simulator.logistic_example_system["consts"][0] = 4
     lyap = simulator.measure_lyapunov(simulator.logistic_example_system)
     self.assertTrue(lyap > 0)
 def test_logistic_lyapunov_3_828427125(self):
     simulator.logistic_example_system["consts"][0] = 3.828427125
     lyap = simulator.measure_lyapunov(simulator.logistic_example_system)
     self.assertTrue(lyap < 0)
 def test_logistic_lyapunov_3_56994571869(self):
     simulator.logistic_example_system["consts"][0] = 3.56994571869
     lyap = simulator.measure_lyapunov(simulator.logistic_example_system)
     self.assertTrue(lyap > 0)
 def test_logistic_lyapunov_3_236(self):
     simulator.logistic_example_system["consts"][0] = 3.236067977
     lyap = simulator.measure_lyapunov(simulator.logistic_example_system)
     self.assertTrue(lyap < 0)