testing cumulative cost matrix