def test_workforce(self): orga = Organization() orga.add_layer(1, size=2, efficiency_weight=1.0) orga.add_layer(2, size=3, efficiency_weight=1.0) orga.add_layer(3, size=5, efficiency_weight=1.0) self.assertEquals(10, orga.workforce())
def test_global_efficiency(self): orga = Organization() orga.add_layer(1, size=2, efficiency_weight=1.0) orga.add_layer(2, size=3, efficiency_weight=0.6) orga.add_layer(3, size=5, efficiency_weight=0.2) orga.layers[1].employees = [emp(25, 8.0), emp(25, 9.0)] orga.layers[2].employees = [emp(25, 7.0), emp(25, 2.0), emp(25, 7.0)] orga.layers[3].employees = [emp(25, 6.0), emp(25, 5.5), emp(25, 10.0), None, emp(25, 7.0)] self.assertEquals(100 * ((8.0 + 9.0) * 1.0 + (7.0 + 2.0 + 7.0) * 0.6 + (6.0 + 5.5 + 10.0 + 7.0) * 0.2) / (orga.workforce() * orga.maximum_efficiency()), orga.global_efficiency())