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))
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_cycle_time_with_demand_zero_raises(): with pytest.raises(ValueError): EOQ.optimal_cycle_time(raw_costs=get_raw_costs(), demand=get_demand(quantity=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)
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())
def test_optimal_cycle_time_with_missing_raw_scores_raises(): with pytest.raises(ValueError): EOQ.optimal_cycle_time(raw_costs=None, demand=get_demand())