negmas.helpers Package

Helper modueles

Functions

get_class(class_name[, module_name, scope, ...])

Imports and creates a class object for the given class name

import_by_name(full_name)

Imports something form a module using its full name

get_full_type_name(t)

Gets the ful typename of a type.

instantiate(class_name[, module_name, scope])

Imports and instantiates an object of a class

is_jsonable(x)

is_lambda_function(obj)

Checks if the given object is a lambda function

is_partial_function(obj)

Checks if the given object is a lambda function

is_lambda_or_partial_function(obj)

Checks if the given object is a lambda function or a partial function

is_type(obj)

Checks if the given object is a type converted to string

is_not_lambda_nor_partial_function(obj)

Checks if the given object is not a lambda function

make_distribution(x)

Ensures the output is Distribution

get_one_float(rng)

get_one_int(i)

make_range(x)

rtype

tuple[T, T]

truncated_mean(scores[, limits, top_limit, ...])

Calculates the truncated mean

sample(n, k[, grid, compact, endpoints])

Samples k items from n in the range (0, n-1) optionally explring them

is_int_type(x)

Checks if the given type is an integer (cannot be a floating point type)

is_float_type(x)

Checks if the given type is a floating point type (it cannot be an integer type)

isint(x)

Is the given number is of an integer type

isreal(x)

Is the given number is of a floating point type

shortest_unique_names(strs[, sep, ...])

Finds the shortest unique strings starting from the end of each input string based on the separator.

snake_case(s)

Converts a string from CamelCase to snake_case

camel_case(s[, capitalize_first, lower_first])

Converts a string from snake_case to CamelCase

unique_name(base[, add_time, add_host, ...])

Return a unique name.

pretty_string(src[, tab_size, compact])

Recursively print nested elements.

exception2str([limit, chain])

rtype

str

humanize_time(secs[, align, ...])

Prints time that is given as seconds in human readable form.

shorten(name[, length, common_parts])

Returns a short version of the name.

create_loggers([file_name, module_name, ...])

Create a set of loggers to report feedback.

is_nonzero_file(fpath)

Whether or not the path is for an existing nonzero file.

dump(d, file_name[, sort_keys, compact])

Saves an object depending on the extension of the file given.

load(file_name)

Loads an object depending on the extension of the file given.

add_records(file_name, data[, col_names, ...])

Adds records to a csv file

force_single_thread([on])

Forces negmas to use a single thread for all internal calls.

single_thread()

monotonic_minmax(input, f)

Finds the limits of a function f for the input assuming that it is monotonic and input has min_value and max_value members

monotonic_multi_minmax(input, f)

Finds the limits of a function f for the input assuming that it is monotonic and each input has min_value and max_value members

nonmonotonic_multi_minmax(input, f)

Finds the limits of a function f for each input assuming that it is non-monotonic and input is iterable

nonmonotonic_minmax(input, f)

Finds the limits of a function f for the input assuming that it is non-monotonic and input is iterable

make_callable(x)

Converts its input to a callable (i.e.

Classes

PathLike()

Abstract base class for implementing the file system path protocol.

ReturnCause(value)

An enumeration.

Distribution(*args, **kwargs)

ScipyDistribution(type, **kwargs)

Any distribution from scipy.stats with overloading of addition and multiplication.

NormalDistribution([loc, scale, type])

A ScipyDistribution reprsenting a unifrom distribution

UniformDistribution([loc, scale, type])

A ScipyDistribution reprsenting a unifrom distribution

Real([loc, type, scale])

A real number implementing the Distribution interface

ConfigReader()

TimeoutError

The operation exceeded the given deadline.

TimeoutCaller()

Class Inheritance Diagram

digraph inheritance06e93a9375 { bgcolor=transparent; fontsize=11; randkir=TB; rankdir=LR; size=""; "ConfigReader" [URL="../../api/negmas.helpers.ConfigReader.html#negmas.helpers.ConfigReader",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Distribution" [URL="../../api/negmas.helpers.Distribution.html#negmas.helpers.Distribution",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Protocol" -> "Distribution" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Enum" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Generic enumeration."]; "Generic" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Abstract base class for generic types."]; "NormalDistribution" [URL="../../api/negmas.helpers.NormalDistribution.html#negmas.helpers.NormalDistribution",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A `ScipyDistribution` reprsenting a unifrom distribution"]; "ScipyDistribution" -> "NormalDistribution" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Protocol" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Base class for protocol classes."]; "Generic" -> "Protocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Real" [URL="../../api/negmas.helpers.Real.html#negmas.helpers.Real",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A real number implementing the `Distribution` interface"]; "Distribution" -> "Real" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ReturnCause" [URL="../../api/negmas.helpers.ReturnCause.html#negmas.helpers.ReturnCause",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An enumeration."]; "Enum" -> "ReturnCause" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ScipyDistribution" [URL="../../api/negmas.helpers.ScipyDistribution.html#negmas.helpers.ScipyDistribution",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Any distribution from scipy.stats with overloading of addition and multiplication."]; "Distribution" -> "ScipyDistribution" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TimeoutCaller" [URL="../../api/negmas.helpers.TimeoutCaller.html#negmas.helpers.TimeoutCaller",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "UniformDistribution" [URL="../../api/negmas.helpers.UniformDistribution.html#negmas.helpers.UniformDistribution",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A `ScipyDistribution` reprsenting a unifrom distribution"]; "ScipyDistribution" -> "UniformDistribution" [arrowsize=0.5,style="setlinewidth(0.5)"]; }