This commit is contained in:
Laurent Perron
2019-07-17 08:10:16 -07:00
parent 4276a58400
commit 23657e6744
4 changed files with 66 additions and 72 deletions

View File

@@ -33,25 +33,6 @@ a:link { color: #46641e; text-decoration: none}
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
# Remove the documentation of some functions.
# See https://pdoc3.github.io/pdoc/doc/pdoc/#overriding-docstrings-with-
__pdoc__ = {}
__pdoc__['Solver_infinity'] = False
__pdoc__['Solver_Infinity'] = False
__pdoc__['Solver_SolveWithProto'] = False
__pdoc__['Solver_SupportsProblemType'] = False
__pdoc__['setup_variable_operator'] = False
__pdoc__['Constraint.thisown'] = False
__pdoc__['Constraint.thisown'] = False
__pdoc__['MPSolverParameters.thisown'] = False
__pdoc__['ModelExportOptions.thisown'] = False
__pdoc__['Objective.thisown'] = False
__pdoc__['Solver.thisown'] = False
__pdoc__['Variable.thisown'] = False
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')
@@ -150,6 +131,22 @@ 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
# Remove the documentation of some functions.
# See https://pdoc3.github.io/pdoc/doc/pdoc/#overriding-docstrings-with-
__pdoc__ = {}
__pdoc__['Solver_infinity'] = False
__pdoc__['Solver_Infinity'] = False
__pdoc__['Solver_SolveWithProto'] = False
__pdoc__['Solver_SupportsProblemType'] = False
__pdoc__['setup_variable_operator'] = False
__pdoc__['Constraint.thisown'] = False
__pdoc__['Constraint.thisown'] = False
__pdoc__['MPSolverParameters.thisown'] = False
__pdoc__['ModelExportOptions.thisown'] = False
__pdoc__['Objective.thisown'] = False
__pdoc__['Solver.thisown'] = False
__pdoc__['Variable.thisown'] = False
class Solver(object):
r"""
@@ -449,10 +446,11 @@ class Solver(object):
return _pywraplp.Solver_infinity()
def EnableOutput(self) -> "void":
r""" Enables solver logging."""
return _pywraplp.Solver_EnableOutput(self)
def SuppressOutput(self) -> "void":
r""" Suppress output."""
r""" Suppresses solver logging."""
return _pywraplp.Solver_SuppressOutput(self)
def iterations(self) -> "int64":
@@ -1038,6 +1036,8 @@ MPSolverParameters.kDefaultPresolve = _pywraplp.cvar.MPSolverParameters_kDefault
MPSolverParameters.kDefaultIncrementality = _pywraplp.cvar.MPSolverParameters_kDefaultIncrementality
class ModelExportOptions(object):
r""" Export options."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
@@ -1719,10 +1719,12 @@ solutions for MIP or the tolerance used during presolve.</p></section>
<span>class <span class="ident">ModelExportOptions</span></span>
</code></dt>
<dd>
<section class="desc"></section>
<section class="desc"><p>Export options.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">class ModelExportOptions(object):
r&#34;&#34;&#34; Export options.&#34;&#34;&#34;
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc=&#39;The membership flag&#39;)
__repr__ = _swig_repr
@@ -2344,10 +2346,11 @@ though which users build and solve problems.</p>
return _pywraplp.Solver_infinity()
def EnableOutput(self) -&gt; &#34;void&#34;:
r&#34;&#34;&#34; Enables solver logging.&#34;&#34;&#34;
return _pywraplp.Solver_EnableOutput(self)
def SuppressOutput(self) -&gt; &#34;void&#34;:
r&#34;&#34;&#34; Suppress output.&#34;&#34;&#34;
r&#34;&#34;&#34; Suppresses solver logging.&#34;&#34;&#34;
return _pywraplp.Solver_SuppressOutput(self)
def iterations(self) -&gt; &#34;int64&#34;:
@@ -2805,10 +2808,11 @@ Creates a named constraint with -infinity and +infinity bounds.</p></section>
<span>def <span class="ident">EnableOutput</span></span>(<span>self)</span>
</code></dt>
<dd>
<section class="desc"></section>
<section class="desc"><p>Enables solver logging.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def EnableOutput(self) -&gt; &#34;void&#34;:
r&#34;&#34;&#34; Enables solver logging.&#34;&#34;&#34;
return _pywraplp.Solver_EnableOutput(self)</code></pre>
</details>
</dd>
@@ -3262,11 +3266,11 @@ Solves the problem using the specified parameter values.</p></section>
<span>def <span class="ident">SuppressOutput</span></span>(<span>self)</span>
</code></dt>
<dd>
<section class="desc"><p>Suppress output.</p></section>
<section class="desc"><p>Suppresses solver logging.</p></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def SuppressOutput(self) -&gt; &#34;void&#34;:
r&#34;&#34;&#34; Suppress output.&#34;&#34;&#34;
r&#34;&#34;&#34; Suppresses solver logging.&#34;&#34;&#34;
return _pywraplp.Solver_SuppressOutput(self)</code></pre>
</details>
</dd>

View File

@@ -236,8 +236,8 @@ class LinearExpr(object):
while to_process: # Flatten to avoid recursion.
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))
@@ -483,8 +483,8 @@ class _ScalProd(LinearExpr):
def __repr__(self):
return &#39;ScalProd([{}], [{}], {})&#39;.format(
&#39;, &#39;.join(map(repr, self.__expressions)),
&#39;, &#39;.join(map(repr, self.__coefficients)), self.__constant)
&#39;, &#39;.join(map(repr, self.__expressions)), &#39;, &#39;.join(
map(repr, self.__coefficients)), self.__constant)
def Expressions(self):
return self.__expressions
@@ -723,14 +723,14 @@ class IntervalVar(object):
if self.__ct.enforcement_literal:
return &#39;%s(start = %s, size = %s, end = %s, is_present = %s)&#39; % (
self.__ct.name, ShortName(self.__model, interval.start),
ShortName(self.__model,
interval.size), ShortName(self.__model, interval.end),
ShortName(self.__model, interval.size),
ShortName(self.__model, interval.end),
ShortName(self.__model, self.__ct.enforcement_literal[0]))
else:
return &#39;%s(start = %s, size = %s, end = %s)&#39; % (
self.__ct.name, ShortName(self.__model, interval.start),
ShortName(self.__model,
interval.size), ShortName(self.__model, interval.end))
ShortName(self.__model, interval.size),
ShortName(self.__model, interval.end))
def Name(self):
return self.__ct.name
@@ -1608,8 +1608,8 @@ def EvaluateBooleanExpression(literal, solution):
else:
return not solution.solution[-index - 1]
else:
raise TypeError(&#39;Cannot interpret %s as a boolean expression.&#39; %
literal)
raise TypeError(
&#39;Cannot interpret %s as a boolean expression.&#39; % literal)
class CpSolver(object):
@@ -1777,8 +1777,8 @@ class CpSolverSolutionCallback(pywrapsat.SolutionCallback):
index = lit.Index()
return self.SolutionBooleanValue(index)
else:
raise TypeError(&#39;Cannot interpret %s as a boolean expression.&#39; %
lit)
raise TypeError(
&#39;Cannot interpret %s as a boolean expression.&#39; % lit)
def Value(self, expression):
&#34;&#34;&#34;Evaluates an linear expression in the current solution.
@@ -1802,8 +1802,8 @@ class CpSolverSolutionCallback(pywrapsat.SolutionCallback):
while to_process:
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))
@@ -1815,8 +1815,8 @@ class CpSolverSolutionCallback(pywrapsat.SolutionCallback):
elif isinstance(expr, IntVar):
value += coef * self.SolutionIntegerValue(expr.Index())
elif isinstance(expr, _NotBooleanVariable):
value += coef * (1 -
self.SolutionIntegerValue(expr.Not().Index()))
value += coef * (
1 - self.SolutionIntegerValue(expr.Not().Index()))
return value
@@ -4898,8 +4898,8 @@ and Value() methods.</p>
index = lit.Index()
return self.SolutionBooleanValue(index)
else:
raise TypeError(&#39;Cannot interpret %s as a boolean expression.&#39; %
lit)
raise TypeError(
&#39;Cannot interpret %s as a boolean expression.&#39; % lit)
def Value(self, expression):
&#34;&#34;&#34;Evaluates an linear expression in the current solution.
@@ -4923,8 +4923,8 @@ and Value() methods.</p>
while to_process:
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))
@@ -4936,8 +4936,8 @@ and Value() methods.</p>
elif isinstance(expr, IntVar):
value += coef * self.SolutionIntegerValue(expr.Index())
elif isinstance(expr, _NotBooleanVariable):
value += coef * (1 -
self.SolutionIntegerValue(expr.Not().Index()))
value += coef * (
1 - self.SolutionIntegerValue(expr.Not().Index()))
return value</code></pre>
</details>
<h3>Ancestors</h3>
@@ -4991,8 +4991,8 @@ Raises:
index = lit.Index()
return self.SolutionBooleanValue(index)
else:
raise TypeError(&#39;Cannot interpret %s as a boolean expression.&#39; %
lit)</code></pre>
raise TypeError(
&#39;Cannot interpret %s as a boolean expression.&#39; % lit)</code></pre>
</details>
</dd>
<dt id="cp_model.CpSolverSolutionCallback.OnSolutionCallback"><code class="name flex">
@@ -5052,8 +5052,8 @@ Raises:
while to_process:
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))
@@ -5065,8 +5065,8 @@ Raises:
elif isinstance(expr, IntVar):
value += coef * self.SolutionIntegerValue(expr.Index())
elif isinstance(expr, _NotBooleanVariable):
value += coef * (1 -
self.SolutionIntegerValue(expr.Not().Index()))
value += coef * (
1 - self.SolutionIntegerValue(expr.Not().Index()))
return value</code></pre>
</details>
</dd>
@@ -5299,14 +5299,14 @@ intervals into the schedule.</p></section>
if self.__ct.enforcement_literal:
return &#39;%s(start = %s, size = %s, end = %s, is_present = %s)&#39; % (
self.__ct.name, ShortName(self.__model, interval.start),
ShortName(self.__model,
interval.size), ShortName(self.__model, interval.end),
ShortName(self.__model, interval.size),
ShortName(self.__model, interval.end),
ShortName(self.__model, self.__ct.enforcement_literal[0]))
else:
return &#39;%s(start = %s, size = %s, end = %s)&#39; % (
self.__ct.name, ShortName(self.__model, interval.start),
ShortName(self.__model,
interval.size), ShortName(self.__model, interval.end))
ShortName(self.__model, interval.size),
ShortName(self.__model, interval.end))
def Name(self):
return self.__ct.name</code></pre>
@@ -5419,8 +5419,8 @@ model.Add(cp_model.LinearExpr.ScalProd(expressions, coefficients) &gt;= 0)
while to_process: # Flatten to avoid recursion.
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))
@@ -5608,8 +5608,8 @@ def Sum(cls, expressions):
while to_process: # Flatten to avoid recursion.
expr, coef = to_process.pop()
if isinstance(expr, _ProductCst):
to_process.append(
(expr.Expression(), coef * expr.Coefficient()))
to_process.append((expr.Expression(),
coef * expr.Coefficient()))
elif isinstance(expr, _SumArray):
for e in expr.Expressions():
to_process.append((e, coef))