pyDEA.core.models package

Submodules

pyDEA.core.models.bound_generators module

This module contains functions that produce proper upper bounds for efficiency scores for different envelopment models. Usually efficiency score must be within interval [0, 1]. But if a super efficiency model is used, then the efficiency score might be greater than 1.

pyDEA.core.models.bound_generators.generate_lower_bound_for_efficiency_score()[source]

Returns lower bound of the inverse of efficiency score for usual envelopment model.

Note

This function only works with output-oriented envelopment models.

Returns:1, since inverse of efficiency score must be > 1 for usual output-oriented envelopment model.
Return type:double
pyDEA.core.models.bound_generators.generate_supper_efficiency_lower_bound()[source]

Returns lower bound of the inverse of efficiency score for a super efficiency envelopment model.

Note

This function only works with output-oriented envelopment models.

Returns:0, since efficiency score might be greater than 1 for super efficient output-oriented envelopment model.
Return type:double
pyDEA.core.models.bound_generators.generate_supper_efficiency_upper_bound()[source]

Returns upper bound for efficiency score for a super efficiency model.

Note

This function only works with input-oriented envelopment models.

Returns:None, since efficiency score might be greater than 1 for super efficiency input-oriented envelopment model.
pyDEA.core.models.bound_generators.generate_upper_bound_for_efficiency_score()[source]

Returns upper bound for efficiency score for usual envelopment model.

Note

This function only works with input-oriented envelopment models.

Returns:1, since efficiency score must be <= 1 for usual input-oriented envelopment model.
Return type:double

pyDEA.core.models.categorical_dmus module

This module contains class for performing DEA analysis with categorical DMUs and some helper functions.

class pyDEA.core.models.categorical_dmus.ModelWithCategoricalDMUs(model, category_name)[source]

Bases: pyDEA.core.models.model_base.ModelBase

This class implements DEA categorical analysis.

model

ModelBase

a concrete model that is used for categorical analysis.

category_name

str

name of the category with hierarchical order of DMUs.

Parameters:
  • model (ModelBase) – model that should be used for every hierarchical category.
  • category_name (str) – name of the category with hierarchical order of DMUs.
__getattr__(name)[source]

Redirects calls to all undefined methods or attributes to self.model.

name

str

attribute name.

run()[source]

Performs categorical analysis.

Warning

All categorical values must be integers.

DMUs with category 1 are considered first and compared only to each other. Then DMUs with category 1 and 2 are considered, and so on. Hence, category 1 is least favourable, category 2 is more favourable and so on.

Returns:solution of the problem.
Return type:Solution

Warning

All floating point values of categorical category will be truncated to integer values.

run_for_one_DMU(dmu_code, model_solution)[source]

Solves LP for a given DMU.

Parameters:
  • dmu_code (str) – DMU code.
  • model_solution (Solution) – model solution, it will be filled by this method.
pyDEA.core.models.categorical_dmus.get_dmus_with_fixed_hierarchical_category(coefficients, hierarchical_category, category_name, dmu_codes)[source]

Constructs a set of DMU codes that have the value of hierarchical category equal to the specified category value.

Parameters:
  • coefficients (dict of tuple of str, str to double) – dictionary that maps DMU codes and categories to values.
  • hierarchical_category (int) – specified value of hierarchical category.
  • category_name (str) – name of the category with hierarchical order of DMUs.
  • dmu_codes (set of str) – set of DMU codes.
Returns:

a set of DMU codes that have the value of hierarchical category equal to given input parameter hierarchical_category.

Return type:

set of str

pyDEA.core.models.envelopment_model module

This module contains concrete implementations of input- and output-oriented envelopment models as well as the model with non-discretionary variables.

class pyDEA.core.models.envelopment_model.EnvelopmentModelInputOriented(upper_bound_generator)[source]

Bases: pyDEA.core.models.input_output_model_bases.InputOrientedModel

This class defines methods specific to input-oriented envelopment model.

upper_bound_generator

function

function that generates an upper bound on efficiency scores for envelopment model, see refactored.bound_generators

Parameters:upper_bound_generator (function) – function that generates an upper bound on efficiency scores for envelopment model, see refactored.bound_generators.
get_input_variable_coefficient(obj_variable, input_category)[source]

Returns obj_variable, since in input-oriented model we multiply current input by efficiency spyDEA.core.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to input category of current DMU.
  • input_category (str) – input category for which current constraint is being created.
Returns:

input variable coefficient.

Return type:

pulp.LpVariable

get_lower_bound_for_objective_variable()[source]

Returns 0 which is the lower bound on efficiency score which is minimized in the case of input-oriented envelopment model.

Returns:zero.
Return type:double
get_objective_type()[source]

Returns pulp.LpMinimize - we minimize objective function in case of input-oriented envelopment model.

Returns:type of objective function.
Return type:pulp.LpMaximize
get_output_variable_coefficient(obj_variable, output_category)[source]

Returns 1, since in input-oriented model we do not multiply current output by anything.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to output category of the current DMU.
  • output_category (str) – output category for which current constraint is being created.
Returns:

output variable coefficient.

Return type:

double

get_upper_bound_for_objective_variable()[source]

Returns a proper upper bound on efficiency score which is minimized in the case of input-oriented envelopment model.

Returns:upper bound on efficiency spyDEA.core.
Return type:double
update_input_category_coefficient(current_input, constraint, obj_var, input_category)[source]

Updates coefficient of a given input category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – input category name.
update_output_category_coefficient(current_output, constraint, obj_var, output_category)[source]

Updates coefficient of a given output category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – output category name.
class pyDEA.core.models.envelopment_model.EnvelopmentModelInputOrientedWithNonDiscVars(non_disc_inputs, upper_bound_generator)[source]

Bases: pyDEA.core.models.envelopment_model.EnvelopmentModelInputOriented

This class redefines some methods of EnvelopmentModelInputOriented in order to take into account non-discretionary variables.

Note

This class does not have a reference to InputData object. Hence, it cannot check if supplied non-discretionary categories are valid input categories.

non_disc_inputs

list of str

list of non-discretionary input categories.

Parameters:
  • non_disc_inputs (list of str) – list of non-discretionary input categories.
  • upper_bound_generator (function) – function that generates an upper bound on efficiency scores for envelopment model, see refactored.bound_generators
get_input_variable_coefficient(obj_variable, input_category)[source]

Returns proper coefficient depending on the fact if variable is discretionary or not.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to input category of current DMU.
  • input_category (str) – input category for which current constraint is being created.
Returns:

input variable coefficient.

Return type:

double or pulp.LpVariable

update_input_category_coefficient(current_input, constraint, obj_var, input_category)[source]

Updates coefficient of a given input category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – input category name.
class pyDEA.core.models.envelopment_model.EnvelopmentModelOutputOriented(lower_bound_generator)[source]

Bases: pyDEA.core.models.input_output_model_bases.OutputOrientedModel

This class defines methods specific to output-oriented envelopment model.

lower_bound_generator

function

function that generates a lower bound on inverse of efficiency scores for envelopment model, see refactored.bound_generators

Parameters:lower_bound_generator (function) – function that generates a lower bound on inverse of efficiency scores for envelopment model, see refactored.bound_generators
get_input_variable_coefficient(obj_variable, input_category)[source]

Returns 1, since in output-oriented model we do not multiply current input by anything.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to input category of current DMU.
  • input_category (str) – input category for which current constraint is being created.
Returns:

input variable coefficient.

Return type:

double

get_lower_bound_for_objective_variable()[source]

Returns a proper lower bound on the variables corresponding to output-oriented envelopment model.

Returns:lower bound on variables.
Return type:double
get_objective_type()[source]

Returns pulp.LpMinimize - we maximize objective function in case of output-oriented envelopment model.

Returns:objective function type.
Return type:pulp.LpMaximize
get_output_variable_coefficient(obj_variable, output_category)[source]

Returns obj_variable, since in output-oriented model we multiply current output by inverse efficiency spyDEA.core.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to output category of current DMU.
  • output_category (str) – output category for which current constraint is being created.
Returns:

output variable coefficient.

Return type:

pulp.LpVariable

get_upper_bound_for_objective_variable()[source]

Returns None, since variables of output-oriented envelopment model are not bounded.

Returns:None.
Return type:double
update_input_category_coefficient(current_input, constraint, obj_var, input_category)[source]

Updates coefficient of a given input category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – input category name.
update_output_category_coefficient(current_output, constraint, obj_var, output_category)[source]

Updates coefficient of a given output category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – output category name.
class pyDEA.core.models.envelopment_model.EnvelopmentModelOutputOrientedWithNonDiscVars(non_disc_outputs, lower_bound_generator)[source]

Bases: pyDEA.core.models.envelopment_model.EnvelopmentModelOutputOriented

This class redefines some methods of EnvelopmentModelOutputOriented in order to take into account non-discretionary variables.

Note

This class does not have a reference to InputData object. Hence, it cannot check if supplied non-discretionary categories are valid output categories.

non_disc_outputs

list of str

list of non-discretionary output categories.

Parameters:
  • non_disc_outputs (list of str) – list of non-discretionary output categories.
  • lower_bound_generator (function) – objects that generates a lower bound on inverse of efficiency scores for envelopment model, see refactored.bound_generators.
get_output_variable_coefficient(obj_variable, output_category)[source]

Returns a proper coefficient depending on the fact if the variable is discretionary or not.

Parameters:
  • obj_variable (pulp.LpVariable) – pulp variable that corresponds to output category of current DMU.
  • input_category (str) – output category for which current constraint is being created.
Returns:

output variable coefficient.

Return type:

double or pulp.LpVariable

update_output_category_coefficient(current_output, constraint, obj_var, output_category)[source]

Updates coefficient of a given output category with a new value.

Parameters:
  • current_output (double) – new value for the coefficient.
  • constraint (pulp.LpConstraint) – constraint whose coefficient should be updated.
  • obj_var (pulp.LpVariable) – variable of the envelopment model that is optimised in the objective function.
  • output_category (str) – output category name.

pyDEA.core.models.envelopment_model_base module

This module contains a base class that implements envelopment model.

class pyDEA.core.models.envelopment_model_base.EnvelopmentModelBase(input_data, concrete_model, constraint_creator)[source]

Bases: pyDEA.core.models.model_base.ModelBase

This class is a base class for different envelopment models. It implements general structure of all envelopment models. Concrete variations of envelopment models are passed in the class constructor.

_concrete_model

concrete implementation of the envelopment model.

_constraint_creator

object that creates a proper constraint depending on presence of disposable variables.

_variables

dict of str to pulp.LpVariable

dictionary of pulp variables than maps variable names to pulp variables.

_constraints

dict of str to str

dictionary that maps name of the category to the name of the corresponding constraint.

_should_add_efficiency

bool

if set to False, previously stored efficiency score is used. This variable is changed in two phase model.

Parameters:
  • input_data (InputData) – object that stores all data of a DEA instance.
  • concrete_model – concrete implementation of the envelopment model.
  • constraint_creator – object that creates a proper constraint depending on presence of disposable variables.

pyDEA.core.models.envelopment_model_decorators module

This module contains classes that implement VRS envelopment model, envelopment model with disposable variables and with various kind of weight restrictions.

class pyDEA.core.models.envelopment_model_decorators.DefaultConstraintCreator[source]

Bases: object

This is a helper class that creates constraints for envelopment model with strongly disposable categories.

create(lhs, rhs, category)[source]

By default all categories are strongly disposable. Hence all constraints have the form lhs >= rhs.

Parameters:
  • lhs (pulp.LpAffineExpression) – left hand side of the constraint.
  • rhs (pulp.LpAffineExpression) – right hand side of the constraint.
  • category (str) – input or output category (it is not used by this class).
class pyDEA.core.models.envelopment_model_decorators.DisposableVarsConstraintCreator(weakly_disposable_categories)[source]

Bases: object

This is a helper class that creates constraints for envelopment model with weakly disposable categories.

weakly_disposable_categories

set of str

list of weakly disposable categories.

Parameters:weakly_disposable_categories (list of str) – list of weakly disposable categories.
create(lhs, rhs, category)[source]

If category is weakly disposable, returns constraint of the form lhs == rhs, otherwise: lhs >= rhs.

Parameters:
  • lhs (pulp.LpAffineExpression) – left hand side of the constraint.
  • rhs (pulp.LpAffineExpression) – right hand side of the constraint.
  • category (str) – input or output category.
class pyDEA.core.models.envelopment_model_decorators.EnvelopmentModelVRSDecorator(model_to_decorate)[source]

Bases: pyDEA.core.models.envelopment_model_base.EnvelopmentModelBase

This class is a concrete implementation of VRS envelopment model.

_model_to_decorate

EnvelopmentModelBase

envelopment model.

Parameters:model_to_decorate (EnvelopmentModelBase) – envelopment model that needs to be decorated with VRS constraint.
class pyDEA.core.models.envelopment_model_decorators.EnvelopmentModelWithAbsoluteWeightRestrictions(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.envelopment_model_base.EnvelopmentModelBase

This class implements envelopment model with absolute weight restrictions.

model

EnvelopmentModelBase

envelopment model.

bounds (dict of str to tuple of double,

double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.

new_vars_lb

dict of str to pulp.LpVariable

dictionary that maps category name to a pulp variable.

new_vars_ub

dict of str to pulp.LpVariable

dictionary that maps category name to a pulp variable.

Parameters:
  • model_to_decorate (EnvelopmentModelBase) – envelopment model.
  • (dict of str to tuple of double, (bounds) – double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.
class pyDEA.core.models.envelopment_model_decorators.EnvelopmentModelWithPriceRatioConstraints(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.envelopment_model_base.EnvelopmentModelBase

This class implements envelopment model with price ratio weight restrictions.

model

EnvelopmentModelBase

envelopment model.

bounds (dict of str to tuple of double,

double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.

Parameters:
  • model_to_decorate (EnvelopmentModelBase) – envelopment model.
  • (dict of str to tuple of double, (bounds) – double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.
class pyDEA.core.models.envelopment_model_decorators.EnvelopmentModelWithVirtualWeightRestrictions(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.envelopment_model_decorators.EnvelopmentModelWithAbsoluteWeightRestrictions

This class implements envelopment model with virtual weight restrictions.

pyDEA.core.models.input_output_model_bases module

This module contains classes that implement methods common for input- and output-oriented models.

class pyDEA.core.models.input_output_model_bases.InputOrientedModel[source]

Bases: object

This class implements methods that are the same for all input-oriented models.

get_orientation()[source]

Returns orientation of the model as a string.

Returns:a string ‘input’.
Return type:str
process_dual_value(dual_value)[source]

Post-process given value of a dual variable if necessary.

Parameters:dual_value (double) – value of the dual variable.
Returns:dual_value since in input-oriented model we do nothing with duals.
Return type:double
process_obj_var(obj_value)[source]

Post-process objective function value if necessary.

Parameters:obj_value (double) – value of the objective function.
Returns:value of obj_variable, since efficiency score is in the interval [0, 1] for input-oriented model.
Return type:double
class pyDEA.core.models.input_output_model_bases.OutputOrientedModel[source]

Bases: object

This class implements methods that are the same for all output-oriented models.

get_orientation()[source]

Returns orientation of the model as a string.

Returns:a string ‘output’.
Return type:str
process_dual_value(dual_value)[source]

Post-process given value of a dual variable if necessary.

Parameters:dual_value (double) – value of the dual variable.
Returns:-dual_value if it is non-zero since in output-oriented models.
Return type:double
process_obj_var(obj_value)[source]

Post-process objective function value if necessary.

Parameters:obj_value (double) – value of the objective function.
Returns:1/obj_variable, since in the case of output-oriented models the value of objective function corresponds to inverse of efficiency spyDEA.core.
Return type:double

pyDEA.core.models.maximize_slacks module

This module contains the class responsible for implementing a two-phase model.

class pyDEA.core.models.maximize_slacks.MaximizeSlacksModel(model, weakly_disposable_categories=None)[source]

Bases: pyDEA.core.models.envelopment_model_base.EnvelopmentModelBase

Implements a two-phase model.

strongly_disposal_input_categories

set of str

set of strongly disposal input categories.

strongly_disposal_output_categories

set of str

set of strongly disposal output categories.

model

EnvelopmentModelBase

envelopment model used in two-phase model.

second_solution

Solution

solution obtained after second phase.

lp_model_max_slack

pulp.LpProblem

pulp LP.

Parameters:
  • model (EnvelopmentModelBase) – envelopment model.
  • weakly_disposable_categories (set of str, optional) – set of weakly disposal categories. Defaults to None.
fill_efficiency(model_solution)[source]

Copies efficiency scores from the solution obtained from the first phase to the solution of the second phase.

Parameters:model_solution (Solution) – solution obtained from the first phase.
run_for_one_DMU(dmu_code, model_solution)[source]

See base class.

pyDEA.core.models.model_base module

This module contains an abstract base class for all models.

class pyDEA.core.models.model_base.ModelBase(input_data, update_str=<function do_nothing at 0x00000201D5DD8AE8>)[source]

Bases: object

Abstract base class for some of the DEA models.

input_data

InputData

object that stores all input data.

update_dmu_str_var

func

function that updates solution progress.

lp_model

pulp.LpProblem

pulp LP.

Parameters:
  • input_data (InputData) – object that stores all input data.
  • update_str (func, optional) – function that updates solution progress. Defaults to a function that does nothing.
run()[source]

Solves a given problem.

run_for_one_DMU(dmu_code, model_solution)[source]

Solves LP for a given DMU and stores solution.

Parameters:
  • dmu_code (str) – DMU code.
  • model_solution (Solution) – solution.
pyDEA.core.models.model_base.do_nothing()[source]

Helper function. Does nothing.

pyDEA.core.models.model_progress_bar_decorator module

This module contains ProgressBarDecorator class responsible for updating progress bar during solving a DEA model.

class pyDEA.core.models.model_progress_bar_decorator.ProgressBarDecorator(model, current_dmu)[source]

Bases: pyDEA.core.models.model_base.ModelBase

This class is responsible to trigger update of the progress bar while a given DEA model is being solved.

model

ModelBase

given DEA model.

update_dmu_str_var[source]

func

function that triggers update of the progress bar.

current_dmu

StringVar

StringVar object that triggers progress bar update.

Parameters:
  • model (ModelBase) – given DEA model.
  • current_dmu (StringVar) – StringVar object that triggers progress bar update.
run()[source]

See base class.

run_for_one_DMU(dmu_code, model_solution)[source]

See base class.

update_dmu_str_var()[source]

Calls set method of StringVar object that triggers progress bar update.

pyDEA.core.models.multiplier_model module

This module contains classes that implement input- and output-oriented multiplier models.

class pyDEA.core.models.multiplier_model.MultiplierInputOrientedModel[source]

Bases: pyDEA.core.models.input_output_model_bases.InputOrientedModel

Implements input-oriented multiplier model.

get_equality_constraint(input_data, dmu_code, input_variables, output_variables)[source]

Generates equality constraint of input-oriented multiplier model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
Returns:

equality constraint.

Return type:

pulp.LpConstraint

get_objective_function(input_data, dmu_code, input_variables, output_variables)[source]

Generates objective function of input-oriented multiplier model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
Returns:

objective function.

Return type:

pulp.LpSum

get_objective_type()[source]

Returns pulp.LpMaximize - we maximize objective function in case of input-oriented multiplier model.

Returns:pulp.LpMaximize.
update_equality_constraint(input_data, dmu_code, input_variables, output_variables, lp_model)[source]

Updates coefficients of the equality constraint of a given model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
  • lp_model (pulp.LpProblem) – linear programming model.
update_objective(input_data, dmu_code, input_variables, output_variables, lp_model)[source]

Updates coefficients of the objective function of a given model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
  • lp_model (pulp.LpProblem) – linear programming model.
class pyDEA.core.models.multiplier_model.MultiplierOutputOrientedModel[source]

Bases: pyDEA.core.models.input_output_model_bases.OutputOrientedModel

Implements output-oriented multiplier model.

get_equality_constraint(input_data, dmu_code, input_variables, output_variables)[source]

Generates equality constraint of output-oriented multiplier model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
Returns:

equality constraint.

Return type:

pulp.LpConstraint

get_objective_function(input_data, dmu_code, input_variables, output_variables)[source]

Generates objective function of output-oriented multiplier model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
Returns:

objective function.

Return type:

pulp.LpSum

get_objective_type()[source]

Returns pulp.LpMinimize - we minimize objective function in case of output-oriented multiplier model.

Returns:pulp.LpMinimize.
update_equality_constraint(input_data, dmu_code, input_variables, output_variables, lp_model)[source]

Updates coefficients of the equality constraint of a given model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
  • lp_model (pulp.LpProblem) – linear programming model.
update_objective(input_data, dmu_code, input_variables, output_variables, lp_model)[source]

Updates coefficients of the objective function of a given model.

Parameters:
  • input_data (InputData) – object that stores input data.
  • dmu_code (str) – DMU code.
  • input_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to input categories.
  • output_variables (dict of str to pulp.LpVariable) – dictionary that maps variable name to pulp variable corresponding to output categories.
  • lp_model (pulp.LpProblem) – linear programming model.

pyDEA.core.models.multiplier_model_base module

This module contains MultiplierModelBase class that implements basic functionality of the multiplier model.

class pyDEA.core.models.multiplier_model_base.MultiplierModelBase(input_data, tolerance, concrete_model)[source]

Bases: pyDEA.core.models.model_base.ModelBase

This class is a base class for different multiplier models. It implements general structure of all multiplier models. Concrete variations of multiplier models are passed in the class constructor.

tolerance

double

lower bound of the variables of multilier model.

_concrete_model

concrete implementation of the multiplier model.

_input_variables

dict of str to pulp.LpVariable

dictionary of pulp variables than maps variable names to pulp variables corresponding to input categories.

_output_variables

dict of str to pulp.LpVariable

dictionary of pulp variables than maps variable names to pulp variables corresponding to output categories.

_dmu_constraint_names

dict of str to str

dictionary that maps constraint names to DMU code.

Parameters:
  • input_data (InputData) – object that stores all data of a DEA instance.
  • tolerance (double) – lower bound of the variables of multilier model.
  • concrete_model – concrete implementation of the multiplier model.

pyDEA.core.models.multiplier_model_decorators module

This module contains classes that implement VRS multiplier model, multiplier model with disposable variables and with various kind of weight restrictions.

class pyDEA.core.models.multiplier_model_decorators.MultiplierModelInputOrientedWithNonDiscVars(model_to_decorate, categories)[source]

Bases: pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithNonDiscVarsForDecoration

Implements input-oriented multiplier model with non-discretionary variables.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • categories (set of str) – set of non-discretionary categories.
Raises:

ValueError – if categories contain more values that total number of input categories.

class pyDEA.core.models.multiplier_model_decorators.MultiplierModelOutputOrientedWithNonDiscVars(model_to_decorate, categories)[source]

Bases: pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithNonDiscVarsForDecoration

Implements output-oriented multiplier model with non-discretionary variables.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • categories (set of str) – set of non-discretionary categories.
Raises:

ValueError – if categories contain more values that total number of output categories.

class pyDEA.core.models.multiplier_model_decorators.MultiplierModelVRSDecorator(model_to_decorate)[source]

Bases: pyDEA.core.models.multiplier_model_base.MultiplierModelBase

This class is a concrete implementation of VRS multiplier model.

_model_to_decorate

MultiplierModelBase

multiplier model.

_vrs_variable

pulp.LpVariable

VRS variable.

multiplier

int

1 for input-oriented model, -1 for output- oriented model.

Parameters:model_to_decorate (MultiplierModelBase) – multiplier model that needs to be decorated with VRS constraint.
class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithAbsoluteWeightRestrictions(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithWeigthRestrictionsBase

Implements multiplier model with absolute weight restrictions.

class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithDisposableCategories(model_to_decorate, weakly_disposable_categories)[source]

Bases: pyDEA.core.models.multiplier_model_base.MultiplierModelBase

Implements multiplier model with disposable categories.

_model_to_decorate

MultiplierModelBase

multiplier model.

weakly_disposable_categories

set of str

set of weakly disposable categories.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • weakly_disposable_categories (set of str) – set of weakly disposable categories.
class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithNonDiscVarsForDecoration(model_to_decorate, categories)[source]

Bases: pyDEA.core.models.multiplier_model_base.MultiplierModelBase

Abstract base class that implements multiplier model with non-discretionary variables.

_model_to_decorate

MultiplierModelBase

multiplier model.

categories

set of str

set of non-discretionary categories.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • categories (set of str) – set of non-discretionary categories.
class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithPriceRatioConstraints(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.multiplier_model_base.MultiplierModelBase

Implements multiplier model with price ratio restrictions.

_model_to_decorate

MultiplierModelBase

multiplier model.

bounds (dict of str to tuple of double,

double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • (dict of str to tuple of double, (bounds) – double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.
class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithVirtualWeightRestrictions(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithWeigthRestrictionsBase

Implements multiplier model with virtual weight restrictions.

lb_weight_rest_variables (dict of str to tuple of pulp.LpVariable,

str): dictionary that maps category name to a tuple of pulp variable and constraint name.

ub_weight_rest_variables (dict of str to tuple of pulp.LpVariable,

str): dictionary that maps category name to a tuple of pulp variable and constraint name.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • (dict of str to tuple of double, (bounds) – double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.
class pyDEA.core.models.multiplier_model_decorators.MultiplierModelWithWeigthRestrictionsBase(model_to_decorate, bounds)[source]

Bases: pyDEA.core.models.multiplier_model_base.MultiplierModelBase

Abstract base class that implements basic operations of multiplier model with weight restrictions.

_model_to_decorate

MultiplierModelBase

multiplier model.

bounds (dict of str to tuple of double,

double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.

Parameters:
  • model_to_decorate (MultiplierModelBase) – multiplier model.
  • (dict of str to tuple of double, (bounds) – double or dict of tuple of str, str to tuple of double, double: dictionary with parsed values of constraints): dictionary with parsed values of constraints.

pyDEA.core.models.peel_the_onion module

This module contains peel the onion model.

pyDEA.core.models.peel_the_onion.peel_the_onion_method(model)[source]

Runs the peel the onion model and returns solution that corresponds to the first run and ranking of all DMUs.

Parameters:model (ModelBase) – DEA model that must be called in the peel the onion.
Returns:tuple with the first solution of the problem, dictionary that maps DMU code to peel the onion rank, boolean value which is true if all peel the onion runs were successful, false otherwise.
Return type:tuple of Solution, dict of str to int, bool
pyDEA.core.models.peel_the_onion.restore_base(model, first_solution, copy_of_dmu_codes, max_slack_solution)[source]

Helper function used for restoring DMU codes and first solution.

Parameters:
  • model (ModelBase) – model used in the peel the onion.
  • first_solution (Solution) – first solution of the peel the onion.
  • copy_of_dmu_codes (list of str) – list of original DMU codes.
  • max_slack_solution (Solution) – solution obtained by two phase model if any.

pyDEA.core.models.super_efficiency_model module

This module contains SupperEfficiencyModel class that implements super efficiency model.

class pyDEA.core.models.super_efficiency_model.SupperEfficiencyModel(model)[source]

Bases: pyDEA.core.models.model_base.ModelBase

This class implements super efficiency model.

model

ModelBase

model that should be decorated with super efficiency model.

Parameters:model (ModelBase) – model that should be decorated with super efficiency model.
run_for_one_DMU(dmu_code, model_solution)[source]

Solves LP for a given DMU and stores solution.

Parameters:
  • dmu_code (str) – DMU code.
  • model_solution (Solution) – solution.

Module contents