예제 #1
0
    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]
예제 #2
0
파일: ga.py 프로젝트: ralphbean/ms-thesis
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)
예제 #3
0
 def test_ANN_lyapunov_7(self):
     self.assertTrue(simulator.measure_lyapunov(self.get_test_network(7)) < 0)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
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)