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)
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
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 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)
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)))
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))
def test_optimal_order_quantity_with_missing_raw_scores_raises(): with pytest.raises(ValueError): EOQ.optimal_order_quantity(raw_costs=None, demand=get_demand())
def test_optimal_order_quantity_with_missing_demand_raises(): with pytest.raises(ValueError): EOQ.optimal_order_quantity(raw_costs=get_raw_costs(), demand=None)