def part3():
    d = Demand(240, 'M')
    rc = RawCosts(50.0, 100.0, 0.01, holding_time_unit='M')
    Q = EOQ.optimal_order_quantity(rc, d)
    print(Q)

    T = EOQ.optimal_cycle_time(rc, d)
    print(T)

    print(T * 4)
Beispiel #2
0
def test_optimal_total_cost_calculates_correctly():
    raw_costs = get_raw_costs()
    demand = get_demand()

    trc = EOQ.optimal_relevant_cost(raw_costs, demand)
    expected = trc + raw_costs.unit_cost * demand.quantity

    actual = EOQ.optimal_total_cost(raw_costs=raw_costs, demand=demand)

    assert expected == actual
Beispiel #3
0
def test_optimal_order_quantity_with_zero_holding_cost_returns_demand():
    demand = get_demand()
    raw_costs = get_raw_costs(holding_rate=0.0)

    q_star = EOQ.optimal_order_quantity(raw_costs=raw_costs, demand=demand)

    assert q_star == demand.quantity
Beispiel #4
0
def qq_06():
    c_t = 525
    c_e = 1.25
    rc = RawCosts(unit_cost=1.00,
                  ordering_cost=c_t,
                  holding_cost=c_e,
                  holding_time_unit='M')
    d = Demand(quantity=120, time_unit='M')

    Q = EOQ.optimal_order_quantity(raw_costs=rc, demand=d)
    print("EOQ: {}".format(Q))

    B = 170
    L = 1

    mu_dl = 30
    sigma_dl = 9

    inner_value = (B * d.quantity) / (c_e * sigma_dl * Q * sqrt(2 * pi))
    print("inner value: {}".format(inner_value))

    k = sqrt(2 * log(inner_value))
    print("k: {}".format(k))

    s = mu_dl + k * sigma_dl
    print("s: {}".format(s))
def calc_eoq(row):
    cost = row['cost']
    demand = row['demand']

    rc = RawCosts(unit_cost=cost, ordering_cost=c_t, holding_rate=h)
    d = Demand(quantity=demand)
    return EOQ.optimal_order_quantity(rc, d)
Beispiel #6
0
def test_optimal_cycle_time_calculates_correctly():
    import math
    demand = get_demand()
    raw_costs = get_raw_costs()

    t_star = EOQ.optimal_cycle_time(raw_costs=raw_costs, demand=demand)

    assert t_star == math.sqrt((2 * raw_costs.ordering_cost) /
                               (demand.quantity * raw_costs.holding_cost))
Beispiel #7
0
def test_optimal_relevant_cost_calculates_correctly():
    import math
    raw_costs = get_raw_costs()
    demand = get_demand()

    expected = math.sqrt(2 * raw_costs.ordering_cost * raw_costs.holding_cost *
                         demand.quantity)
    actual = EOQ.optimal_relevant_cost(raw_costs=raw_costs, demand=demand)

    assert expected == actual
Beispiel #8
0
def test_optimal_order_quantity_calculates_correctly():
    import math
    demand = get_demand()
    raw_costs = get_raw_costs()

    q_star = EOQ.optimal_order_quantity(raw_costs=raw_costs, demand=demand)

    assert q_star == math.sqrt(2 *
                               (raw_costs.ordering_cost * demand.quantity) /
                               raw_costs.holding_cost)
def part01():
    sku = '3206-BO1'
    item = df.loc[sku]

    rc = RawCosts(unit_cost=item['cost'], ordering_cost=c_t, holding_rate=h)
    d = Demand(quantity=item['demand'])
    Q = EOQ.optimal_order_quantity(rc, d)

    print("Q: {}".format(Q))
    sigma = item['rmse']
    print("sigma: {}".format(sigma))
    print("sigma_dl: {}".format(sigma * math.sqrt(1 / 12)))
Beispiel #10
0
def part01():
    sigma_dl = calc_sigma_dl()
    g_k = (0.0211 + 0.0206) / 2  # from table

    d = Demand(quantity=D)
    rc = RawCosts(unit_cost=c, ordering_cost=c_t, holding_rate=h)
    Q = EOQ.optimal_order_quantity(rc, d)

    IFR = 1 - ((sigma_dl * g_k) / Q)
    print("IFR: {}".format(IFR))

    return Q
def part02():
    sku = '3206-BO1'
    item = df.loc[sku]

    cost = item['cost']
    demand = item['demand']

    rc = RawCosts(unit_cost=cost, ordering_cost=c_t, holding_rate=h)
    d = Demand(quantity=demand)
    Q = EOQ.optimal_order_quantity(rc, d)

    sigma = item['rmse']
    sigma_dl = sigma * math.sqrt(1 / 12)

    print("sigma_dl * ci: {}".format(sigma_dl * cost))
    print("D/Q: {}".format(demand / Q))
    print("(D/Q) * (sigma_dl * ci): {}".format((demand / Q) * sigma_dl * cost))
Beispiel #12
0
def test_optimal_total_cost_with_missing_raw_costs_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_total_cost(raw_costs=None, demand=get_demand())
Beispiel #13
0
def test_optimal_order_quantity_with_missing_demand_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_order_quantity(raw_costs=get_raw_costs(), demand=None)
Beispiel #14
0
def test_optimal_relevant_cost_with_missing_demand_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_relevant_cost(raw_costs=get_raw_costs(), demand=None)
Beispiel #15
0
def test_optimal_order_quantity_with_missing_raw_scores_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_order_quantity(raw_costs=None, demand=get_demand())
Beispiel #16
0
def test_optimal_cycle_time_with_missing_raw_scores_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_cycle_time(raw_costs=None, demand=get_demand())
Beispiel #17
0
def test_optimal_cycle_time_with_demand_zero_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_cycle_time(raw_costs=get_raw_costs(),
                               demand=get_demand(quantity=0))
Beispiel #18
0
def test_optimal_cycle_time_with_missing_demand_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_cycle_time(raw_costs=get_raw_costs(), demand=None)
Beispiel #19
0
def test_optimal_cycle_time_with_holding_cost_zero_raises():
    with pytest.raises(ValueError):
        EOQ.optimal_cycle_time(raw_costs=get_raw_costs(holding_rate=0.0),
                               demand=get_demand())