Ejemplo n.º 1
0
    def test_transitions_wtnetwork_pin(self):
        net = WTNetwork(
            weights=[[1, 0], [-1, 1]],
            thresholds=[0.5, 0.0],
            theta=WTNetwork.positive_threshold
        )

        net.landscape(pin=[1])
        self.assertEqual([0, 1, 2, 3], list(net.transitions))

        net.landscape(pin=[0])
        self.assertEqual([2, 1, 2, 3], list(net.transitions))

        net.landscape(pin=None)
        self.assertEqual([2, 1, 2, 3], list(net.transitions))
Ejemplo n.º 2
0
    def test_transitions_wtnetwork_values(self):
        net = WTNetwork(
            weights=[[1, 0], [-1, 1]],
            thresholds=[0.5, 0.0],
            theta=WTNetwork.positive_threshold
        )

        net.landscape(values={0: 1})
        self.assertEqual([3, 1, 3, 3], list(net.transitions))

        net.landscape(values={1: 0})
        self.assertEqual([0, 1, 0, 1], list(net.transitions))

        net.landscape(values={})
        self.assertEqual([2, 1, 2, 3], list(net.transitions))