I just changed one if statement to
if delivery_counter == delivery_interval;%add delivery charge
%deliver full trucks (could modify to fill warehouse)
TIRES_NEEDED = TMAX - NUM_TIRES;
num_trucks = floor(TIRES_NEEDED/TRUCK_CAPACITY);
delivery_quantity = num_trucks*TRUCK_CAPACITY;
delivery_charge = num_trucks*truck_charge;
NUM_TIRES = NUM_TIRES + delivery_quantity;
COST = COST + delivery_charge;
delivery_counter = 0;
if NUM_TIRES > TMAX%sh0uld never happen!
NUM_TIRES = TMAX
end
end
Problem 7.5 Solution still 16000 tires. See matlab code attached for modifications.