LSInconsistency Class

class localsolver.LSInconsistency

Value type for the Inconsistency core of the optimization model. Also known as Irreductible Inconsistent Subproblem. Such a value is obtained with LocalSolver.compute_inconsistency().

Since:

6.0

Summary

Methods

get_nb_causes

Returns the number of expressions responsible for the inconsistency of this model.

get_cause

Returns the cause at the given position in this model.

Special methods

__str__

Returns a string representation of this inconsistency core.

__len__

Returns the number of expressions responsible for the inconsistency of this model.

__getitem__

Returns the cause at the given position in this model.

Instance methods

LSInconsistency.get_nb_causes()

Returns the number of expressions responsible for the inconsistency of this model. The sub problem reduced to these expressions and their operands (recursively) is inconsistent. This method returns 0 if the inconsistency of the problem could not be proven.

Returns:

Number of expressions.

Return type:

int

LSInconsistency.get_cause(pos)

Returns the cause at the given position in this model.

Parameters:

pos – A non negative integer strictly smaller than get_nb_causes().

Returns:

The requested expression.

Return type:

LSExpression

Special operators and methods

LSInconsistency.__str__()

Returns a string representation of this inconsistency core.

Returns:

String representation of this inconsistency core.

Return type:

str

LSInconsistency.__len__()

Returns the number of expressions responsible for the inconsistency of this model. The sub problem reduced to these expressions and their operands (recursively) is inconsistent. This method returns 0 if the inconsistency of the problem could not be proven. This method allows users to call len() function directly on the native context without using the get_nb_causes() method.

Returns:

Number of expressions.

Return type:

int

LSInconsistency.__getitem__(pos)

Returns the cause at the given position in this model. This method allows users to use [] operator directly on the native context without using the get_cause() method.

Parameters:

pos – A non negative integer strictly smaller than get_nb_causes().

Returns:

The requested expression.

Return type:

LSExpression