def test_fuzzy_div():
    vol  = np.r_[.5, .75, 1, 1.25, 1.5]
    V    = np.r_[0, .5, 1, .5, 0]
    pa   = np.r_[.5, 1.75, 2, 2.25, 2.5]
    P    = V.copy()

    test_u, test_mf = fuzzy_div(pa, P, vol, V)
    expected_u = np.r_[2., 2.4, 3., 4., 6., 7., 8., 8.4, 9., 9.6, 10., 10.5,
                       10.8, 12., 13.5, 14., 15., 16., 18., 20., 21., 24.,
                       27., 30.] / 6.
    expected_mf = np.r_[0., 0., 0., 0., 0., 0., 0., 0.5, 0., 0.5, 0., 0.5,
                        0.5, 1., 0.5, 0.5, 0., 0.5, 0.5, 0., 0., 0., 0., 0.]
    assert_allclose(test_u, expected_u)
    assert_allclose(test_mf, expected_mf)
Exemple #2
0
def test_fuzzy_div():
    vol = np.r_[.5, .75, 1, 1.25, 1.5]
    V = np.r_[0, .5, 1, .5, 0]
    pa = np.r_[.5, 1.75, 2, 2.25, 2.5]
    P = V.copy()

    test_u, test_mf = fuzzy_div(pa, P, vol, V)
    expected_u = np.r_[2., 2.4, 3., 4., 6., 7., 8., 8.4, 9., 9.6, 10., 10.5,
                       10.8, 12., 13.5, 14., 15., 16., 18., 20., 21., 24., 27.,
                       30.] / 6.
    expected_mf = np.r_[0., 0., 0., 0., 0., 0., 0., 0.5, 0., 0.5, 0., 0.5, 0.5,
                        1., 0.5, 0.5, 0., 0.5, 0.5, 0., 0., 0., 0., 0.]
    assert_allclose(test_u, expected_u)
    assert_allclose(test_mf, expected_mf)