예제 #1
0
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)
예제 #2
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
예제 #3
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))
예제 #4
0
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)
예제 #5
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)
예제 #6
0
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)))
예제 #7
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
예제 #8
0
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))
예제 #9
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())
예제 #10
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)