pyDEA.core.utils package

Submodules

pyDEA.core.utils.dea_utils module

This module contains various utility functions and constants.

pyDEA.core.utils.dea_utils.FILE_TYPES

list of tuple of str, str

list of supported input file parameters.

pyDEA.core.utils.dea_utils.SOLUTION_XLSX_FILE

list of tuple of str, str

list of supported solution file formats (xlsx).

pyDEA.core.utils.dea_utils.SOLUTION_XLS_FILE

list of tuple of str, str

list of supported solution file formats (xls).

Note

This list does not contain csv format since for solution files we create a folder with all csv files inside.

pyDEA.core.utils.dea_utils.TEXT_FOR_PANEL

str

text displayed in the label on the data tab before path to input data file.

pyDEA.core.utils.dea_utils.TEXT_FOR_FILE_LBL

str

text displayed in the label on the solution tab before path to input data file.

pyDEA.core.utils.dea_utils.ZERO_TOLERANCE

double

is used to check if a value is non-zero. All values greater than ZERO_TOLERANCE are considered to be strictly positive.

pyDEA.core.utils.dea_utils.VALID_COEFF

int

constant used to indicate valid data entry.

pyDEA.core.utils.dea_utils.WARNING_COEFF

int

constant used to indicate valid data entry that is zero.

pyDEA.core.utils.dea_utils.NOT_VALID_COEFF

int

constant used to indicate invalid data entry.

pyDEA.core.utils.dea_utils.EMPTY_COEFF

int

constant used to indicate empty data entry.

pyDEA.core.utils.dea_utils.CELL_DESTROY

int

constant used to indicate that cell of a table was destroyed.

pyDEA.core.utils.dea_utils.CHANGE_CATEGORY_NAME

int

constant used to indicate that name of the category was changed.

pyDEA.core.utils.dea_utils.INPUT_OBSERVER

int

constant used to indicate the observer for input categories.

pyDEA.core.utils.dea_utils.OUTPUT_OBSERVER

int

constant used to indicate the observer for output categories.

pyDEA.core.utils.dea_utils.XPAD_VALUE

int

horizontal padding.

pyDEA.core.utils.dea_utils.YPAD_VALUE

int

vertical padding.

pyDEA.core.utils.dea_utils.bg_color

hex

background colour for all widgets.

pyDEA.core.utils.dea_utils.TMP_FOLDER

str

name of the folder where all pickled files will be stored and then removed.

class pyDEA.core.utils.dea_utils.ObserverStringVar(*args, **kw)[source]

Bases: tkinter.StringVar

This class extends StringVar and adds two data structures to it for storing input and output categories.

output_categories

list of str

list with output categories

input_categories

list of str

list with input categories

pyDEA.core.utils.dea_utils.auto_name_if_needed(params, output_format, new_output_dir='')[source]

Creates an automatic name for solution file based on current parameter values, if OUTPUT_FILE is empty or set to auto.

Parameters:
  • params (Parameters) – parameters
  • output_format (str) – output format of solution file that should be used. Allowed values: xls, xlsx, csv
  • new_output_dir (str, optional) – directory where solution must be stored. It should be specified if it is different from current folder. Defaults to empty string.
Returns:

automatic name if OUTPUT_FILE is empty or set to auto in parameters.

Return type:

str

Raises:

ValueError – if output_format is not ‘xls’, ‘xlsx’ or ‘csv’.

pyDEA.core.utils.dea_utils.calculate_nb_pages(nb_data_rows, nb_table_rows)[source]

Calculates number of pages given number of data rows and number of rows in the table.

Note

first row is reserved for categories.

Parameters:
  • nb_data_rows (int) –

    number of data rows.

    Warning

    It must be a positive number. Otherwise the function will return incorrect value.

  • nb_table_rows (int) –

    number of rows in the table.

    Warning

    It must be a positive number. Otherwise the function will return incorrect value.

Returns:

number of pages

Return type:

int

Example

>>> calculate_nb_pages(100, 10)
>>> 12
>>> calculate_nb_pages(25, 20)
>>> 2
>>> calculate_nb_pages(0, 20)
>>> 1
>>> calculate_nb_pages(10, 25):
>>> 1
pyDEA.core.utils.dea_utils.calculate_start_row_index(curr_page, nb_table_rows)[source]

Calculates row index of data that will be displayed given current page and number of rows in the table.

Note

The first row of the table is reserved for displaying categories.

Parameters:
  • curr_page (int) – current page number. Pages start from 1.
  • nb_table_rows (int) – number of rows in the table.
Returns:

data row index

Return type:

int

pyDEA.core.utils.dea_utils.center_window(widget, width=None, height=None)[source]

Centres widget in the middle of the screen.

Parameters:
  • widget (Tk object) – widget that needs to be centred.
  • width (int, optional) – width of the widget that should be used. If not specified, widget width is used.
  • height (int, optional) – height of the widget that should be used. If not specified, widget width is used.
pyDEA.core.utils.dea_utils.change_to_unique_name_if_needed(file_name)[source]

Given a file name, this function checks if there is a file with such a name, and generates a new unique name if the file exists.

Parameters:file_name (str) – file name
Returns:if given file does not exist, this file name is returned. If given file exists, the unique incremented file name is returned.
Return type:str
pyDEA.core.utils.dea_utils.check_categories(categories_to_ckeck, categories, message='')[source]

Raises ValueError if at least one of the given categories is not present in categories list.

Parameters:
  • categories_to_ckeck (list of str) – list of categories that must be checked.
  • categories (list of str) – list of current categories.
  • message (str, optional) – message that must be shown if ValueError is raised.
Raises:

ValueError – if at least one of the categories is not present in the list of current categories.

Example

>>> check_categories(['I1', 'I2'], ['I1', 'O1', 'O2'])
>>> ValueError
>>> check_categories(['I1', 'O2'], ['I1', 'O1', 'O2'])
>>>
pyDEA.core.utils.dea_utils.check_input_and_output_categories(input_data)[source]

Raises ValueError if input or output categories are empty.

Parameters:input_data (InputData) – objects that stores all input data.
Raises:ValueError – if input or output categories are empty.
pyDEA.core.utils.dea_utils.clean_up_pickled_files()[source]

Removes mps-files from current folder and p-files from temporary folder.

pyDEA.core.utils.dea_utils.contraint_is_price_ratio_type(bounds_key)[source]

Checks if given parameter is a tuple with two elements. In the case of price ratio weight restrictions key of bounds dictionary will be a tuple with two elements.

Parameters:of str (tuple) – tuple with elements.
Returns:true if given element is a tuple with two elements, false otherwise.
Return type:bool
pyDEA.core.utils.dea_utils.create_bounds(constraints, categories)[source]

Creates proper data structures after parsing all constraints.

Parameters:
  • constraints (list of str) – list of constraints to parse.
  • categories (set of str) – set of current categories.
Returns:

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.

Raises:

ValueError – if some of the constraints cannot be parsed.

Example

>>> categories = set(['I1', 'I2', 'O1', 'O2'])
>>> constraints = ['I1 <= 10', 'I1 >= 2', 'O1 >= 3', 'O2 <= 7']
>>> create_bounds(constraints, categories)
>>> {'I1': (2, 10), 'O1': (3, None), 'O2': (None, 7)}
>>> ratio_bounds = ['I1/I2 <= 10', 'I1/I2 >= 1',
                    'O2/O1 >= 0.2', 'O1/O2 <= 0.5']
>>> create_bounds(ratio_bounds, categories)
>>> {('I1', 'I2'): (1, 10), ('O2', 'O1'): (0.2, None),
     ('O1', 'O2'): (None, 0.5)}
pyDEA.core.utils.dea_utils.create_params_str(params)[source]

Creates string from values of ORIENTATION and RETURN_TO_SCALE specified in parameters.

Parameters:params (Parameters) – parameters.
pyDEA.core.utils.dea_utils.find_category_name_in_restrictions(val)[source]

Finds category name in the given constraint.

Parameters:val (str) – string that contains one category name.
Returns:category name and index. Index is 0 if category name is on the left hand side of the constraint, non-zero if category name is on the right hand side. In the latter case, index correspond to the position of the category name in the constraint.
Return type:tuple of str, int

Example

>>> find_category_name_in_restrictions('I1 <= 7')
>>> ('I1', 0)
>>> find_category_name_in_restrictions('  I1  <=  7.8 ')
>>> ('I1', 0)
>>> find_category_name_in_restrictions('  category name with spaces  <=  7.8 ')
>>> ('category name with spaces', 0)
>>> find_category_name_in_restrictions('7.8 >= I2')
>>> ('I2', 7)
>>> find_category_name_in_restrictions('7.8 >=       I2')
>>> ('I2', 13)
>>> find_category_name_in_restrictions('I1/O2 >= 0.5')
>>> ('I1/O2', 0)

Warning

It is assumed that given constraint is a valid constraint with category name. If invalid value is given, the function will fail or return incorrect value

pyDEA.core.utils.dea_utils.format_data(data)[source]

Formats floating point number to 6 digits.

Parameters:data (double) – data that must be formatted
Returns:formatted data.
Return type:str

Example

>>> format_data(1.222222222222222)
>>> '1.222222'
>>> format_data('str')
>>> 'str'
>>> format_data(0.123456789)
>>> '0.123457'
>>> format_data('0.05')
>>> '0.050000'
pyDEA.core.utils.dea_utils.get_logger()[source]

Gets a logger with all configuration specified in file ini-file.

Returns:configured logger
Return type:logger
pyDEA.core.utils.dea_utils.get_price_ratio_categories(val)[source]

Parses price ratio categories.

Parameters:val (str) – string with price ratio categories.
Returns:tuple with categories in numerator and denominator respectively.
Return type:tuple of str, str

Example

>>> get_price_ratio_categories('I1/ I2')
>>> ('I1', 'I2')
>>> get_price_ratio_categories('   I1   /  I2  ')
>>> ('I1', 'I2')
>>> get_price_ratio_categories('  name with spaces / I2')
>>> ('name with spaces', 'I2')

Warning

If val does not contain / or has more than one /, the function will fail with assert.

pyDEA.core.utils.dea_utils.is_efficient(efficiency_score, lambda_variable)[source]

Checks if dmu with given efficiency score and value of lambda variable is efficient.

Parameters:
  • efficiency_score (double) – efficiency spyDEA.core.
  • lambda_variable (double) – value of lambda variable corresponding to DMU under consideration.
Returns:

True if DMU is efficient, False otherwise.

Return type:

bool

Example

>>> is_efficient(1, 1)
True
>>> is_efficient(0.5, 0)
False
>>> is_efficient(0.9999999, 1)
True
>>> is_efficient(1.0000001, 1)
True
pyDEA.core.utils.dea_utils.is_valid_coeff(coeff)[source]

Checks if given coefficient is valid. Valid coefficient is positive floating point or integer number.

Parameters:coeff (double) – data coefficient.
Returns:1, if coefficient is valid, 0 if coefficient is zero, -1, if coefficient is invalid.
Return type:int
pyDEA.core.utils.dea_utils.on_canvas_resize(canvas)[source]

This function updates scroll region of the canvas. It should be called on canvas resize.

Parameters:canvas (Canvas) – canvas
pyDEA.core.utils.dea_utils.parse_constraint(constraint, split_str, new_bounds_lb, new_bounds_ub, categories)[source]

Parses weight restriction constraint. This is internal utility function that is used in create_bounds().

Parameters:
  • constraint (str) – constraint that needs to be parsed.
  • split_str (str) – ‘>=’ or ‘<=’.
  • (dict of tuple of str, str to str or empty (new_bounds_ub) – dictionary): dictionary where parsed constraint will be written. This dictionary will be filled if split_str is ‘>=’.
  • (dict of tuple of str, str to str or empty – dictionary): dictionary where parsed constraint will be written. This dictionary will be filled if split_str is ‘<=’.
  • categories (set of str) – set of current categories.
Returns:

True if split_str was found in constraint, False otherwise.

Return type:

bool

Raises:

ValueError – if constraint cannot be parsed.

Example

>>> new_bounds_lb = dict()
>>> new_bounds_ub = dict()
>>> s = set(['I1', 'I2', 'O1', 'O2'])
>>> constr = 'I1 >= 5'
>>> parse_constraint(constr, '>=', new_bounds_lb, new_bounds_ub, s)
>>> True
>>> new_bounds_lb
>>> {'I1': 5}
>>> new_bounds_ub
>>> {}
pyDEA.core.utils.dea_utils.parse_price_ratio(elem, value, constraint, categories, bounds)[source]

Parses price ratio constraints and writes result to bounds. This function is internal utility function that is used for parsing weight restrictions in parse_constraint().

Parameters:
  • elem (str) – string that describes left hand side of price ratio constraint.
  • value (str) – string that describes right hand side of price ratio constraint.
  • constraint (str) – string that describes entire constraint.
  • categories (set of str) – set of current categories.
  • bounds (dict of tuple of str, str to str or empty dictionary) – dictionary where parsed constraint will be written.
Raises:

ValueError – if constraint cannot be parsed.

Example

>>> bounds = dict()
>>> s = set(['I1', 'I2', 'O1', 'O2'])
>>> parse_price_ratio('I1/I2', '5', 'I1/I2 >= 5', s, bounds)
>>> bounds
>>> {('I1', 'I2'): 5}
pyDEA.core.utils.dea_utils.validate_category_name(name, category_index, current_categories)[source]

Checks if given category name is valid. Name is valid if it is not a number, if it does not contain semicolon and if it is not duplicated.

Parameters:
  • name (str) – category name.
  • category_index (int) – index of this category in the list of current categories.
  • current_categories (list of str) – list of current categories.
Returns:

given category name if this name is valid, empty string otherwise.

Return type:

str

Example

>>> validate_category_name('I1n', 0, ['I1n', 'I2', 'O2])
>>> 'I1n'
>>> validate_category_name('I1n;', 0, ['I1n;', 'I2', 'O2])
>>> ''
>>> validate_category_name('1.2', 0, ['1.2', 'I2', 'O2])
>>> ''
>>> validate_category_name('I1n', 0, ['I1n', 'I1n', 'O2])
>>> ''

pyDEA.core.utils.model_builder module

This module contains function responsible for creating several models and parameters in the case when RETURN_TO_SCALE or ORIENTATION is set to both.

pyDEA.core.utils.model_builder.build_models(params, model_input)[source]

Creates several models and parameters in the case when RETURN_TO_SCALE or ORIENTATION is set to both. If neither RETURN_TO_SCALE nor ORIENTATION is set to both, then no new models will be created, a copy of the given model and parameters will be returned.

Parameters:
Returns:

tuple with two lists. The first list contains all created models, the second list contains corresponding parameters.

Return type:

tuple of list of ModelBase, list of Parameters

pyDEA.core.utils.model_factory module

This module contains classes responsible for creating a proper DEA model.

class pyDEA.core.utils.model_factory.EnvelopmentModelFactory[source]

Bases: pyDEA.core.utils.model_factory.ModelFactoryBase

A factory class responsible for creating envelopment model.

classmethod add_extra(model, weakly_disposal_categories, non_discr_categories, orientation)[source]

See base class.

classmethod get_VRS_model(model)[source]

See base class.

classmethod get_abs_restriction_model(model, bounds)[source]

See base class.

classmethod get_basic_model(model_input, concrete_model, weakly_disposal_categories, params)[source]

See base class.

classmethod get_input_oriented_model(use_super_efficiency, non_discr_categories)[source]

See base class.

static get_lower_bound_generator(use_super_efficiency)[source]

Returns a function for lower bound generation for envelopment model.

Parameters:use_super_efficiency (bool) – true if super efficiency model should be created, false otherwise.
Returns:function for lower bound generation.
Return type:func
classmethod get_output_oriented_model(use_super_efficiency, non_discr_categories)[source]

See base class.

classmethod get_price_ratio_model(model, bounds)[source]

See base class.

static get_upper_bound_generator_for_env_model(use_super_efficiency)[source]

Returns a function for upper bound generation for envelopment model.

Parameters:use_super_efficiency (bool) – true if super efficiency model should be created, false otherwise.
Returns:function for upper bound generation.
Return type:func
classmethod get_virtual_restriction_model(model, bounds)[source]

See base class.

class pyDEA.core.utils.model_factory.ModelFactoryBase[source]

Bases: object

Abstract base class for factory classes responsible for creating a DEA model.

classmethod add_extra(model, weakly_disposal_categories, non_discr_categories, orientation)[source]

Helper method that is called after get_basic_model.

Parameters:
  • model (ModelBase) – model to decorate.
  • weakly_disposal_categories (list of str) – list of weakly disposal categories. If empty, all categories are considered strongly disposal.
  • non_discr_categories (list of str) – list of non-discretionary categories. If empty, all categories are considered discretionary.
  • orientation (str) – string that describes orientation of the model. Possible values: “input” or “output”.
Returns:

decorated DEA model.

Return type:

ModelBased

classmethod create_model(params, model_input)[source]

Allocated a proper DEA model given parameters and input data.

Parameters:
  • params (Parameters) – model parameters.
  • model_input (InputData) – object that stores input data.
Returns:

allocated DEA model.

Return type:

ModelBase

classmethod get_VRS_model(model)[source]

Decorates a given model with VRS constraints or variables.

Parameters:model (ModelBase) – model to decorate.
Returns:decorated VRS DEA model.
Return type:ModelBase
classmethod get_abs_restriction_model(model, bounds)[source]

Decorates a given model with absolute weight restrictions.

Parameters:
  • model (ModelBase) – model to decorate.
  • 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.
Returns:

decorated DEA model with absolute weight restrictions.

Return type:

ModelBase

classmethod get_basic_model(model_input, concrete_model, weakly_disposal_categories, params)[source]

Returns allocated basic CRS DEA model.

Parameters:
  • model_input (InputData) – object that stores input data.
  • concrete_model (InputOrientedModel or OutputOrientedModel) – input- or output-oriented model used in ModelBase.
  • weakly_disposal_categories (list of str) – list of weakly disposal categories. If empty, all categories are considered strongly disposal.
  • params (Parameters) – model parameters.
Returns:

allocated DEA model.

Return type:

ModelBase

classmethod get_input_oriented_model(use_super_efficiency, non_discr_categories)[source]

Returns input-oriented model used in ModelBase.

Parameters:
  • use_super_efficiency (bool) – true if super efficiency model should be created, false otherwise.
  • non_discr_categories (list of str) – list of non-discretionary categories. If empty, all categories are considered discretionary.
Returns:

allocated input-oriented model.

Return type:

InputOrientedModel

classmethod get_output_oriented_model(use_super_efficiency, non_discr_categories)[source]

Returns output-oriented model used in ModelBase.

Parameters:
  • use_super_efficiency (bool) – true if super efficiency model should be created, false otherwise.
  • non_discr_categories (list of str) – list of non-discretionary categories. If empty, all categories are considered discretionary.
Returns:

allocated output-oriented model.

Return type:

OutputOrientedModel

classmethod get_price_ratio_model(model, bounds)[source]

Decorates a given model with price ratio weight restrictions.

Parameters:
  • model (ModelBase) – model to decorate.
  • 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.
Returns:

decorated DEA model with price ratio weight restrictions.

Return type:

ModelBase

classmethod get_virtual_restriction_model(model, bounds)[source]

Decorates a given model with virtual weight restrictions.

Parameters:
  • model (ModelBase) – model to decorate.
  • 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.
Returns:

decorated DEA model with virtual weight restrictions.

Return type:

ModelBase

class pyDEA.core.utils.model_factory.MultiplierModelFactory[source]

Bases: pyDEA.core.utils.model_factory.ModelFactoryBase

A factory class responsible for creating multiplier model.

classmethod add_extra(model, weakly_disposal_categories, non_discr_categories, orientation)[source]

See base class.

classmethod get_VRS_model(model)[source]

See base class.

classmethod get_abs_restriction_model(model, bounds)[source]

See base class.

classmethod get_basic_model(model_input, concrete_model, weakly_disposal_categories, params)[source]

See base class.

classmethod get_input_oriented_model(use_super_efficiency, non_discr_categories)[source]

See base class.

classmethod get_output_oriented_model(use_super_efficiency, non_discr_categories)[source]

See base class.

classmethod get_price_ratio_model(model, bounds)[source]

See base class.

classmethod get_virtual_restriction_model(model, bounds)[source]

See base class.

pyDEA.core.utils.model_factory.add_input_and_output_categories(params, model_input)[source]

Adds input and output categories specified in parameters to a given InputData object.

Parameters:
  • params (Parameters) – model parameters.
  • model_input (InputData) – object that stores input data.
Raises:

ValueError – if input or output (or both) categories are missing.

pyDEA.core.utils.model_factory.create_model(params, model_input)[source]

Allocates a proper DEA model based on given parameters and input data. This function must be used for creating DEA model. It calls appropriate factory class.

Parameters:
  • params (Parameters) – model parameters.
  • model_input (InputData) – object that stores input data.
Raises:

ValueError – if DEA form parameter has invalid value. Allowed values are env and multi.

Returns:

allocated DEA model.

Return type:

ModelBase

pyDEA.core.utils.progress_recorders module

This module contains classes responsible for updating solution progress.

class pyDEA.core.utils.progress_recorders.GuiProgress(progress_bar, nb_models, nb_sheets)[source]

Bases: pyDEA.core.utils.progress_recorders.NullProgress

This class updates progress bar while a given problem is being solved.

progress_bar

ProgressBar

progress bar.

step_size

double

progress bar increment.

Parameters:
  • progress_bar (ProgressBar) – progress bar.
  • nb_models (int) – total number of DEA models, can take values 1, 2 or 4.
  • nb_sheets (int) – number of sheets in solution.
increment_step()[source]

Increments the progress bar by a step size.

set_position(position)[source]

Sets position of the progress bar to a given value.

Parameters:position (double) – progress bar position.
class pyDEA.core.utils.progress_recorders.NullProgress[source]

Bases: object

This class does not update solution progress. It is used in terminal application.

increment_step()[source]

Does nothing.

set_position(position)[source]

Does nothing.

pyDEA.core.utils.run_routine module

This module contains classes responsible for solving a given data instance either through terminal or GUI.

class pyDEA.core.utils.run_routine.RunMethodBase[source]

Bases: object

This class is an abstract base class for other classes used for executing solution routine - create data instance, solve LPs, post-process solutions.

decorate_model(model_obj)[source]

This method is called after a model has been created, implementation depends on a concrete class.

Parameters:model_obj (ModelBase or any of its derivatives) – model
Returns:decorated model
Return type:(ModelBase or any of its derivatives)
get_categories()[source]

Returns current categories.

Returns:list of current categories
Return type:(list of str)
get_coefficients()[source]

Returns problem data coefficients.

Returns:dictionary that maps DMU code to the list of coefficients. Coefficients must appear in the same order as categories.
Return type:(dict of str to list of double)
init_before_run(nb_models, coefficients)[source]

Initialises appropriate data structures before solving LPs, implementation depends on a concrete class.

Parameters:
  • nb_models (int) – number of models, can take values 1, 2 or 4.
  • coefficients (dict of str to list of float) – dictionary that maps DMU code to the list of coefficients
post_process_solutions(solutions, params, param_strs, all_ranks, run_date, total_seconds)[source]

Post-processes solutions, implementation depends on a concrete class.

Parameters:
  • solutions (list of Solution) – list of obtained solutions.
  • params (Parameter) – parameters.
  • param_strs (list of str) – list of strings that describe each model.
  • all_ranks (list of dict of str to double) – list that contains dictionaries that map DMU code to peel the onion rank.
  • run_date (datetime) – date and time when the problem was solved.
  • total_seconds (float) – time (in seconds) needed to solve the problem.
run(params)[source]

Executes solution routine - create data instance, solve LPs, post-process solutions.

Parameters:params (Parameters) – parameters of a given problem instance
show_error(message)[source]

Displays error message.

Parameters:message (str) – error message
show_success()[source]

By default does not do anything, but can be redefined by child classes to show a message that the execution was successful.

validate_weights_if_needed()[source]

Validates weight restrictions if they are present. This method might update parameters, hence, it MUST be called before model_builder.

class pyDEA.core.utils.run_routine.RunMethodGUI(frame)[source]

Bases: pyDEA.core.utils.run_routine.RunMethodBase

This class implements running routing from GUI.

frame

Tk Frame

main GUI frame.

current_dmu

StringVar

StringVar object that tracks when when DMU changes during solution process.

increment

double

progress bar increment.

Parameters:frame (Tk Frame) – main GUI frame.
decorate_model(model_obj)[source]

See base class.

get_categories()[source]

See base class.

get_coefficients()[source]

See base class.

init_before_run(nb_models, coefficients)[source]

See base class.

post_process_solutions(solutions, params, param_strs, all_ranks, run_date, total_seconds)[source]

See base class.

show_error(message)[source]

See base class.

validate_weights_if_needed()[source]

See base class.

class pyDEA.core.utils.run_routine.RunMethodTerminal(params, sheet_name_usr, output_format, output_dir='')[source]

Bases: pyDEA.core.utils.run_routine.RunMethodBase

This class implements running routing from terminal.

params

Parameters

parameters.

sheet_name_usr

str

sheet name from which input data must be read.

output_dir

str

path to directory where solution must be stored.

output_format

str

file extension for solution files.

data

list of str

list where the first element is DMU name, all other elements are coefficients.

Parameters:
  • params (Parameters) – parameters.
  • sheet_name_usr (str) – sheet name from which input data must be read.
  • output_format (str) – file extension for solution files.
  • output_dir (str, optional) – path to directory where solution must be stored. If not given, solution will be stored to current directory.
decorate_model(model_obj)[source]

See base class.

get_categories()[source]

See base class.

get_coefficients()[source]

See base class.

init_before_run(nb_models, coefficients)[source]

See base class.

post_process_solutions(solutions, params, param_strs, all_ranks, run_date, total_seconds)[source]

See base class.

show_error(message)[source]

See base class.

show_success()[source]

Displays success message on screen.

validate_weights_if_needed()[source]

See base class.

pyDEA.core.utils.run_routine.derive_returns_to_scale_classification(param_strs, solutions)[source]

Add a dictionary that describes the DMUs’ returns-to-scale classification to the solution object. Note that for a given orientation (intput or ouput), the returns-to-scale of a DMU is the same for both the CRS and the VRS models. See the following algorithm for more detail:

For a DMUo

If CRSeff of DMUo = VRSeff of DMUo then classify DMUo as CRS Else

If sum of DMUo’s CRS lambdas < 1 then classify DMUo as IRS Else classify DMUo as DRS
Parameters:
  • param_strs (list of str) – list of strings that describe each model.
  • solutions (list of Solution) – list of obtained solutions.
Returns:

RTS_classification – indicate frontier

for the DMUs.

Return type:

dict of dmu_code (str) to classification (str)

Module contents