diff --git a/docs/python/ortools/linear_solver/pywraplp.html b/docs/python/ortools/linear_solver/pywraplp.html new file mode 100644 index 0000000000..bcf7f7d53e --- /dev/null +++ b/docs/python/ortools/linear_solver/pywraplp.html @@ -0,0 +1,2595 @@ + + + + + + +pywraplp API documentation + + + + + + + + + + + +
+
+
+

Module pywraplp

+
+
+
+Source code +
# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 4.0.0
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+from sys import version_info as _swig_python_version_info
+if _swig_python_version_info < (2, 7, 0):
+    raise RuntimeError('Python 2.7 or later required')
+
+# Import the low-level C/C++ module
+if __package__ or '.' in __name__:
+    from . import _pywraplp
+else:
+    import _pywraplp
+
+try:
+    import builtins as __builtin__
+except ImportError:
+    import __builtin__
+
+def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
+    if name == "thisown":
+        return self.this.own(value)
+    if name == "this":
+        if type(value).__name__ == 'SwigPyObject':
+            self.__dict__[name] = value
+            return
+    method = class_type.__swig_setmethods__.get(name, None)
+    if method:
+        return method(self, value)
+    if not static:
+        object.__setattr__(self, name, value)
+    else:
+        raise AttributeError("You cannot add attributes to %s" % self)
+
+
+def _swig_setattr(self, class_type, name, value):
+    return _swig_setattr_nondynamic(self, class_type, name, value, 0)
+
+
+def _swig_getattr(self, class_type, name):
+    if name == "thisown":
+        return self.this.own()
+    method = class_type.__swig_getmethods__.get(name, None)
+    if method:
+        return method(self)
+    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
+
+
+def _swig_repr(self):
+    try:
+        strthis = "proxy of " + self.this.__repr__()
+    except __builtin__.Exception:
+        strthis = ""
+    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+
+def _swig_setattr_nondynamic_instance_variable(set):
+    def set_instance_attr(self, name, value):
+        if name == "thisown":
+            self.this.own(value)
+        elif name == "this":
+            set(self, name, value)
+        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
+            set(self, name, value)
+        else:
+            raise AttributeError("You cannot add instance attributes to %s" % self)
+    return set_instance_attr
+
+
+def _swig_setattr_nondynamic_class_variable(set):
+    def set_class_attr(cls, name, value):
+        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
+            set(cls, name, value)
+        else:
+            raise AttributeError("You cannot add class attributes to %s" % cls)
+    return set_class_attr
+
+
+def _swig_add_metaclass(metaclass):
+    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
+    def wrapper(cls):
+        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
+    return wrapper
+
+
+class _SwigNonDynamicMeta(type):
+    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
+    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
+
+
+
+import numbers
+from ortools.linear_solver.linear_solver_natural_api import OFFSET_KEY
+from ortools.linear_solver.linear_solver_natural_api import inf
+from ortools.linear_solver.linear_solver_natural_api import LinearExpr
+from ortools.linear_solver.linear_solver_natural_api import ProductCst
+from ortools.linear_solver.linear_solver_natural_api import Sum
+from ortools.linear_solver.linear_solver_natural_api import SumArray
+from ortools.linear_solver.linear_solver_natural_api import SumCst
+from ortools.linear_solver.linear_solver_natural_api import LinearConstraint
+from ortools.linear_solver.linear_solver_natural_api import VariableExpr
+
+class Solver(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+    CLP_LINEAR_PROGRAMMING = _pywraplp.Solver_CLP_LINEAR_PROGRAMMING
+    GLOP_LINEAR_PROGRAMMING = _pywraplp.Solver_GLOP_LINEAR_PROGRAMMING
+    CBC_MIXED_INTEGER_PROGRAMMING = _pywraplp.Solver_CBC_MIXED_INTEGER_PROGRAMMING
+    BOP_INTEGER_PROGRAMMING = _pywraplp.Solver_BOP_INTEGER_PROGRAMMING
+
+    def __init__(self, name: 'std::string const &', problem_type: 'operations_research::MPSolver::OptimizationProblemType'):
+        _pywraplp.Solver_swiginit(self, _pywraplp.new_Solver(name, problem_type))
+    __swig_destroy__ = _pywraplp.delete_Solver
+
+    @staticmethod
+    def SupportsProblemType(problem_type: 'operations_research::MPSolver::OptimizationProblemType') -> "bool":
+        return _pywraplp.Solver_SupportsProblemType(problem_type)
+
+    def Clear(self) -> "void":
+        return _pywraplp.Solver_Clear(self)
+
+    def NumVariables(self) -> "int":
+        return _pywraplp.Solver_NumVariables(self)
+
+    def LookupVariable(self, var_name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_LookupVariable(self, var_name)
+
+    def Var(self, lb: 'double', ub: 'double', integer: 'bool', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_Var(self, lb, ub, integer, name)
+
+    def NumVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_NumVar(self, lb, ub, name)
+
+    def IntVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_IntVar(self, lb, ub, name)
+
+    def BoolVar(self, name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_BoolVar(self, name)
+
+    def NumConstraints(self) -> "int":
+        return _pywraplp.Solver_NumConstraints(self)
+
+    def LookupConstraint(self, constraint_name: 'std::string const &') -> "operations_research::MPConstraint *":
+        return _pywraplp.Solver_LookupConstraint(self, constraint_name)
+
+    def Constraint(self, *args) -> "operations_research::MPConstraint *":
+        return _pywraplp.Solver_Constraint(self, *args)
+
+    def Objective(self) -> "operations_research::MPObjective *":
+        return _pywraplp.Solver_Objective(self)
+    OPTIMAL = _pywraplp.Solver_OPTIMAL
+    FEASIBLE = _pywraplp.Solver_FEASIBLE
+    INFEASIBLE = _pywraplp.Solver_INFEASIBLE
+    UNBOUNDED = _pywraplp.Solver_UNBOUNDED
+    ABNORMAL = _pywraplp.Solver_ABNORMAL
+    NOT_SOLVED = _pywraplp.Solver_NOT_SOLVED
+
+    def Solve(self, *args) -> "operations_research::MPSolver::ResultStatus":
+        return _pywraplp.Solver_Solve(self, *args)
+
+    def ComputeConstraintActivities(self) -> "std::vector< double >":
+        return _pywraplp.Solver_ComputeConstraintActivities(self)
+
+    def VerifySolution(self, tolerance: 'double', log_errors: 'bool') -> "bool":
+        return _pywraplp.Solver_VerifySolution(self, tolerance, log_errors)
+
+    def InterruptSolve(self) -> "bool":
+        return _pywraplp.Solver_InterruptSolve(self)
+
+    def FillSolutionResponseProto(self, response: 'operations_research::MPSolutionResponse *') -> "void":
+        return _pywraplp.Solver_FillSolutionResponseProto(self, response)
+
+    @staticmethod
+    def SolveWithProto(model_request: 'operations_research::MPModelRequest const &', response: 'operations_research::MPSolutionResponse *') -> "operations_research::MPSolutionResponse *":
+        return _pywraplp.Solver_SolveWithProto(model_request, response)
+
+    def ExportModelToProto(self, output_model: 'operations_research::MPModelProto *') -> "void":
+        return _pywraplp.Solver_ExportModelToProto(self, output_model)
+
+    def LoadSolutionFromProto(self, *args) -> "util::Status":
+        return _pywraplp.Solver_LoadSolutionFromProto(self, *args)
+
+    def SetSolverSpecificParametersAsString(self, parameters: 'std::string const &') -> "bool":
+        return _pywraplp.Solver_SetSolverSpecificParametersAsString(self, parameters)
+    FREE = _pywraplp.Solver_FREE
+    AT_LOWER_BOUND = _pywraplp.Solver_AT_LOWER_BOUND
+    AT_UPPER_BOUND = _pywraplp.Solver_AT_UPPER_BOUND
+    FIXED_VALUE = _pywraplp.Solver_FIXED_VALUE
+    BASIC = _pywraplp.Solver_BASIC
+
+    @staticmethod
+    def infinity() -> "double":
+        return _pywraplp.Solver_infinity()
+
+    def EnableOutput(self) -> "void":
+        return _pywraplp.Solver_EnableOutput(self)
+
+    def SuppressOutput(self) -> "void":
+        return _pywraplp.Solver_SuppressOutput(self)
+
+    def iterations(self) -> "int64":
+        return _pywraplp.Solver_iterations(self)
+
+    def nodes(self) -> "int64":
+        return _pywraplp.Solver_nodes(self)
+
+    def ComputeExactConditionNumber(self) -> "double":
+        return _pywraplp.Solver_ComputeExactConditionNumber(self)
+
+    def NextSolution(self) -> "bool":
+        return _pywraplp.Solver_NextSolution(self)
+
+    def set_time_limit(self, time_limit_milliseconds: 'int64') -> "void":
+        return _pywraplp.Solver_set_time_limit(self, time_limit_milliseconds)
+
+    def wall_time(self) -> "int64":
+        return _pywraplp.Solver_wall_time(self)
+
+    def LoadModelFromProto(self, input_model: 'operations_research::MPModelProto const &') -> "std::string":
+        return _pywraplp.Solver_LoadModelFromProto(self, input_model)
+
+    def ExportModelAsLpFormat(self, *args) -> "std::string":
+        return _pywraplp.Solver_ExportModelAsLpFormat(self, *args)
+
+    def ExportModelAsMpsFormat(self, *args) -> "std::string":
+        return _pywraplp.Solver_ExportModelAsMpsFormat(self, *args)
+
+    def SetHint(self, variables: 'std::vector< operations_research::MPVariable * > const &', values: 'std::vector< double > const &') -> "void":
+        return _pywraplp.Solver_SetHint(self, variables, values)
+
+    def SetNumThreads(self, num_theads: 'int') -> "bool":
+        return _pywraplp.Solver_SetNumThreads(self, num_theads)
+
+    def Add(self, constraint, name=''):
+      if isinstance(constraint, bool):
+        if constraint:
+          return self.RowConstraint(0, 0, name)
+        else:
+          return self.RowConstraint(1, 1, name)
+      else:
+        return constraint.Extract(self, name)
+
+    def Sum(self, expr_array):
+      result = SumArray(expr_array)
+      return result
+
+    def RowConstraint(self, *args):
+      return self.Constraint(*args)
+
+    def Minimize(self, expr):
+      objective = self.Objective()
+      objective.Clear()
+      objective.SetMinimization()
+      if isinstance(expr, numbers.Number):
+          objective.SetOffset(expr)
+      else:
+          coeffs = expr.GetCoeffs()
+          objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+          for v, c, in list(coeffs.items()):
+            objective.SetCoefficient(v, float(c))
+
+    def Maximize(self, expr):
+      objective = self.Objective()
+      objective.Clear()
+      objective.SetMaximization()
+      if isinstance(expr, numbers.Number):
+          objective.SetOffset(expr)
+      else:
+          coeffs = expr.GetCoeffs()
+          objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+          for v, c, in list(coeffs.items()):
+            objective.SetCoefficient(v, float(c))
+
+
+    @staticmethod
+    def Infinity() -> "double":
+        return _pywraplp.Solver_Infinity()
+
+    def SetTimeLimit(self, x: 'int64') -> "void":
+        return _pywraplp.Solver_SetTimeLimit(self, x)
+
+    def WallTime(self) -> "int64":
+        return _pywraplp.Solver_WallTime(self)
+
+    def Iterations(self) -> "int64":
+        return _pywraplp.Solver_Iterations(self)
+
+# Register Solver in _pywraplp:
+_pywraplp.Solver_swigregister(Solver)
+
+def Solver_SupportsProblemType(problem_type: 'operations_research::MPSolver::OptimizationProblemType') -> "bool":
+    return _pywraplp.Solver_SupportsProblemType(problem_type)
+
+def Solver_SolveWithProto(model_request: 'operations_research::MPModelRequest const &', response: 'operations_research::MPSolutionResponse *') -> "operations_research::MPSolutionResponse *":
+    return _pywraplp.Solver_SolveWithProto(model_request, response)
+
+def Solver_infinity() -> "double":
+    return _pywraplp.Solver_infinity()
+
+def Solver_Infinity() -> "double":
+    return _pywraplp.Solver_Infinity()
+
+
+def __lshift__(*args) -> "std::ostream &":
+    return _pywraplp.__lshift__(*args)
+class Objective(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+    __repr__ = _swig_repr
+
+    def Clear(self) -> "void":
+        return _pywraplp.Objective_Clear(self)
+
+    def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+        return _pywraplp.Objective_SetCoefficient(self, var, coeff)
+
+    def GetCoefficient(self, var: 'Variable') -> "double":
+        return _pywraplp.Objective_GetCoefficient(self, var)
+
+    def SetOffset(self, value: 'double') -> "void":
+        return _pywraplp.Objective_SetOffset(self, value)
+
+    def offset(self) -> "double":
+        return _pywraplp.Objective_offset(self)
+
+    def SetOptimizationDirection(self, maximize: 'bool') -> "void":
+        return _pywraplp.Objective_SetOptimizationDirection(self, maximize)
+
+    def SetMinimization(self) -> "void":
+        return _pywraplp.Objective_SetMinimization(self)
+
+    def SetMaximization(self) -> "void":
+        return _pywraplp.Objective_SetMaximization(self)
+
+    def maximization(self) -> "bool":
+        return _pywraplp.Objective_maximization(self)
+
+    def minimization(self) -> "bool":
+        return _pywraplp.Objective_minimization(self)
+
+    def Value(self) -> "double":
+        return _pywraplp.Objective_Value(self)
+
+    def BestBound(self) -> "double":
+        return _pywraplp.Objective_BestBound(self)
+
+    def Offset(self) -> "double":
+        return _pywraplp.Objective_Offset(self)
+    __swig_destroy__ = _pywraplp.delete_Objective
+
+# Register Objective in _pywraplp:
+_pywraplp.Objective_swigregister(Objective)
+
+class Variable(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+
+    def name(self) -> "std::string const &":
+        return _pywraplp.Variable_name(self)
+
+    def integer(self) -> "bool":
+        return _pywraplp.Variable_integer(self)
+
+    def solution_value(self) -> "double":
+        return _pywraplp.Variable_solution_value(self)
+
+    def index(self) -> "int":
+        return _pywraplp.Variable_index(self)
+
+    def lb(self) -> "double":
+        return _pywraplp.Variable_lb(self)
+
+    def ub(self) -> "double":
+        return _pywraplp.Variable_ub(self)
+
+    def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+        return _pywraplp.Variable_SetBounds(self, lb, ub)
+
+    def reduced_cost(self) -> "double":
+        return _pywraplp.Variable_reduced_cost(self)
+
+    def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+        return _pywraplp.Variable_basis_status(self)
+
+    def __str__(self) -> "std::string":
+        return _pywraplp.Variable___str__(self)
+
+    def __repr__(self) -> "std::string":
+        return _pywraplp.Variable___repr__(self)
+
+    def __getattr__(self, name):
+      return getattr(VariableExpr(self), name)
+
+
+    def SolutionValue(self) -> "double":
+        return _pywraplp.Variable_SolutionValue(self)
+
+    def Integer(self) -> "bool":
+        return _pywraplp.Variable_Integer(self)
+
+    def Lb(self) -> "double":
+        return _pywraplp.Variable_Lb(self)
+
+    def Ub(self) -> "double":
+        return _pywraplp.Variable_Ub(self)
+
+    def SetLb(self, x: 'double') -> "void":
+        return _pywraplp.Variable_SetLb(self, x)
+
+    def SetUb(self, x: 'double') -> "void":
+        return _pywraplp.Variable_SetUb(self, x)
+
+    def ReducedCost(self) -> "double":
+        return _pywraplp.Variable_ReducedCost(self)
+    __swig_destroy__ = _pywraplp.delete_Variable
+
+# Register Variable in _pywraplp:
+_pywraplp.Variable_swigregister(Variable)
+
+class Constraint(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+    __repr__ = _swig_repr
+
+    def name(self) -> "std::string const &":
+        return _pywraplp.Constraint_name(self)
+
+    def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+        return _pywraplp.Constraint_SetCoefficient(self, var, coeff)
+
+    def GetCoefficient(self, var: 'Variable') -> "double":
+        return _pywraplp.Constraint_GetCoefficient(self, var)
+
+    def lb(self) -> "double":
+        return _pywraplp.Constraint_lb(self)
+
+    def ub(self) -> "double":
+        return _pywraplp.Constraint_ub(self)
+
+    def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+        return _pywraplp.Constraint_SetBounds(self, lb, ub)
+
+    def set_is_lazy(self, laziness: 'bool') -> "void":
+        return _pywraplp.Constraint_set_is_lazy(self, laziness)
+
+    def index(self) -> "int":
+        return _pywraplp.Constraint_index(self)
+
+    def dual_value(self) -> "double":
+        return _pywraplp.Constraint_dual_value(self)
+
+    def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+        return _pywraplp.Constraint_basis_status(self)
+
+    def Lb(self) -> "double":
+        return _pywraplp.Constraint_Lb(self)
+
+    def Ub(self) -> "double":
+        return _pywraplp.Constraint_Ub(self)
+
+    def SetLb(self, x: 'double') -> "void":
+        return _pywraplp.Constraint_SetLb(self, x)
+
+    def SetUb(self, x: 'double') -> "void":
+        return _pywraplp.Constraint_SetUb(self, x)
+
+    def DualValue(self) -> "double":
+        return _pywraplp.Constraint_DualValue(self)
+    __swig_destroy__ = _pywraplp.delete_Constraint
+
+# Register Constraint in _pywraplp:
+_pywraplp.Constraint_swigregister(Constraint)
+
+class MPSolverParameters(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+    RELATIVE_MIP_GAP = _pywraplp.MPSolverParameters_RELATIVE_MIP_GAP
+    PRIMAL_TOLERANCE = _pywraplp.MPSolverParameters_PRIMAL_TOLERANCE
+    DUAL_TOLERANCE = _pywraplp.MPSolverParameters_DUAL_TOLERANCE
+    PRESOLVE = _pywraplp.MPSolverParameters_PRESOLVE
+    LP_ALGORITHM = _pywraplp.MPSolverParameters_LP_ALGORITHM
+    INCREMENTALITY = _pywraplp.MPSolverParameters_INCREMENTALITY
+    SCALING = _pywraplp.MPSolverParameters_SCALING
+    PRESOLVE_OFF = _pywraplp.MPSolverParameters_PRESOLVE_OFF
+    PRESOLVE_ON = _pywraplp.MPSolverParameters_PRESOLVE_ON
+    DUAL = _pywraplp.MPSolverParameters_DUAL
+    PRIMAL = _pywraplp.MPSolverParameters_PRIMAL
+    BARRIER = _pywraplp.MPSolverParameters_BARRIER
+    INCREMENTALITY_OFF = _pywraplp.MPSolverParameters_INCREMENTALITY_OFF
+    INCREMENTALITY_ON = _pywraplp.MPSolverParameters_INCREMENTALITY_ON
+    SCALING_OFF = _pywraplp.MPSolverParameters_SCALING_OFF
+    SCALING_ON = _pywraplp.MPSolverParameters_SCALING_ON
+
+    def __init__(self):
+        _pywraplp.MPSolverParameters_swiginit(self, _pywraplp.new_MPSolverParameters())
+
+    def SetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam', value: 'double') -> "void":
+        return _pywraplp.MPSolverParameters_SetDoubleParam(self, param, value)
+
+    def SetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam', value: 'int') -> "void":
+        return _pywraplp.MPSolverParameters_SetIntegerParam(self, param, value)
+
+    def GetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam') -> "double":
+        return _pywraplp.MPSolverParameters_GetDoubleParam(self, param)
+
+    def GetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam') -> "int":
+        return _pywraplp.MPSolverParameters_GetIntegerParam(self, param)
+    __swig_destroy__ = _pywraplp.delete_MPSolverParameters
+
+# Register MPSolverParameters in _pywraplp:
+_pywraplp.MPSolverParameters_swigregister(MPSolverParameters)
+cvar = _pywraplp.cvar
+MPSolverParameters.kDefaultRelativeMipGap = _pywraplp.cvar.MPSolverParameters_kDefaultRelativeMipGap
+MPSolverParameters.kDefaultPrimalTolerance = _pywraplp.cvar.MPSolverParameters_kDefaultPrimalTolerance
+MPSolverParameters.kDefaultDualTolerance = _pywraplp.cvar.MPSolverParameters_kDefaultDualTolerance
+MPSolverParameters.kDefaultPresolve = _pywraplp.cvar.MPSolverParameters_kDefaultPresolve
+MPSolverParameters.kDefaultIncrementality = _pywraplp.cvar.MPSolverParameters_kDefaultIncrementality
+
+class ModelExportOptions(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+
+    def __init__(self):
+        _pywraplp.ModelExportOptions_swiginit(self, _pywraplp.new_ModelExportOptions())
+    __swig_destroy__ = _pywraplp.delete_ModelExportOptions
+
+# Register ModelExportOptions in _pywraplp:
+_pywraplp.ModelExportOptions_swigregister(ModelExportOptions)
+
+
+def ExportModelAsLpFormat(*args) -> "std::string":
+    return _pywraplp.ExportModelAsLpFormat(*args)
+
+def ExportModelAsMpsFormat(*args) -> "std::string":
+    return _pywraplp.ExportModelAsMpsFormat(*args)
+
+def setup_variable_operator(opname):
+  setattr(Variable, opname,
+          lambda self, *args: getattr(VariableExpr(self), opname)(*args))
+for opname in LinearExpr.OVERRIDDEN_OPERATOR_METHODS:
+  setup_variable_operator(opname)
+
+
+
+
+
+
+
+

Functions

+
+
+def ExportModelAsLpFormat(*args) +
+
+
+
+Source code +
def ExportModelAsLpFormat(*args) -> "std::string":
+    return _pywraplp.ExportModelAsLpFormat(*args)
+
+
+
+def ExportModelAsMpsFormat(*args) +
+
+
+
+Source code +
def ExportModelAsMpsFormat(*args) -> "std::string":
+    return _pywraplp.ExportModelAsMpsFormat(*args)
+
+
+
+def Solver_Infinity() +
+
+
+
+Source code +
def Solver_Infinity() -> "double":
+    return _pywraplp.Solver_Infinity()
+
+
+
+def Solver_SolveWithProto(model_request, response) +
+
+
+
+Source code +
def Solver_SolveWithProto(model_request: 'operations_research::MPModelRequest const &', response: 'operations_research::MPSolutionResponse *') -> "operations_research::MPSolutionResponse *":
+    return _pywraplp.Solver_SolveWithProto(model_request, response)
+
+
+
+def Solver_SupportsProblemType(problem_type) +
+
+
+
+Source code +
def Solver_SupportsProblemType(problem_type: 'operations_research::MPSolver::OptimizationProblemType') -> "bool":
+    return _pywraplp.Solver_SupportsProblemType(problem_type)
+
+
+
+def Solver_infinity() +
+
+
+
+Source code +
def Solver_infinity() -> "double":
+    return _pywraplp.Solver_infinity()
+
+
+
+def setup_variable_operator(opname) +
+
+
+
+Source code +
def setup_variable_operator(opname):
+  setattr(Variable, opname,
+          lambda self, *args: getattr(VariableExpr(self), opname)(*args))
+
+
+
+
+
+

Classes

+
+
+class Constraint +(*args, **kwargs) +
+
+
+
+Source code +
class Constraint(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+    __repr__ = _swig_repr
+
+    def name(self) -> "std::string const &":
+        return _pywraplp.Constraint_name(self)
+
+    def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+        return _pywraplp.Constraint_SetCoefficient(self, var, coeff)
+
+    def GetCoefficient(self, var: 'Variable') -> "double":
+        return _pywraplp.Constraint_GetCoefficient(self, var)
+
+    def lb(self) -> "double":
+        return _pywraplp.Constraint_lb(self)
+
+    def ub(self) -> "double":
+        return _pywraplp.Constraint_ub(self)
+
+    def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+        return _pywraplp.Constraint_SetBounds(self, lb, ub)
+
+    def set_is_lazy(self, laziness: 'bool') -> "void":
+        return _pywraplp.Constraint_set_is_lazy(self, laziness)
+
+    def index(self) -> "int":
+        return _pywraplp.Constraint_index(self)
+
+    def dual_value(self) -> "double":
+        return _pywraplp.Constraint_dual_value(self)
+
+    def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+        return _pywraplp.Constraint_basis_status(self)
+
+    def Lb(self) -> "double":
+        return _pywraplp.Constraint_Lb(self)
+
+    def Ub(self) -> "double":
+        return _pywraplp.Constraint_Ub(self)
+
+    def SetLb(self, x: 'double') -> "void":
+        return _pywraplp.Constraint_SetLb(self, x)
+
+    def SetUb(self, x: 'double') -> "void":
+        return _pywraplp.Constraint_SetUb(self, x)
+
+    def DualValue(self) -> "double":
+        return _pywraplp.Constraint_DualValue(self)
+    __swig_destroy__ = _pywraplp.delete_Constraint
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+

Methods

+
+
+def DualValue(self) +
+
+
+
+Source code +
def DualValue(self) -> "double":
+    return _pywraplp.Constraint_DualValue(self)
+
+
+
+def GetCoefficient(self, var) +
+
+
+
+Source code +
def GetCoefficient(self, var: 'Variable') -> "double":
+    return _pywraplp.Constraint_GetCoefficient(self, var)
+
+
+
+def Lb(self) +
+
+
+
+Source code +
def Lb(self) -> "double":
+    return _pywraplp.Constraint_Lb(self)
+
+
+
+def SetBounds(self, lb, ub) +
+
+
+
+Source code +
def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+    return _pywraplp.Constraint_SetBounds(self, lb, ub)
+
+
+
+def SetCoefficient(self, var, coeff) +
+
+
+
+Source code +
def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+    return _pywraplp.Constraint_SetCoefficient(self, var, coeff)
+
+
+
+def SetLb(self, x) +
+
+
+
+Source code +
def SetLb(self, x: 'double') -> "void":
+    return _pywraplp.Constraint_SetLb(self, x)
+
+
+
+def SetUb(self, x) +
+
+
+
+Source code +
def SetUb(self, x: 'double') -> "void":
+    return _pywraplp.Constraint_SetUb(self, x)
+
+
+
+def Ub(self) +
+
+
+
+Source code +
def Ub(self) -> "double":
+    return _pywraplp.Constraint_Ub(self)
+
+
+
+def basis_status(self) +
+
+
+
+Source code +
def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+    return _pywraplp.Constraint_basis_status(self)
+
+
+
+def dual_value(self) +
+
+
+
+Source code +
def dual_value(self) -> "double":
+    return _pywraplp.Constraint_dual_value(self)
+
+
+
+def index(self) +
+
+
+
+Source code +
def index(self) -> "int":
+    return _pywraplp.Constraint_index(self)
+
+
+
+def lb(self) +
+
+
+
+Source code +
def lb(self) -> "double":
+    return _pywraplp.Constraint_lb(self)
+
+
+
+def name(self) +
+
+
+
+Source code +
def name(self) -> "std::string const &":
+    return _pywraplp.Constraint_name(self)
+
+
+
+def set_is_lazy(self, laziness) +
+
+
+
+Source code +
def set_is_lazy(self, laziness: 'bool') -> "void":
+    return _pywraplp.Constraint_set_is_lazy(self, laziness)
+
+
+
+def ub(self) +
+
+
+
+Source code +
def ub(self) -> "double":
+    return _pywraplp.Constraint_ub(self)
+
+
+
+
+
+class MPSolverParameters +
+
+
+
+Source code +
class MPSolverParameters(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+    RELATIVE_MIP_GAP = _pywraplp.MPSolverParameters_RELATIVE_MIP_GAP
+    PRIMAL_TOLERANCE = _pywraplp.MPSolverParameters_PRIMAL_TOLERANCE
+    DUAL_TOLERANCE = _pywraplp.MPSolverParameters_DUAL_TOLERANCE
+    PRESOLVE = _pywraplp.MPSolverParameters_PRESOLVE
+    LP_ALGORITHM = _pywraplp.MPSolverParameters_LP_ALGORITHM
+    INCREMENTALITY = _pywraplp.MPSolverParameters_INCREMENTALITY
+    SCALING = _pywraplp.MPSolverParameters_SCALING
+    PRESOLVE_OFF = _pywraplp.MPSolverParameters_PRESOLVE_OFF
+    PRESOLVE_ON = _pywraplp.MPSolverParameters_PRESOLVE_ON
+    DUAL = _pywraplp.MPSolverParameters_DUAL
+    PRIMAL = _pywraplp.MPSolverParameters_PRIMAL
+    BARRIER = _pywraplp.MPSolverParameters_BARRIER
+    INCREMENTALITY_OFF = _pywraplp.MPSolverParameters_INCREMENTALITY_OFF
+    INCREMENTALITY_ON = _pywraplp.MPSolverParameters_INCREMENTALITY_ON
+    SCALING_OFF = _pywraplp.MPSolverParameters_SCALING_OFF
+    SCALING_ON = _pywraplp.MPSolverParameters_SCALING_ON
+
+    def __init__(self):
+        _pywraplp.MPSolverParameters_swiginit(self, _pywraplp.new_MPSolverParameters())
+
+    def SetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam', value: 'double') -> "void":
+        return _pywraplp.MPSolverParameters_SetDoubleParam(self, param, value)
+
+    def SetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam', value: 'int') -> "void":
+        return _pywraplp.MPSolverParameters_SetIntegerParam(self, param, value)
+
+    def GetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam') -> "double":
+        return _pywraplp.MPSolverParameters_GetDoubleParam(self, param)
+
+    def GetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam') -> "int":
+        return _pywraplp.MPSolverParameters_GetIntegerParam(self, param)
+    __swig_destroy__ = _pywraplp.delete_MPSolverParameters
+
+

Class variables

+
+
var BARRIER
+
+
+
+
var DUAL
+
+
+
+
var DUAL_TOLERANCE
+
+
+
+
var INCREMENTALITY
+
+
+
+
var INCREMENTALITY_OFF
+
+
+
+
var INCREMENTALITY_ON
+
+
+
+
var LP_ALGORITHM
+
+
+
+
var PRESOLVE
+
+
+
+
var PRESOLVE_OFF
+
+
+
+
var PRESOLVE_ON
+
+
+
+
var PRIMAL
+
+
+
+
var PRIMAL_TOLERANCE
+
+
+
+
var RELATIVE_MIP_GAP
+
+
+
+
var SCALING
+
+
+
+
var SCALING_OFF
+
+
+
+
var SCALING_ON
+
+
+
+
var kDefaultDualTolerance
+
+
+
+
var kDefaultIncrementality
+
+
+
+
var kDefaultPresolve
+
+
+
+
var kDefaultPrimalTolerance
+
+
+
+
var kDefaultRelativeMipGap
+
+
+
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+

Methods

+
+
+def GetDoubleParam(self, param) +
+
+
+
+Source code +
def GetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam') -> "double":
+    return _pywraplp.MPSolverParameters_GetDoubleParam(self, param)
+
+
+
+def GetIntegerParam(self, param) +
+
+
+
+Source code +
def GetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam') -> "int":
+    return _pywraplp.MPSolverParameters_GetIntegerParam(self, param)
+
+
+
+def SetDoubleParam(self, param, value) +
+
+
+
+Source code +
def SetDoubleParam(self, param: 'operations_research::MPSolverParameters::DoubleParam', value: 'double') -> "void":
+    return _pywraplp.MPSolverParameters_SetDoubleParam(self, param, value)
+
+
+
+def SetIntegerParam(self, param, value) +
+
+
+
+Source code +
def SetIntegerParam(self, param: 'operations_research::MPSolverParameters::IntegerParam', value: 'int') -> "void":
+    return _pywraplp.MPSolverParameters_SetIntegerParam(self, param, value)
+
+
+
+
+
+class ModelExportOptions +
+
+
+
+Source code +
class ModelExportOptions(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+
+    def __init__(self):
+        _pywraplp.ModelExportOptions_swiginit(self, _pywraplp.new_ModelExportOptions())
+    __swig_destroy__ = _pywraplp.delete_ModelExportOptions
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+
+
+class Objective +(*args, **kwargs) +
+
+
+
+Source code +
class Objective(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+    __repr__ = _swig_repr
+
+    def Clear(self) -> "void":
+        return _pywraplp.Objective_Clear(self)
+
+    def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+        return _pywraplp.Objective_SetCoefficient(self, var, coeff)
+
+    def GetCoefficient(self, var: 'Variable') -> "double":
+        return _pywraplp.Objective_GetCoefficient(self, var)
+
+    def SetOffset(self, value: 'double') -> "void":
+        return _pywraplp.Objective_SetOffset(self, value)
+
+    def offset(self) -> "double":
+        return _pywraplp.Objective_offset(self)
+
+    def SetOptimizationDirection(self, maximize: 'bool') -> "void":
+        return _pywraplp.Objective_SetOptimizationDirection(self, maximize)
+
+    def SetMinimization(self) -> "void":
+        return _pywraplp.Objective_SetMinimization(self)
+
+    def SetMaximization(self) -> "void":
+        return _pywraplp.Objective_SetMaximization(self)
+
+    def maximization(self) -> "bool":
+        return _pywraplp.Objective_maximization(self)
+
+    def minimization(self) -> "bool":
+        return _pywraplp.Objective_minimization(self)
+
+    def Value(self) -> "double":
+        return _pywraplp.Objective_Value(self)
+
+    def BestBound(self) -> "double":
+        return _pywraplp.Objective_BestBound(self)
+
+    def Offset(self) -> "double":
+        return _pywraplp.Objective_Offset(self)
+    __swig_destroy__ = _pywraplp.delete_Objective
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+

Methods

+
+
+def BestBound(self) +
+
+
+
+Source code +
def BestBound(self) -> "double":
+    return _pywraplp.Objective_BestBound(self)
+
+
+
+def Clear(self) +
+
+
+
+Source code +
def Clear(self) -> "void":
+    return _pywraplp.Objective_Clear(self)
+
+
+
+def GetCoefficient(self, var) +
+
+
+
+Source code +
def GetCoefficient(self, var: 'Variable') -> "double":
+    return _pywraplp.Objective_GetCoefficient(self, var)
+
+
+
+def Offset(self) +
+
+
+
+Source code +
def Offset(self) -> "double":
+    return _pywraplp.Objective_Offset(self)
+
+
+
+def SetCoefficient(self, var, coeff) +
+
+
+
+Source code +
def SetCoefficient(self, var: 'Variable', coeff: 'double') -> "void":
+    return _pywraplp.Objective_SetCoefficient(self, var, coeff)
+
+
+
+def SetMaximization(self) +
+
+
+
+Source code +
def SetMaximization(self) -> "void":
+    return _pywraplp.Objective_SetMaximization(self)
+
+
+
+def SetMinimization(self) +
+
+
+
+Source code +
def SetMinimization(self) -> "void":
+    return _pywraplp.Objective_SetMinimization(self)
+
+
+
+def SetOffset(self, value) +
+
+
+
+Source code +
def SetOffset(self, value: 'double') -> "void":
+    return _pywraplp.Objective_SetOffset(self, value)
+
+
+
+def SetOptimizationDirection(self, maximize) +
+
+
+
+Source code +
def SetOptimizationDirection(self, maximize: 'bool') -> "void":
+    return _pywraplp.Objective_SetOptimizationDirection(self, maximize)
+
+
+
+def Value(self) +
+
+
+
+Source code +
def Value(self) -> "double":
+    return _pywraplp.Objective_Value(self)
+
+
+
+def maximization(self) +
+
+
+
+Source code +
def maximization(self) -> "bool":
+    return _pywraplp.Objective_maximization(self)
+
+
+
+def minimization(self) +
+
+
+
+Source code +
def minimization(self) -> "bool":
+    return _pywraplp.Objective_minimization(self)
+
+
+
+def offset(self) +
+
+
+
+Source code +
def offset(self) -> "double":
+    return _pywraplp.Objective_offset(self)
+
+
+
+
+
+class Solver +(name, problem_type) +
+
+
+
+Source code +
class Solver(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+    __repr__ = _swig_repr
+    CLP_LINEAR_PROGRAMMING = _pywraplp.Solver_CLP_LINEAR_PROGRAMMING
+    GLOP_LINEAR_PROGRAMMING = _pywraplp.Solver_GLOP_LINEAR_PROGRAMMING
+    CBC_MIXED_INTEGER_PROGRAMMING = _pywraplp.Solver_CBC_MIXED_INTEGER_PROGRAMMING
+    BOP_INTEGER_PROGRAMMING = _pywraplp.Solver_BOP_INTEGER_PROGRAMMING
+
+    def __init__(self, name: 'std::string const &', problem_type: 'operations_research::MPSolver::OptimizationProblemType'):
+        _pywraplp.Solver_swiginit(self, _pywraplp.new_Solver(name, problem_type))
+    __swig_destroy__ = _pywraplp.delete_Solver
+
+    @staticmethod
+    def SupportsProblemType(problem_type: 'operations_research::MPSolver::OptimizationProblemType') -> "bool":
+        return _pywraplp.Solver_SupportsProblemType(problem_type)
+
+    def Clear(self) -> "void":
+        return _pywraplp.Solver_Clear(self)
+
+    def NumVariables(self) -> "int":
+        return _pywraplp.Solver_NumVariables(self)
+
+    def LookupVariable(self, var_name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_LookupVariable(self, var_name)
+
+    def Var(self, lb: 'double', ub: 'double', integer: 'bool', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_Var(self, lb, ub, integer, name)
+
+    def NumVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_NumVar(self, lb, ub, name)
+
+    def IntVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_IntVar(self, lb, ub, name)
+
+    def BoolVar(self, name: 'std::string const &') -> "operations_research::MPVariable *":
+        return _pywraplp.Solver_BoolVar(self, name)
+
+    def NumConstraints(self) -> "int":
+        return _pywraplp.Solver_NumConstraints(self)
+
+    def LookupConstraint(self, constraint_name: 'std::string const &') -> "operations_research::MPConstraint *":
+        return _pywraplp.Solver_LookupConstraint(self, constraint_name)
+
+    def Constraint(self, *args) -> "operations_research::MPConstraint *":
+        return _pywraplp.Solver_Constraint(self, *args)
+
+    def Objective(self) -> "operations_research::MPObjective *":
+        return _pywraplp.Solver_Objective(self)
+    OPTIMAL = _pywraplp.Solver_OPTIMAL
+    FEASIBLE = _pywraplp.Solver_FEASIBLE
+    INFEASIBLE = _pywraplp.Solver_INFEASIBLE
+    UNBOUNDED = _pywraplp.Solver_UNBOUNDED
+    ABNORMAL = _pywraplp.Solver_ABNORMAL
+    NOT_SOLVED = _pywraplp.Solver_NOT_SOLVED
+
+    def Solve(self, *args) -> "operations_research::MPSolver::ResultStatus":
+        return _pywraplp.Solver_Solve(self, *args)
+
+    def ComputeConstraintActivities(self) -> "std::vector< double >":
+        return _pywraplp.Solver_ComputeConstraintActivities(self)
+
+    def VerifySolution(self, tolerance: 'double', log_errors: 'bool') -> "bool":
+        return _pywraplp.Solver_VerifySolution(self, tolerance, log_errors)
+
+    def InterruptSolve(self) -> "bool":
+        return _pywraplp.Solver_InterruptSolve(self)
+
+    def FillSolutionResponseProto(self, response: 'operations_research::MPSolutionResponse *') -> "void":
+        return _pywraplp.Solver_FillSolutionResponseProto(self, response)
+
+    @staticmethod
+    def SolveWithProto(model_request: 'operations_research::MPModelRequest const &', response: 'operations_research::MPSolutionResponse *') -> "operations_research::MPSolutionResponse *":
+        return _pywraplp.Solver_SolveWithProto(model_request, response)
+
+    def ExportModelToProto(self, output_model: 'operations_research::MPModelProto *') -> "void":
+        return _pywraplp.Solver_ExportModelToProto(self, output_model)
+
+    def LoadSolutionFromProto(self, *args) -> "util::Status":
+        return _pywraplp.Solver_LoadSolutionFromProto(self, *args)
+
+    def SetSolverSpecificParametersAsString(self, parameters: 'std::string const &') -> "bool":
+        return _pywraplp.Solver_SetSolverSpecificParametersAsString(self, parameters)
+    FREE = _pywraplp.Solver_FREE
+    AT_LOWER_BOUND = _pywraplp.Solver_AT_LOWER_BOUND
+    AT_UPPER_BOUND = _pywraplp.Solver_AT_UPPER_BOUND
+    FIXED_VALUE = _pywraplp.Solver_FIXED_VALUE
+    BASIC = _pywraplp.Solver_BASIC
+
+    @staticmethod
+    def infinity() -> "double":
+        return _pywraplp.Solver_infinity()
+
+    def EnableOutput(self) -> "void":
+        return _pywraplp.Solver_EnableOutput(self)
+
+    def SuppressOutput(self) -> "void":
+        return _pywraplp.Solver_SuppressOutput(self)
+
+    def iterations(self) -> "int64":
+        return _pywraplp.Solver_iterations(self)
+
+    def nodes(self) -> "int64":
+        return _pywraplp.Solver_nodes(self)
+
+    def ComputeExactConditionNumber(self) -> "double":
+        return _pywraplp.Solver_ComputeExactConditionNumber(self)
+
+    def NextSolution(self) -> "bool":
+        return _pywraplp.Solver_NextSolution(self)
+
+    def set_time_limit(self, time_limit_milliseconds: 'int64') -> "void":
+        return _pywraplp.Solver_set_time_limit(self, time_limit_milliseconds)
+
+    def wall_time(self) -> "int64":
+        return _pywraplp.Solver_wall_time(self)
+
+    def LoadModelFromProto(self, input_model: 'operations_research::MPModelProto const &') -> "std::string":
+        return _pywraplp.Solver_LoadModelFromProto(self, input_model)
+
+    def ExportModelAsLpFormat(self, *args) -> "std::string":
+        return _pywraplp.Solver_ExportModelAsLpFormat(self, *args)
+
+    def ExportModelAsMpsFormat(self, *args) -> "std::string":
+        return _pywraplp.Solver_ExportModelAsMpsFormat(self, *args)
+
+    def SetHint(self, variables: 'std::vector< operations_research::MPVariable * > const &', values: 'std::vector< double > const &') -> "void":
+        return _pywraplp.Solver_SetHint(self, variables, values)
+
+    def SetNumThreads(self, num_theads: 'int') -> "bool":
+        return _pywraplp.Solver_SetNumThreads(self, num_theads)
+
+    def Add(self, constraint, name=''):
+      if isinstance(constraint, bool):
+        if constraint:
+          return self.RowConstraint(0, 0, name)
+        else:
+          return self.RowConstraint(1, 1, name)
+      else:
+        return constraint.Extract(self, name)
+
+    def Sum(self, expr_array):
+      result = SumArray(expr_array)
+      return result
+
+    def RowConstraint(self, *args):
+      return self.Constraint(*args)
+
+    def Minimize(self, expr):
+      objective = self.Objective()
+      objective.Clear()
+      objective.SetMinimization()
+      if isinstance(expr, numbers.Number):
+          objective.SetOffset(expr)
+      else:
+          coeffs = expr.GetCoeffs()
+          objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+          for v, c, in list(coeffs.items()):
+            objective.SetCoefficient(v, float(c))
+
+    def Maximize(self, expr):
+      objective = self.Objective()
+      objective.Clear()
+      objective.SetMaximization()
+      if isinstance(expr, numbers.Number):
+          objective.SetOffset(expr)
+      else:
+          coeffs = expr.GetCoeffs()
+          objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+          for v, c, in list(coeffs.items()):
+            objective.SetCoefficient(v, float(c))
+
+
+    @staticmethod
+    def Infinity() -> "double":
+        return _pywraplp.Solver_Infinity()
+
+    def SetTimeLimit(self, x: 'int64') -> "void":
+        return _pywraplp.Solver_SetTimeLimit(self, x)
+
+    def WallTime(self) -> "int64":
+        return _pywraplp.Solver_WallTime(self)
+
+    def Iterations(self) -> "int64":
+        return _pywraplp.Solver_Iterations(self)
+
+

Class variables

+
+
var ABNORMAL
+
+
+
+
var AT_LOWER_BOUND
+
+
+
+
var AT_UPPER_BOUND
+
+
+
+
var BASIC
+
+
+
+
var BOP_INTEGER_PROGRAMMING
+
+
+
+
var CBC_MIXED_INTEGER_PROGRAMMING
+
+
+
+
var CLP_LINEAR_PROGRAMMING
+
+
+
+
var FEASIBLE
+
+
+
+
var FIXED_VALUE
+
+
+
+
var FREE
+
+
+
+
var GLOP_LINEAR_PROGRAMMING
+
+
+
+
var INFEASIBLE
+
+
+
+
var NOT_SOLVED
+
+
+
+
var OPTIMAL
+
+
+
+
var UNBOUNDED
+
+
+
+
+

Static methods

+
+
+def Infinity() +
+
+
+
+Source code +
@staticmethod
+def Infinity() -> "double":
+    return _pywraplp.Solver_Infinity()
+
+
+
+def SolveWithProto(model_request, response) +
+
+
+
+Source code +
@staticmethod
+def SolveWithProto(model_request: 'operations_research::MPModelRequest const &', response: 'operations_research::MPSolutionResponse *') -> "operations_research::MPSolutionResponse *":
+    return _pywraplp.Solver_SolveWithProto(model_request, response)
+
+
+
+def SupportsProblemType(problem_type) +
+
+
+
+Source code +
@staticmethod
+def SupportsProblemType(problem_type: 'operations_research::MPSolver::OptimizationProblemType') -> "bool":
+    return _pywraplp.Solver_SupportsProblemType(problem_type)
+
+
+
+def infinity() +
+
+
+
+Source code +
@staticmethod
+def infinity() -> "double":
+    return _pywraplp.Solver_infinity()
+
+
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+

Methods

+
+
+def Add(self, constraint, name='') +
+
+
+
+Source code +
def Add(self, constraint, name=''):
+  if isinstance(constraint, bool):
+    if constraint:
+      return self.RowConstraint(0, 0, name)
+    else:
+      return self.RowConstraint(1, 1, name)
+  else:
+    return constraint.Extract(self, name)
+
+
+
+def BoolVar(self, name) +
+
+
+
+Source code +
def BoolVar(self, name: 'std::string const &') -> "operations_research::MPVariable *":
+    return _pywraplp.Solver_BoolVar(self, name)
+
+
+
+def Clear(self) +
+
+
+
+Source code +
def Clear(self) -> "void":
+    return _pywraplp.Solver_Clear(self)
+
+
+
+def ComputeConstraintActivities(self) +
+
+
+
+Source code +
def ComputeConstraintActivities(self) -> "std::vector< double >":
+    return _pywraplp.Solver_ComputeConstraintActivities(self)
+
+
+
+def ComputeExactConditionNumber(self) +
+
+
+
+Source code +
def ComputeExactConditionNumber(self) -> "double":
+    return _pywraplp.Solver_ComputeExactConditionNumber(self)
+
+
+
+def Constraint(self, *args) +
+
+
+
+Source code +
def Constraint(self, *args) -> "operations_research::MPConstraint *":
+    return _pywraplp.Solver_Constraint(self, *args)
+
+
+
+def EnableOutput(self) +
+
+
+
+Source code +
def EnableOutput(self) -> "void":
+    return _pywraplp.Solver_EnableOutput(self)
+
+
+
+def ExportModelAsLpFormat(self, *args) +
+
+
+
+Source code +
def ExportModelAsLpFormat(self, *args) -> "std::string":
+    return _pywraplp.Solver_ExportModelAsLpFormat(self, *args)
+
+
+
+def ExportModelAsMpsFormat(self, *args) +
+
+
+
+Source code +
def ExportModelAsMpsFormat(self, *args) -> "std::string":
+    return _pywraplp.Solver_ExportModelAsMpsFormat(self, *args)
+
+
+
+def ExportModelToProto(self, output_model) +
+
+
+
+Source code +
def ExportModelToProto(self, output_model: 'operations_research::MPModelProto *') -> "void":
+    return _pywraplp.Solver_ExportModelToProto(self, output_model)
+
+
+
+def FillSolutionResponseProto(self, response) +
+
+
+
+Source code +
def FillSolutionResponseProto(self, response: 'operations_research::MPSolutionResponse *') -> "void":
+    return _pywraplp.Solver_FillSolutionResponseProto(self, response)
+
+
+
+def IntVar(self, lb, ub, name) +
+
+
+
+Source code +
def IntVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+    return _pywraplp.Solver_IntVar(self, lb, ub, name)
+
+
+
+def InterruptSolve(self) +
+
+
+
+Source code +
def InterruptSolve(self) -> "bool":
+    return _pywraplp.Solver_InterruptSolve(self)
+
+
+
+def Iterations(self) +
+
+
+
+Source code +
def Iterations(self) -> "int64":
+    return _pywraplp.Solver_Iterations(self)
+
+
+
+def LoadModelFromProto(self, input_model) +
+
+
+
+Source code +
def LoadModelFromProto(self, input_model: 'operations_research::MPModelProto const &') -> "std::string":
+    return _pywraplp.Solver_LoadModelFromProto(self, input_model)
+
+
+
+def LoadSolutionFromProto(self, *args) +
+
+
+
+Source code +
def LoadSolutionFromProto(self, *args) -> "util::Status":
+    return _pywraplp.Solver_LoadSolutionFromProto(self, *args)
+
+
+
+def LookupConstraint(self, constraint_name) +
+
+
+
+Source code +
def LookupConstraint(self, constraint_name: 'std::string const &') -> "operations_research::MPConstraint *":
+    return _pywraplp.Solver_LookupConstraint(self, constraint_name)
+
+
+
+def LookupVariable(self, var_name) +
+
+
+
+Source code +
def LookupVariable(self, var_name: 'std::string const &') -> "operations_research::MPVariable *":
+    return _pywraplp.Solver_LookupVariable(self, var_name)
+
+
+
+def Maximize(self, expr) +
+
+
+
+Source code +
def Maximize(self, expr):
+  objective = self.Objective()
+  objective.Clear()
+  objective.SetMaximization()
+  if isinstance(expr, numbers.Number):
+      objective.SetOffset(expr)
+  else:
+      coeffs = expr.GetCoeffs()
+      objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+      for v, c, in list(coeffs.items()):
+        objective.SetCoefficient(v, float(c))
+
+
+
+def Minimize(self, expr) +
+
+
+
+Source code +
def Minimize(self, expr):
+  objective = self.Objective()
+  objective.Clear()
+  objective.SetMinimization()
+  if isinstance(expr, numbers.Number):
+      objective.SetOffset(expr)
+  else:
+      coeffs = expr.GetCoeffs()
+      objective.SetOffset(coeffs.pop(OFFSET_KEY, 0.0))
+      for v, c, in list(coeffs.items()):
+        objective.SetCoefficient(v, float(c))
+
+
+
+def NextSolution(self) +
+
+
+
+Source code +
def NextSolution(self) -> "bool":
+    return _pywraplp.Solver_NextSolution(self)
+
+
+
+def NumConstraints(self) +
+
+
+
+Source code +
def NumConstraints(self) -> "int":
+    return _pywraplp.Solver_NumConstraints(self)
+
+
+
+def NumVar(self, lb, ub, name) +
+
+
+
+Source code +
def NumVar(self, lb: 'double', ub: 'double', name: 'std::string const &') -> "operations_research::MPVariable *":
+    return _pywraplp.Solver_NumVar(self, lb, ub, name)
+
+
+
+def NumVariables(self) +
+
+
+
+Source code +
def NumVariables(self) -> "int":
+    return _pywraplp.Solver_NumVariables(self)
+
+
+
+def Objective(self) +
+
+
+
+Source code +
def Objective(self) -> "operations_research::MPObjective *":
+    return _pywraplp.Solver_Objective(self)
+
+
+
+def RowConstraint(self, *args) +
+
+
+
+Source code +
def RowConstraint(self, *args):
+  return self.Constraint(*args)
+
+
+
+def SetHint(self, variables, values) +
+
+
+
+Source code +
def SetHint(self, variables: 'std::vector< operations_research::MPVariable * > const &', values: 'std::vector< double > const &') -> "void":
+    return _pywraplp.Solver_SetHint(self, variables, values)
+
+
+
+def SetNumThreads(self, num_theads) +
+
+
+
+Source code +
def SetNumThreads(self, num_theads: 'int') -> "bool":
+    return _pywraplp.Solver_SetNumThreads(self, num_theads)
+
+
+
+def SetSolverSpecificParametersAsString(self, parameters) +
+
+
+
+Source code +
def SetSolverSpecificParametersAsString(self, parameters: 'std::string const &') -> "bool":
+    return _pywraplp.Solver_SetSolverSpecificParametersAsString(self, parameters)
+
+
+
+def SetTimeLimit(self, x) +
+
+
+
+Source code +
def SetTimeLimit(self, x: 'int64') -> "void":
+    return _pywraplp.Solver_SetTimeLimit(self, x)
+
+
+
+def Solve(self, *args) +
+
+
+
+Source code +
def Solve(self, *args) -> "operations_research::MPSolver::ResultStatus":
+    return _pywraplp.Solver_Solve(self, *args)
+
+
+
+def Sum(self, expr_array) +
+
+
+
+Source code +
def Sum(self, expr_array):
+  result = SumArray(expr_array)
+  return result
+
+
+
+def SuppressOutput(self) +
+
+
+
+Source code +
def SuppressOutput(self) -> "void":
+    return _pywraplp.Solver_SuppressOutput(self)
+
+
+
+def Var(self, lb, ub, integer, name) +
+
+
+
+Source code +
def Var(self, lb: 'double', ub: 'double', integer: 'bool', name: 'std::string const &') -> "operations_research::MPVariable *":
+    return _pywraplp.Solver_Var(self, lb, ub, integer, name)
+
+
+
+def VerifySolution(self, tolerance, log_errors) +
+
+
+
+Source code +
def VerifySolution(self, tolerance: 'double', log_errors: 'bool') -> "bool":
+    return _pywraplp.Solver_VerifySolution(self, tolerance, log_errors)
+
+
+
+def WallTime(self) +
+
+
+
+Source code +
def WallTime(self) -> "int64":
+    return _pywraplp.Solver_WallTime(self)
+
+
+
+def iterations(self) +
+
+
+
+Source code +
def iterations(self) -> "int64":
+    return _pywraplp.Solver_iterations(self)
+
+
+
+def nodes(self) +
+
+
+
+Source code +
def nodes(self) -> "int64":
+    return _pywraplp.Solver_nodes(self)
+
+
+
+def set_time_limit(self, time_limit_milliseconds) +
+
+
+
+Source code +
def set_time_limit(self, time_limit_milliseconds: 'int64') -> "void":
+    return _pywraplp.Solver_set_time_limit(self, time_limit_milliseconds)
+
+
+
+def wall_time(self) +
+
+
+
+Source code +
def wall_time(self) -> "int64":
+    return _pywraplp.Solver_wall_time(self)
+
+
+
+
+
+class Variable +(*args, **kwargs) +
+
+
+
+Source code +
class Variable(object):
+    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+    def __init__(self, *args, **kwargs):
+        raise AttributeError("No constructor defined")
+
+    def name(self) -> "std::string const &":
+        return _pywraplp.Variable_name(self)
+
+    def integer(self) -> "bool":
+        return _pywraplp.Variable_integer(self)
+
+    def solution_value(self) -> "double":
+        return _pywraplp.Variable_solution_value(self)
+
+    def index(self) -> "int":
+        return _pywraplp.Variable_index(self)
+
+    def lb(self) -> "double":
+        return _pywraplp.Variable_lb(self)
+
+    def ub(self) -> "double":
+        return _pywraplp.Variable_ub(self)
+
+    def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+        return _pywraplp.Variable_SetBounds(self, lb, ub)
+
+    def reduced_cost(self) -> "double":
+        return _pywraplp.Variable_reduced_cost(self)
+
+    def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+        return _pywraplp.Variable_basis_status(self)
+
+    def __str__(self) -> "std::string":
+        return _pywraplp.Variable___str__(self)
+
+    def __repr__(self) -> "std::string":
+        return _pywraplp.Variable___repr__(self)
+
+    def __getattr__(self, name):
+      return getattr(VariableExpr(self), name)
+
+
+    def SolutionValue(self) -> "double":
+        return _pywraplp.Variable_SolutionValue(self)
+
+    def Integer(self) -> "bool":
+        return _pywraplp.Variable_Integer(self)
+
+    def Lb(self) -> "double":
+        return _pywraplp.Variable_Lb(self)
+
+    def Ub(self) -> "double":
+        return _pywraplp.Variable_Ub(self)
+
+    def SetLb(self, x: 'double') -> "void":
+        return _pywraplp.Variable_SetLb(self, x)
+
+    def SetUb(self, x: 'double') -> "void":
+        return _pywraplp.Variable_SetUb(self, x)
+
+    def ReducedCost(self) -> "double":
+        return _pywraplp.Variable_ReducedCost(self)
+    __swig_destroy__ = _pywraplp.delete_Variable
+
+

Instance variables

+
+
var thisown
+
+

The membership flag

+
+Source code +
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+
+
+
+

Methods

+
+
+def Integer(self) +
+
+
+
+Source code +
def Integer(self) -> "bool":
+    return _pywraplp.Variable_Integer(self)
+
+
+
+def Lb(self) +
+
+
+
+Source code +
def Lb(self) -> "double":
+    return _pywraplp.Variable_Lb(self)
+
+
+
+def ReducedCost(self) +
+
+
+
+Source code +
def ReducedCost(self) -> "double":
+    return _pywraplp.Variable_ReducedCost(self)
+
+
+
+def SetBounds(self, lb, ub) +
+
+
+
+Source code +
def SetBounds(self, lb: 'double', ub: 'double') -> "void":
+    return _pywraplp.Variable_SetBounds(self, lb, ub)
+
+
+
+def SetLb(self, x) +
+
+
+
+Source code +
def SetLb(self, x: 'double') -> "void":
+    return _pywraplp.Variable_SetLb(self, x)
+
+
+
+def SetUb(self, x) +
+
+
+
+Source code +
def SetUb(self, x: 'double') -> "void":
+    return _pywraplp.Variable_SetUb(self, x)
+
+
+
+def SolutionValue(self) +
+
+
+
+Source code +
def SolutionValue(self) -> "double":
+    return _pywraplp.Variable_SolutionValue(self)
+
+
+
+def Ub(self) +
+
+
+
+Source code +
def Ub(self) -> "double":
+    return _pywraplp.Variable_Ub(self)
+
+
+
+def basis_status(self) +
+
+
+
+Source code +
def basis_status(self) -> "operations_research::MPSolver::BasisStatus":
+    return _pywraplp.Variable_basis_status(self)
+
+
+
+def index(self) +
+
+
+
+Source code +
def index(self) -> "int":
+    return _pywraplp.Variable_index(self)
+
+
+
+def integer(self) +
+
+
+
+Source code +
def integer(self) -> "bool":
+    return _pywraplp.Variable_integer(self)
+
+
+
+def lb(self) +
+
+
+
+Source code +
def lb(self) -> "double":
+    return _pywraplp.Variable_lb(self)
+
+
+
+def name(self) +
+
+
+
+Source code +
def name(self) -> "std::string const &":
+    return _pywraplp.Variable_name(self)
+
+
+
+def reduced_cost(self) +
+
+
+
+Source code +
def reduced_cost(self) -> "double":
+    return _pywraplp.Variable_reduced_cost(self)
+
+
+
+def solution_value(self) +
+
+
+
+Source code +
def solution_value(self) -> "double":
+    return _pywraplp.Variable_solution_value(self)
+
+
+
+def ub(self) +
+
+
+
+Source code +
def ub(self) -> "double":
+    return _pywraplp.Variable_ub(self)
+
+
+
+
+
+
+
+ +
+ + + + + \ No newline at end of file diff --git a/docs/python/ortools/sat/python/cp_model.html b/docs/python/ortools/sat/python/cp_model.html index 8474938065..dc8253e959 100644 --- a/docs/python/ortools/sat/python/cp_model.html +++ b/docs/python/ortools/sat/python/cp_model.html @@ -29,29 +29,30 @@ a:link { color: #46641e; text-decoration: none}

The following two sections describe the main methods for building and solving CP-SAT models.

The following methods implement callbacks that the solver calls each time it finds a new solution.

Additional methods for solving CP-SAT models:

Other methods and functions listed are primarily used for developing OR-Tools, rather than for solving specific optimization problems.

@@ -74,29 +75,30 @@ rather than for solving specific optimization problems.

The following two sections describe the main methods for building and solving CP-SAT models. -* [`CpModel`](#ortools.sat.python.cp_model.CpModel): Methods for creating +* [`CpModel`](#cp_model.CpModel): Methods for creating models, including variables and constraints. -* [`CPSolver`](#ortools.sat.python.cp_model.CpSolver): Methods for solving +* [`CPSolver`](#cp_model.CpSolver): Methods for solving a model and evaluating solutions. The following methods implement callbacks that the solver calls each time it finds a new solution. -* [`CpSolverSolutionCallback`](#cpsolversolutioncallback): A general method for - implementing callbacks. -* [`ObjectiveSolutionPrinter`](#objectivesolutionprinter): Print objective - values and elapsed time for intermediate solutions. -* [`VarArraySolutionPrinter`](#vararraysolutionprinter): Print intermediate - solutions (variable values, time). -* [`VarArrayAndObjectiveSolutionPrinter`](#vararrayandobjectivesolutionprinter): +* [`CpSolverSolutionCallback`](#cp_model.CpSolverSolutionCallback): + A general method for implementing callbacks. +* [`ObjectiveSolutionPrinter`](#cp_model.ObjectiveSolutionPrinter): + Print objective values and elapsed time for intermediate solutions. +* [`VarArraySolutionPrinter`](#cp_model.VarArraySolutionPrinter): + Print intermediate solutions (variable values, time). +* [`VarArrayAndObjectiveSolutionPrinter`] + (#cp_model.VarArrayAndObjectiveSolutionPrinter): Print both intermediate solutions and objective values. Additional methods for solving CP-SAT models: -* [`Constraint`](#constraint): A few utility methods for modifying +* [`Constraint`](#cp_model.Constraint): A few utility methods for modifying contraints created by `CpModel`. -* [`LinearExpr`](#linearexpr): Methods for creating constraints and the - objective from large arrays. +* [`LinearExpr`](#lineacp_model.LinearExpr): Methods for creating constraints + and the objective from large arrays of coefficients. Other methods and functions listed are primarily used for developing OR-Tools, rather than for solving specific optimization problems. @@ -120,6 +122,8 @@ from ortools.util import sorted_interval_list Domain = sorted_interval_list.Domain # Documentation cleaning. +# Remove the documentation of some functions. +# See https://pdoc3.github.io/pdoc/doc/pdoc/#overriding-docstrings-with- __pdoc__ = {} __pdoc__['DisplayBounds'] = False __pdoc__['EvaluateLinearExpr'] = False diff --git a/docs/python/ortools/util/sorted_interval_list.html b/docs/python/ortools/util/sorted_interval_list.html index 3e0cb6e282..2c8eb88124 100644 --- a/docs/python/ortools/util/sorted_interval_list.html +++ b/docs/python/ortools/util/sorted_interval_list.html @@ -34,6 +34,8 @@ a:link { color: #46641e; text-decoration: none} # the SWIG interface file instead. +# Remove the documentation of some functions. +# See https://pdoc3.github.io/pdoc/doc/pdoc/#overriding-docstrings-with- __pdoc__ = {} __pdoc__['Domain_AllValues'] = False __pdoc__['Domain_FromFlatIntervals'] = False @@ -130,98 +132,65 @@ class _SwigNonDynamicMeta(type): class Domain(object): - r""" We call "domain" any subset of Int64 = [kint64min, kint64max]. This class can be used to represent such set efficiently as a sorted and non-adjacent list of intervals. This is efficient as long as the size of such list stays reasonable. In the comments below, the domain of *this will always be written 'D'. Note that all the functions are safe with respect to integer overflow.""" - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): - r""" - *Overload 1:* - By default, Domain will be empty. - - | - - *Overload 2:* - Constructor for the common case of a singleton domain. - - | - - *Overload 3:* - Constructor for the common case of a single interval [left, right]. If left > right, this will result in the empty domain. - """ _sorted_interval_list.Domain_swiginit(self, _sorted_interval_list.new_Domain(*args)) @staticmethod def AllValues() -> "operations_research::Domain": - r""" Returns the full domain Int64.""" return _sorted_interval_list.Domain_AllValues() @staticmethod def FromValues(values: 'std::vector< int64 >') -> "operations_research::Domain": - r""" Creates a domain from the union of an unsorted list of integer values. Input values may be repeated, with no consequence on the output""" return _sorted_interval_list.Domain_FromValues(values) @staticmethod def FromIntervals(intervals: 'std::vector< std::vector< int64 > > const &') -> "operations_research::Domain": - r""" This method is available in Python, Java and .NET. It allows building a Domain object from a list of intervals (long[][] in Java and .NET, [[0, 2], [5, 5], [8, 10]] in python).""" return _sorted_interval_list.Domain_FromIntervals(intervals) @staticmethod def FromFlatIntervals(flat_intervals: 'std::vector< int64 > const &') -> "operations_research::Domain": - r""" This method is available in Python, Java and .NET. It allows building a Domain object from a flattened list of intervals (long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python).""" return _sorted_interval_list.Domain_FromFlatIntervals(flat_intervals) def FlattenedIntervals(self) -> "std::vector< int64 >": - r""" This method returns the flattened list of interval bounds of the domain. Thus the domain {0, 1, 2, 5, 8, 9, 10} will return [0, 2, 5, 5, 8, 10] (as a C++ std::vector<int64>, as a java or C# long[], as a python list of integers).""" return _sorted_interval_list.Domain_FlattenedIntervals(self) def IsEmpty(self) -> "bool": - r""" Returns true if this is the empty set.""" return _sorted_interval_list.Domain_IsEmpty(self) def Size(self) -> "int64": - r""" Returns the number of elements in the domain. It is capped at kint64max.""" return _sorted_interval_list.Domain_Size(self) def Min(self) -> "int64": - r""" Returns the domain min value. It checks that the domain is not empty.""" return _sorted_interval_list.Domain_Min(self) def Max(self) -> "int64": - r""" Returns the domain max value. It checks that the domain is not empty.""" return _sorted_interval_list.Domain_Max(self) def Contains(self, value: 'int64') -> "bool": - r""" Returns true iff value is in Domain.""" return _sorted_interval_list.Domain_Contains(self, value) def Complement(self) -> "operations_research::Domain": - r""" Returns the set Int64 ∖ D.""" return _sorted_interval_list.Domain_Complement(self) def Negation(self) -> "operations_research::Domain": - r""" Returns {x ∈ Int64, ∃ e ∈ D, x = -e}. Note in particular that if the negation of Int64 is not Int64 but Int64 \ {kint64min} !!""" return _sorted_interval_list.Domain_Negation(self) def IntersectionWith(self, domain: 'Domain') -> "operations_research::Domain": - r""" Returns the set D ∩ domain.""" return _sorted_interval_list.Domain_IntersectionWith(self, domain) def UnionWith(self, domain: 'Domain') -> "operations_research::Domain": - r""" Returns the set D ∪ domain.""" return _sorted_interval_list.Domain_UnionWith(self, domain) def AdditionWith(self, domain: 'Domain') -> "operations_research::Domain": - r""" Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.""" return _sorted_interval_list.Domain_AdditionWith(self, domain) def __str__(self) -> "std::string": - r""" Returns a compact std::string of a vector of intervals like "[1,4][6][10,20]".""" return _sorted_interval_list.Domain___str__(self) def __lt__(self, other: 'Domain') -> "bool": - r""" Lexicographic order on the intervals() representation.""" return _sorted_interval_list.Domain___lt__(self, other) def __eq__(self, other: 'Domain') -> "bool": @@ -235,19 +204,15 @@ class Domain(object): _sorted_interval_list.Domain_swigregister(Domain) def Domain_AllValues() -> "operations_research::Domain": - r""" Returns the full domain Int64.""" return _sorted_interval_list.Domain_AllValues() def Domain_FromValues(values: 'std::vector< int64 >') -> "operations_research::Domain": - r""" Creates a domain from the union of an unsorted list of integer values. Input values may be repeated, with no consequence on the output""" return _sorted_interval_list.Domain_FromValues(values) def Domain_FromIntervals(intervals: 'std::vector< std::vector< int64 > > const &') -> "operations_research::Domain": - r""" This method is available in Python, Java and .NET. It allows building a Domain object from a list of intervals (long[][] in Java and .NET, [[0, 2], [5, 5], [8, 10]] in python).""" return _sorted_interval_list.Domain_FromIntervals(intervals) def Domain_FromFlatIntervals(flat_intervals: 'std::vector< int64 > const &') -> "operations_research::Domain": - r""" This method is available in Python, Java and .NET. It allows building a Domain object from a flattened list of intervals (long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python).""" return _sorted_interval_list.Domain_FromFlatIntervals(flat_intervals) @@ -269,110 +234,69 @@ def __lshift__(*args) -> "std::ostream &": (*args)
-

We call "domain" any subset of Int64 = [kint64min, kint64max]. This class can be used to represent such set efficiently as a sorted and non-adjacent list of intervals. This is efficient as long as the size of such list stays reasonable. In the comments below, the domain of *this will always be written 'D'. Note that all the functions are safe with respect to integer overflow.

-

Overload 1: -By default, Domain will be empty.

-

|

-

Overload 2: -Constructor for the common case of a singleton domain.

-

|

-

Overload 3: -Constructor for the common case of a single interval [left, right]. If left > right, this will result in the empty domain.

+
Source code
class Domain(object):
-    r""" We call "domain" any subset of Int64 = [kint64min, kint64max]. This class can be used to represent such set efficiently as a sorted and non-adjacent list of intervals. This is efficient as long as the size of such list stays reasonable. In the comments below, the domain of *this will always be written 'D'. Note that all the functions are safe with respect to integer overflow."""
-
     thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
 
     def __init__(self, *args):
-        r"""
-        *Overload 1:*
-        By default, Domain will be empty.
-
-        |
-
-        *Overload 2:*
-        Constructor for the common case of a singleton domain.
-
-        |
-
-        *Overload 3:*
-        Constructor for the common case of a single interval [left, right]. If left > right, this will result in the empty domain.
-        """
         _sorted_interval_list.Domain_swiginit(self, _sorted_interval_list.new_Domain(*args))
 
     @staticmethod
     def AllValues() -> "operations_research::Domain":
-        r""" Returns the full domain Int64."""
         return _sorted_interval_list.Domain_AllValues()
 
     @staticmethod
     def FromValues(values: 'std::vector< int64 >') -> "operations_research::Domain":
-        r""" Creates a domain from the union of an unsorted list of integer values. Input values may be repeated, with no consequence on the output"""
         return _sorted_interval_list.Domain_FromValues(values)
 
     @staticmethod
     def FromIntervals(intervals: 'std::vector< std::vector< int64 > > const &') -> "operations_research::Domain":
-        r""" This method is available in Python, Java and .NET. It allows building a Domain object from a list of intervals (long[][] in Java and .NET, [[0, 2], [5, 5], [8, 10]] in python)."""
         return _sorted_interval_list.Domain_FromIntervals(intervals)
 
     @staticmethod
     def FromFlatIntervals(flat_intervals: 'std::vector< int64 > const &') -> "operations_research::Domain":
-        r""" This method is available in Python, Java and .NET. It allows building a Domain object from a flattened list of intervals (long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python)."""
         return _sorted_interval_list.Domain_FromFlatIntervals(flat_intervals)
 
     def FlattenedIntervals(self) -> "std::vector< int64 >":
-        r""" This method returns the flattened list of interval bounds of the domain. Thus the domain {0, 1, 2, 5, 8, 9, 10} will return [0, 2, 5, 5, 8, 10] (as a C++ std::vector<int64>, as a java or C# long[], as a python list of integers)."""
         return _sorted_interval_list.Domain_FlattenedIntervals(self)
 
     def IsEmpty(self) -> "bool":
-        r""" Returns true if this is the empty set."""
         return _sorted_interval_list.Domain_IsEmpty(self)
 
     def Size(self) -> "int64":
-        r""" Returns the number of elements in the domain. It is capped at kint64max."""
         return _sorted_interval_list.Domain_Size(self)
 
     def Min(self) -> "int64":
-        r""" Returns the domain min value. It checks that the domain is not empty."""
         return _sorted_interval_list.Domain_Min(self)
 
     def Max(self) -> "int64":
-        r""" Returns the domain max value. It checks that the domain is not empty."""
         return _sorted_interval_list.Domain_Max(self)
 
     def Contains(self, value: 'int64') -> "bool":
-        r""" Returns true iff value is in Domain."""
         return _sorted_interval_list.Domain_Contains(self, value)
 
     def Complement(self) -> "operations_research::Domain":
-        r""" Returns the set Int64 ∖ D."""
         return _sorted_interval_list.Domain_Complement(self)
 
     def Negation(self) -> "operations_research::Domain":
-        r""" Returns {x ∈ Int64, ∃ e ∈ D, x = -e}. Note in particular that if the negation of Int64 is not Int64 but Int64 \ {kint64min} !!"""
         return _sorted_interval_list.Domain_Negation(self)
 
     def IntersectionWith(self, domain: 'Domain') -> "operations_research::Domain":
-        r""" Returns the set D ∩ domain."""
         return _sorted_interval_list.Domain_IntersectionWith(self, domain)
 
     def UnionWith(self, domain: 'Domain') -> "operations_research::Domain":
-        r""" Returns the set D ∪ domain."""
         return _sorted_interval_list.Domain_UnionWith(self, domain)
 
     def AdditionWith(self, domain: 'Domain') -> "operations_research::Domain":
-        r""" Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}."""
         return _sorted_interval_list.Domain_AdditionWith(self, domain)
 
     def __str__(self) -> "std::string":
-        r""" Returns a compact std::string of a vector of intervals like "[1,4][6][10,20]"."""
         return _sorted_interval_list.Domain___str__(self)
 
     def __lt__(self, other: 'Domain') -> "bool":
-        r""" Lexicographic order on the intervals() representation."""
         return _sorted_interval_list.Domain___lt__(self, other)
 
     def __eq__(self, other: 'Domain') -> "bool":
@@ -388,12 +312,11 @@ Constructor for the common case of a single interval [left, right]. If left >
 def AllValues()
 
 
-

Returns the full domain Int64.

+
Source code
@staticmethod
 def AllValues() -> "operations_research::Domain":
-    r""" Returns the full domain Int64."""
     return _sorted_interval_list.Domain_AllValues()
@@ -401,12 +324,11 @@ def AllValues() -> "operations_research::Domain": def FromFlatIntervals(flat_intervals)
-

This method is available in Python, Java and .NET. It allows building a Domain object from a flattened list of intervals (long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python).

+
Source code
@staticmethod
 def FromFlatIntervals(flat_intervals: 'std::vector< int64 > const &') -> "operations_research::Domain":
-    r""" This method is available in Python, Java and .NET. It allows building a Domain object from a flattened list of intervals (long[] in Java and .NET, [0, 2, 5, 5, 8, 10] in python)."""
     return _sorted_interval_list.Domain_FromFlatIntervals(flat_intervals)
@@ -414,12 +336,11 @@ def FromFlatIntervals(flat_intervals: 'std::vector< int64 > const & def FromIntervals(intervals)
-

This method is available in Python, Java and .NET. It allows building a Domain object from a list of intervals (long[][] in Java and .NET, [[0, 2], [5, 5], [8, 10]] in python).

+
Source code
@staticmethod
 def FromIntervals(intervals: 'std::vector< std::vector< int64 > > const &') -> "operations_research::Domain":
-    r""" This method is available in Python, Java and .NET. It allows building a Domain object from a list of intervals (long[][] in Java and .NET, [[0, 2], [5, 5], [8, 10]] in python)."""
     return _sorted_interval_list.Domain_FromIntervals(intervals)
@@ -427,12 +348,11 @@ def FromIntervals(intervals: 'std::vector< std::vector< int64 > > def FromValues(values)
-

Creates a domain from the union of an unsorted list of integer values. Input values may be repeated, with no consequence on the output

+
Source code
@staticmethod
 def FromValues(values: 'std::vector< int64 >') -> "operations_research::Domain":
-    r""" Creates a domain from the union of an unsorted list of integer values. Input values may be repeated, with no consequence on the output"""
     return _sorted_interval_list.Domain_FromValues(values)
@@ -443,11 +363,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def AdditionWith(self, domain)
-

Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}.

+
Source code
def AdditionWith(self, domain: 'Domain') -> "operations_research::Domain":
-    r""" Returns {x ∈ Int64, ∃ a ∈ D, ∃ b ∈ domain, x = a + b}."""
     return _sorted_interval_list.Domain_AdditionWith(self, domain)
@@ -455,11 +374,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Complement(self)
-

Returns the set Int64 ∖ D.

+
Source code
def Complement(self) -> "operations_research::Domain":
-    r""" Returns the set Int64 ∖ D."""
     return _sorted_interval_list.Domain_Complement(self)
@@ -467,11 +385,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Contains(self, value)
-

Returns true iff value is in Domain.

+
Source code
def Contains(self, value: 'int64') -> "bool":
-    r""" Returns true iff value is in Domain."""
     return _sorted_interval_list.Domain_Contains(self, value)
@@ -479,11 +396,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def FlattenedIntervals(self)
-

This method returns the flattened list of interval bounds of the domain. Thus the domain {0, 1, 2, 5, 8, 9, 10} will return [0, 2, 5, 5, 8, 10] (as a C++ std::vector, as a java or C# long[], as a python list of integers).

+
Source code
def FlattenedIntervals(self) -> "std::vector< int64 >":
-    r""" This method returns the flattened list of interval bounds of the domain. Thus the domain {0, 1, 2, 5, 8, 9, 10} will return [0, 2, 5, 5, 8, 10] (as a C++ std::vector<int64>, as a java or C# long[], as a python list of integers)."""
     return _sorted_interval_list.Domain_FlattenedIntervals(self)
@@ -491,11 +407,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def IntersectionWith(self, domain)
-

Returns the set D ∩ domain.

+
Source code
def IntersectionWith(self, domain: 'Domain') -> "operations_research::Domain":
-    r""" Returns the set D ∩ domain."""
     return _sorted_interval_list.Domain_IntersectionWith(self, domain)
@@ -503,11 +418,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def IsEmpty(self)
-

Returns true if this is the empty set.

+
Source code
def IsEmpty(self) -> "bool":
-    r""" Returns true if this is the empty set."""
     return _sorted_interval_list.Domain_IsEmpty(self)
@@ -515,11 +429,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Max(self)
-

Returns the domain max value. It checks that the domain is not empty.

+
Source code
def Max(self) -> "int64":
-    r""" Returns the domain max value. It checks that the domain is not empty."""
     return _sorted_interval_list.Domain_Max(self)
@@ -527,11 +440,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Min(self)
-

Returns the domain min value. It checks that the domain is not empty.

+
Source code
def Min(self) -> "int64":
-    r""" Returns the domain min value. It checks that the domain is not empty."""
     return _sorted_interval_list.Domain_Min(self)
@@ -539,11 +451,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Negation(self)
-

Returns {x ∈ Int64, ∃ e ∈ D, x = -e}. Note in particular that if the negation of Int64 is not Int64 but Int64 \ {kint64min} !!

+
Source code
def Negation(self) -> "operations_research::Domain":
-    r""" Returns {x ∈ Int64, ∃ e ∈ D, x = -e}. Note in particular that if the negation of Int64 is not Int64 but Int64 \ {kint64min} !!"""
     return _sorted_interval_list.Domain_Negation(self)
@@ -551,11 +462,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def Size(self)
-

Returns the number of elements in the domain. It is capped at kint64max.

+
Source code
def Size(self) -> "int64":
-    r""" Returns the number of elements in the domain. It is capped at kint64max."""
     return _sorted_interval_list.Domain_Size(self)
@@ -563,11 +473,10 @@ def FromValues(values: 'std::vector< int64 >') -> "operatio def UnionWith(self, domain)
-

Returns the set D ∪ domain.

+
Source code
def UnionWith(self, domain: 'Domain') -> "operations_research::Domain":
-    r""" Returns the set D ∪ domain."""
     return _sorted_interval_list.Domain_UnionWith(self, domain)