diff --git a/docs/python/ortools/sat/python/cp_model.html b/docs/python/ortools/sat/python/cp_model.html index fff54297b3..32a72777de 100644 --- a/docs/python/ortools/sat/python/cp_model.html +++ b/docs/python/ortools/sat/python/cp_model.html @@ -5,7 +5,7 @@ cp_model API documentation - + @@ -21,6 +21,18 @@

Methods for building and solving CP-SAT models.

+

The following sections describe methods for building and solving

+

CP-SAT models, and related tasks:

+
Source code
# Copyright 2010-2018 Google LLC
@@ -35,7 +47,21 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-"""Methods for building and solving CP-SAT models."""
+"""Methods for building and solving CP-SAT models.
+
+The following sections describe methods for building and solving
+
+CP-SAT models, and related tasks:
+
+* [Create model](#ortools.sat.python.cp_model.CpModel): Methods for creating
+models, including variables and constraints.
+* [Solve](#ortools.sat.python.cp_model.CpSolver): Methods for solving
+a model and evaluating solutions.
+* [Solution callback](#ortools.sat.python.cp_model.CpSolverSolutionCallback):
+Create a callback that is invoked every time the solver finds a new solution.
+* [Solution printer](#ortools.sat.python.cp_model.ObjectiveSolutionPrinter):
+Print objective values and elapsed time for intermediate solutions.
+"""
 
 from __future__ import absolute_import
 from __future__ import division
@@ -90,19 +116,6 @@ AUTOMATIC_SEARCH = sat_parameters_pb2.SatParameters.AUTOMATIC_SEARCH
 FIXED_SEARCH = sat_parameters_pb2.SatParameters.FIXED_SEARCH
 PORTFOLIO_SEARCH = sat_parameters_pb2.SatParameters.PORTFOLIO_SEARCH
 LP_SEARCH = sat_parameters_pb2.SatParameters.LP_SEARCH
-"""The following sections describe methods for building and solving
-
-CP-SAT models, and related tasks:
-
-* [Create model](#ortools.sat.python.cp_model.CpModel): Methods for creating
-models, including variables and constraints.
-* [Solve](#ortools.sat.python.cp_model.CpSolver): Methods for solving
-a model and evaluating solutions.
-* [Solution callback](#ortools.sat.python.cp_model.CpSolverSolutionCallback):
-Create a callback that is invoked every time the solver finds a new solution.
-* [Solution printer](#ortools.sat.python.cp_model.ObjectiveSolutionPrinter):
-Print objective values and elapsed time for intermediate solutions.
-"""
 
 
 def DisplayBounds(bounds):
@@ -576,12 +589,6 @@ class Constraint(object):
     def OnlyEnforceIf(self, boolvar):
         """Adds an enforcement literal to the constraint.
 
-    Args:
-        boolvar: A boolean literal or a list of boolean literals.
-
-    Returns:
-        self.
-
     This method adds one or more literals (that is, a boolean variable or its
     negation) as enforcement literals. The conjunction of all these literals
     determines whether the constraint is active or not. It acts as an
@@ -589,6 +596,12 @@ class Constraint(object):
     must be enforced. If it is false, then the constraint is ignored.
 
     BoolOr, BoolAnd, and linear constraints all support enforcement literals.
+
+    Args:
+        boolvar: A boolean literal or a list of boolean literals.
+
+    Returns:
+        self.
     """
 
         if isinstance(boolvar, numbers.Integral) and boolvar == 1:
@@ -936,7 +949,7 @@ class CpModel(object):
 
     Raises:
       ValueError: if transition_variables, final_states, or transition_triples
-      are empty.
+        are empty.
     """
 
         if not transition_variables:
@@ -1807,24 +1820,6 @@ class VarArraySolutionPrinter(CpSolverSolutionCallback):
 
-

Global variables

-
- -
-

The following sections describe methods for building and solving

-

CP-SAT models, and related tasks:

-
    -
  • Create model: Methods for creating -models, including variables and constraints.
  • -
  • Solve: Methods for solving -a model and evaluating solutions.
  • -
  • Solution callback: -Create a callback that is invoked every time the solver finds a new solution.
  • -
  • Solution printer: -Print objective values and elapsed time for intermediate solutions.
  • -
-
-

Functions

@@ -2046,12 +2041,6 @@ model.Add(x + 2 * y == 5).OnlyEnforceIf(b.Not()) def OnlyEnforceIf(self, boolvar): """Adds an enforcement literal to the constraint. - Args: - boolvar: A boolean literal or a list of boolean literals. - - Returns: - self. - This method adds one or more literals (that is, a boolean variable or its negation) as enforcement literals. The conjunction of all these literals determines whether the constraint is active or not. It acts as an @@ -2059,6 +2048,12 @@ model.Add(x + 2 * y == 5).OnlyEnforceIf(b.Not()) must be enforced. If it is false, then the constraint is ignored. BoolOr, BoolAnd, and linear constraints all support enforcement literals. + + Args: + boolvar: A boolean literal or a list of boolean literals. + + Returns: + self. """ if isinstance(boolvar, numbers.Integral) and boolvar == 1: @@ -2101,36 +2096,24 @@ model.Add(x + 2 * y == 5).OnlyEnforceIf(b.Not())

Adds an enforcement literal to the constraint.

+

This method adds one or more literals (that is, a boolean variable or its +negation) as enforcement literals. The conjunction of all these literals +determines whether the constraint is active or not. It acts as an +implication, so if the conjunction is true, it implies that the constraint +must be enforced. If it is false, then the constraint is ignored.

+

BoolOr, BoolAnd, and linear constraints all support enforcement literals.

Args

boolvar
A boolean literal or a list of boolean literals.

Returns

-
-
self.
-
This method adds one or more literals (that is, a boolean variable or its
-
 
-
negation) as enforcement literals. The conjunction of all these literals
-
 
-
determines whether the constraint is active or not. It acts as an
-
 
-
implication, so if the conjunction is true, it implies that the constraint
-
 
-
-

must be enforced. If it is false, then the constraint is ignored.

-

BoolOr, BoolAnd, and linear constraints all support enforcement literals.

+

self.

Source code
def OnlyEnforceIf(self, boolvar):
     """Adds an enforcement literal to the constraint.
 
-Args:
-    boolvar: A boolean literal or a list of boolean literals.
-
-Returns:
-    self.
-
 This method adds one or more literals (that is, a boolean variable or its
 negation) as enforcement literals. The conjunction of all these literals
 determines whether the constraint is active or not. It acts as an
@@ -2138,6 +2121,12 @@ implication, so if the conjunction is true, it implies that the constraint
 must be enforced. If it is false, then the constraint is ignored.
 
 BoolOr, BoolAnd, and linear constraints all support enforcement literals.
+
+Args:
+    boolvar: A boolean literal or a list of boolean literals.
+
+Returns:
+    self.
 """
 
     if isinstance(boolvar, numbers.Integral) and boolvar == 1:
@@ -2443,7 +2432,7 @@ BoolOr, BoolAnd, and linear constraints all support enforcement literals.
 
     Raises:
       ValueError: if transition_variables, final_states, or transition_triples
-      are empty.
+        are empty.
     """
 
         if not transition_variables:
@@ -3176,9 +3165,9 @@ following format (current_state, variable_value, next_state).
 

Raises

ValueError
-
if transition_variables, final_states, or transition_triples
-
-

are empty.

+
if transition_variables, final_states, or transition_triples +are empty.
+
Source code
def AddAutomaton(self, transition_variables, starting_state, final_states,
@@ -3220,7 +3209,7 @@ Returns:
 
 Raises:
   ValueError: if transition_variables, final_states, or transition_triples
-  are empty.
+    are empty.
 """
 
     if not transition_variables:
@@ -5840,11 +5829,6 @@ def Sum(cls, expressions):
 
      -
    • Global variables

      - -
    • Functions

      • DisplayBounds
      • diff --git a/ortools/sat/python/cp_model.py b/ortools/sat/python/cp_model.py index 04aa6529f7..365b529de1 100644 --- a/ortools/sat/python/cp_model.py +++ b/ortools/sat/python/cp_model.py @@ -10,7 +10,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Methods for building and solving CP-SAT models.""" +"""Methods for building and solving CP-SAT models. + +The following sections describe methods for building and solving + +CP-SAT models, and related tasks: + +* [Create model](#ortools.sat.python.cp_model.CpModel): Methods for creating +models, including variables and constraints. +* [Solve](#ortools.sat.python.cp_model.CpSolver): Methods for solving +a model and evaluating solutions. +* [Solution callback](#ortools.sat.python.cp_model.CpSolverSolutionCallback): +Create a callback that is invoked every time the solver finds a new solution. +* [Solution printer](#ortools.sat.python.cp_model.ObjectiveSolutionPrinter): +Print objective values and elapsed time for intermediate solutions. +""" from __future__ import absolute_import from __future__ import division @@ -66,20 +80,6 @@ FIXED_SEARCH = sat_parameters_pb2.SatParameters.FIXED_SEARCH PORTFOLIO_SEARCH = sat_parameters_pb2.SatParameters.PORTFOLIO_SEARCH LP_SEARCH = sat_parameters_pb2.SatParameters.LP_SEARCH -"""The following sections describe methods for building and solving - -CP-SAT models, and related tasks: - -* [Create model](#ortools.sat.python.cp_model.CpModel): Methods for creating -models, including variables and constraints. -* [Solve](#ortools.sat.python.cp_model.CpSolver): Methods for solving -a model and evaluating solutions. -* [Solution callback](#ortools.sat.python.cp_model.CpSolverSolutionCallback): -Create a callback that is invoked every time the solver finds a new solution. -* [Solution printer](#ortools.sat.python.cp_model.ObjectiveSolutionPrinter): -Print objective values and elapsed time for intermediate solutions. -""" - def DisplayBounds(bounds): """Displays a flattened list of intervals.""" @@ -552,12 +552,6 @@ class Constraint(object): def OnlyEnforceIf(self, boolvar): """Adds an enforcement literal to the constraint. - Args: - boolvar: A boolean literal or a list of boolean literals. - - Returns: - self. - This method adds one or more literals (that is, a boolean variable or its negation) as enforcement literals. The conjunction of all these literals determines whether the constraint is active or not. It acts as an @@ -565,6 +559,12 @@ class Constraint(object): must be enforced. If it is false, then the constraint is ignored. BoolOr, BoolAnd, and linear constraints all support enforcement literals. + + Args: + boolvar: A boolean literal or a list of boolean literals. + + Returns: + self. """ if isinstance(boolvar, numbers.Integral) and boolvar == 1: @@ -912,7 +912,7 @@ class CpModel(object): Raises: ValueError: if transition_variables, final_states, or transition_triples - are empty. + are empty. """ if not transition_variables: