def test_esmrmb_mr_stepwise_cap_sum(self): bl = pyrm.booking_limits(self.fares, self.demands, cap=self.cap, sigmas=self.sigmas, method='EMSRb_MR_step') np.testing.assert_equal(bl.sum(), self.cap)
def test_esmrmb_mr_stepwise(self): bl = pyrm.booking_limits(self.fares, self.demands, cap=40, sigmas=self.sigmas, method='EMSRb_MR_step') np.testing.assert_equal(bl, np.array([39., 1., 0., 0., 0., 0.]))
def test_booking_limits_esmrmb_mr(self): bl = pyrm.booking_limits(self.fares, self.demands, cap=self.cap, sigmas=self.sigmas, method='EMSRb_MR') np.testing.assert_equal(np.array([35., 17., 32., 16., 0., 0.]), bl)
def test_booking_limits_esmrmb(self): bl = pyrm.booking_limits(self.fares, self.demands, cap=self.cap, sigmas=self.sigmas, method='EMSRb') self.assertEqual([20., 15., 19., 26., 20., 0.], bl.tolist())
def test_esmrmb_mr_stepwise_nan_demand(self): demands = np.full(self.demands.shape, np.nan) bl = pyrm.booking_limits(self.fares, demands, self.cap, sigmas=self.sigmas, method='EMSRb_MR_step') np.testing.assert_equal(bl, np.array([self.cap, 0., 0., 0., 0., 0.]))
def test_booking_limits_esmrmb_zero_demand(self): demands = np.zeros(self.demands.shape) bl = pyrm.booking_limits(self.fares, demands, cap=self.cap, sigmas=self.sigmas, method='EMSRb') self.assertEqual([self.cap, 0., 0., 0., 0., 0.], bl.tolist())