def test_VRS_multi_input_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [1, 1, 1, 1, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'A', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'C', 1, model_solution, data) utils_for_tests.check_lambda_variables('D', 'D', 1, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.5, 0, 0], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.25, 0.125, 0], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.055555556, 0.11111111, 0.44444444], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.25, 0.125, 0], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0, 0.5, 0], model_solution, data) utils_for_tests.check_VRS_duals( dmus, [1, 1, -0.33333333, 1, 1], model_solution, data)
def test_VRS_multi_output_oriented_with_weakly_disposable_vars_small(data): model = MultiplierModelVRSDecorator(MultiplierModelWithDisposableCategories( MultiplierModelBase(data, 1e-12, MultiplierOutputOrientedModel()), set(['q']))) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 1, 1, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'C', 1, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_lambda_variables('D', 'D', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.25, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.125, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.083333333, 0, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.33333333, 0.66666667, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0, 0.125, 0.5], model_solution, data) utils_for_tests.check_VRS_duals( dmus, [1.5, 0.75, 0.5, -1.3333333, 0.75], model_solution, data)
def test_VRS_multi_input_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores(dmus, [1, 1, 1, 1, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'A', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'C', 1, model_solution, data) utils_for_tests.check_lambda_variables('D', 'D', 1, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [0.5, 0, 0], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.25, 0.125, 0], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.055555556, 0.11111111, 0.44444444], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [0.25, 0.125, 0], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0, 0.5, 0], model_solution, data) utils_for_tests.check_VRS_duals(dmus, [1, 1, -0.33333333, 1, 1], model_solution, data)
def test_VRS_env_output_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 1, 1, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'C', 1, model_solution, data) utils_for_tests.check_lambda_variables('D', 'D', 1, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.25, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0, 0, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.33333333, 0.66666667, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0, 0.125, 0.5], model_solution, data) # B does not return the same value utils_for_tests.check_VRS_duals( ['A', 'C', 'D', 'E'], [1.5, 1, -1.3333333, 0.75], model_solution, data)
def test_CRS_env_input_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.83333333, 0.71428571, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables( 'D', 'B', 0.21428571, model_solution, data) utils_for_tests.check_lambda_variables( 'D', 'E', 0.28571429, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.055555556, 0.11111111, 0.27777778], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [ 0.14285714, 0.28571429, 0.71428571], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_multi_output_oriented_with_weakly_disposable_vars_small(data): model = MultiplierModelWithDisposableCategories( MultiplierModelBase(data, 1e-12, MultiplierOutputOrientedModel()), set(['x1'])) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.8333333458, 0.7142857143, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1.2, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.6, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.3, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.4, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [1, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.066666667, 0.13333333, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.2, 0.4, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_multi_output_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 1 / 1.199999982, 1 / 1.4, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1.2, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.6, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.3, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.4, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [1, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.066666667, 0.13333333, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.2, 0.4, 1], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_env_output_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores(dmus, [0.5, 1, 1 / 1.2, 1 / 1.4, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1.2, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.6, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.3, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.4, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [1, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.066666667, 0.13333333, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [0.2, 0.4, 1], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_multi_input_oriented_with_non_discretionary_vars(data): model = MultiplierModelInputOrientedWithNonDiscVars( MultiplierModelBase(data, 1e-12, MultiplierInputOrientedModel()), set(['x1'])) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.3, 1, 0.750000012, 0.5, 1], model_solution, data) utils_for_tests.check_lambda_variables( 'A', 'B', 0.25, model_solution, data) utils_for_tests.check_lambda_variables( 'A', 'E', 0.25, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables( 'C', 'B', 0.75, model_solution, data) utils_for_tests.check_lambda_variables( 'C', 'E', 0.75, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.125, 0.25, 0.625], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.083333333, 0.16666667, 0.41666667], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0, 0.5, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0, 0.5, 0.5], model_solution, data)
def test_CRS_multi_input_oriented_with_weakly_disposable_vars_small(data): model = MultiplierModelWithDisposableCategories( MultiplierModelBase(data, 1e-12, MultiplierInputOrientedModel()), ['x1', 'q']) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.83333334, 0.71428571, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables( 'D', 'B', 0.21428571, model_solution, data) utils_for_tests.check_lambda_variables( 'D', 'E', 0.28571429, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu( 'A', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'B', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('C', ['x1', 'x2', 'q'], [ 0.055555556, 0.11111111, 0.27777778], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [ 0.14285714, 0.28571429, 0.71428571], model_solution, data) utils_for_tests.check_categories_for_dmu( 'E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_multi_output_oriented_with_weakly_disposable_vars_small(data): model = MultiplierModelWithDisposableCategories( MultiplierModelBase(data, 1e-12, MultiplierOutputOrientedModel()), set(['x1'])) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.8333333458, 0.7142857143, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1.2, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.6, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.3, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.4, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [1, 0, 1], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.066666667, 0.13333333, 0.33333333], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [0.2, 0.4, 1], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_env_input_oriented_small(model, data): model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.83333333, 0.71428571, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.21428571, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.28571429, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.055555556, 0.11111111, 0.27777778], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.14285714, 0.28571429, 0.71428571], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)
def test_CRS_multi_input_oriented_with_non_discretionary_vars(data): model = MultiplierModelInputOrientedWithNonDiscVars( MultiplierModelBase(data, 1e-12, MultiplierInputOrientedModel()), set(['x1'])) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores(dmus, [0.3, 1, 0.750000012, 0.5, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 0.25, model_solution, data) utils_for_tests.check_lambda_variables('A', 'E', 0.25, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 0.75, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.75, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.125, 0.25, 0.625], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.083333333, 0.16666667, 0.41666667], model_solution, data) utils_for_tests.check_categories_for_dmu('D', ['x1', 'x2', 'q'], [0, 0.5, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0, 0.5, 0.5], model_solution, data)
def test_CRS_multi_input_oriented_with_weakly_disposable_vars_small(data): model = MultiplierModelWithDisposableCategories( MultiplierModelBase(data, 1e-12, MultiplierInputOrientedModel()), ['x1', 'q']) model_solution = model.run() utils_for_tests.check_optimal_solution_status_and_sizes( model_solution, data) dmus = ['A', 'B', 'C', 'D', 'E'] utils_for_tests.check_efficiency_scores( dmus, [0.5, 1, 0.83333334, 0.71428571, 1], model_solution, data) utils_for_tests.check_lambda_variables('A', 'B', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('B', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'B', 1, model_solution, data) utils_for_tests.check_lambda_variables('C', 'E', 0.5, model_solution, data) utils_for_tests.check_lambda_variables('D', 'B', 0.21428571, model_solution, data) utils_for_tests.check_lambda_variables('D', 'E', 0.28571429, model_solution, data) utils_for_tests.check_lambda_variables('E', 'E', 1, model_solution, data) utils_for_tests.check_categories_for_dmu('A', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu('B', ['x1', 'x2', 'q'], [0.5, 0, 0.5], model_solution, data) utils_for_tests.check_categories_for_dmu( 'C', ['x1', 'x2', 'q'], [0.055555556, 0.11111111, 0.27777778], model_solution, data) utils_for_tests.check_categories_for_dmu( 'D', ['x1', 'x2', 'q'], [0.14285714, 0.28571429, 0.71428571], model_solution, data) utils_for_tests.check_categories_for_dmu('E', ['x1', 'x2', 'q'], [0.1, 0.2, 0.5], model_solution, data)