ortools.math_opt.python.mathopt

Module exporting all classes and functions needed for MathOpt.

This module defines aliases to all classes and functions needed for regular use of MathOpt. It removes the need for users to have multiple imports for specific sub-modules.

For example instead of:

from ortools.math_opt.python import model from ortools.math_opt.python import solve

m = model.Model() solve.solve(m)

we can simply do: from ortools.math_opt.python import mathopt

m = mathopt.Model() mathopt.solve(m)

  1# Copyright 2010-2025 Google LLC
  2# Licensed under the Apache License, Version 2.0 (the "License");
  3# you may not use this file except in compliance with the License.
  4# You may obtain a copy of the License at
  5#
  6#     http://www.apache.org/licenses/LICENSE-2.0
  7#
  8# Unless required by applicable law or agreed to in writing, software
  9# distributed under the License is distributed on an "AS IS" BASIS,
 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11# See the License for the specific language governing permissions and
 12# limitations under the License.
 13
 14"""Module exporting all classes and functions needed for MathOpt.
 15
 16This module defines aliases to all classes and functions needed for regular use
 17of MathOpt. It removes the need for users to have multiple imports for specific
 18sub-modules.
 19
 20For example instead of:
 21  from ortools.math_opt.python import model
 22  from ortools.math_opt.python import solve
 23
 24  m = model.Model()
 25  solve.solve(m)
 26
 27we can simply do:
 28  from ortools.math_opt.python import mathopt
 29
 30  m = mathopt.Model()
 31  mathopt.solve(m)
 32"""
 33
 34# pylint: disable=unused-import
 35# pylint: disable=g-importing-member
 36
 37from ortools.math_opt.python.callback import BarrierStats
 38from ortools.math_opt.python.callback import CallbackData
 39from ortools.math_opt.python.callback import CallbackRegistration
 40from ortools.math_opt.python.callback import CallbackResult
 41from ortools.math_opt.python.callback import Event
 42from ortools.math_opt.python.callback import GeneratedConstraint
 43from ortools.math_opt.python.callback import MipStats
 44from ortools.math_opt.python.callback import parse_callback_data
 45from ortools.math_opt.python.callback import PresolveStats
 46from ortools.math_opt.python.callback import SimplexStats
 47from ortools.math_opt.python.compute_infeasible_subsystem_result import (
 48    ComputeInfeasibleSubsystemResult,
 49)
 50from ortools.math_opt.python.compute_infeasible_subsystem_result import ModelSubset
 51from ortools.math_opt.python.compute_infeasible_subsystem_result import (
 52    ModelSubsetBounds,
 53)
 54from ortools.math_opt.python.compute_infeasible_subsystem_result import (
 55    parse_compute_infeasible_subsystem_result,
 56)
 57from ortools.math_opt.python.compute_infeasible_subsystem_result import (
 58    parse_model_subset,
 59)
 60from ortools.math_opt.python.compute_infeasible_subsystem_result import (
 61    parse_model_subset_bounds,
 62)
 63from ortools.math_opt.python.errors import InternalMathOptError
 64from ortools.math_opt.python.errors import status_proto_to_exception
 65from ortools.math_opt.python.expressions import evaluate_expression
 66from ortools.math_opt.python.expressions import fast_sum
 67from ortools.math_opt.python.indicator_constraints import IndicatorConstraint
 68from ortools.math_opt.python.init_arguments import gurobi_isv_key_from_proto
 69from ortools.math_opt.python.init_arguments import GurobiISVKey
 70from ortools.math_opt.python.init_arguments import (
 71    streamable_gurobi_init_arguments_from_proto,
 72)
 73from ortools.math_opt.python.init_arguments import (
 74    streamable_solver_init_arguments_from_proto,
 75)
 76from ortools.math_opt.python.init_arguments import StreamableCpSatInitArguments
 77from ortools.math_opt.python.init_arguments import StreamableEcosInitArguments
 78from ortools.math_opt.python.init_arguments import StreamableGlopInitArguments
 79from ortools.math_opt.python.init_arguments import StreamableGlpkInitArguments
 80from ortools.math_opt.python.init_arguments import StreamableGScipInitArguments
 81from ortools.math_opt.python.init_arguments import StreamableGurobiInitArguments
 82from ortools.math_opt.python.init_arguments import StreamableHighsInitArguments
 83from ortools.math_opt.python.init_arguments import StreamableOsqpInitArguments
 84from ortools.math_opt.python.init_arguments import StreamablePdlpInitArguments
 85from ortools.math_opt.python.init_arguments import StreamableSantoriniInitArguments
 86from ortools.math_opt.python.init_arguments import StreamableScsInitArguments
 87from ortools.math_opt.python.init_arguments import StreamableSolverInitArguments
 88from ortools.math_opt.python.linear_constraints import LinearConstraint
 89from ortools.math_opt.python.linear_constraints import LinearConstraintMatrixEntry
 90from ortools.math_opt.python.message_callback import list_message_callback
 91from ortools.math_opt.python.message_callback import log_messages
 92from ortools.math_opt.python.message_callback import printer_message_callback
 93from ortools.math_opt.python.message_callback import SolveMessageCallback
 94from ortools.math_opt.python.message_callback import vlog_messages
 95from ortools.math_opt.python.model import Model
 96from ortools.math_opt.python.model import UpdateTracker
 97from ortools.math_opt.python.model_parameters import ModelSolveParameters
 98from ortools.math_opt.python.model_parameters import ObjectiveParameters
 99from ortools.math_opt.python.model_parameters import parse_objective_parameters
100from ortools.math_opt.python.model_parameters import parse_solution_hint
101from ortools.math_opt.python.model_parameters import SolutionHint
102from ortools.math_opt.python.objectives import AuxiliaryObjective
103from ortools.math_opt.python.objectives import Objective
104from ortools.math_opt.python.parameters import Emphasis
105from ortools.math_opt.python.parameters import emphasis_from_proto
106from ortools.math_opt.python.parameters import emphasis_to_proto
107from ortools.math_opt.python.parameters import GlpkParameters
108from ortools.math_opt.python.parameters import GurobiParameters
109from ortools.math_opt.python.parameters import lp_algorithm_from_proto
110from ortools.math_opt.python.parameters import lp_algorithm_to_proto
111from ortools.math_opt.python.parameters import LPAlgorithm
112from ortools.math_opt.python.parameters import SolveParameters
113from ortools.math_opt.python.parameters import solver_type_from_proto
114from ortools.math_opt.python.parameters import solver_type_to_proto
115from ortools.math_opt.python.parameters import SolverType
116from ortools.math_opt.python.quadratic_constraints import QuadraticConstraint
117from ortools.math_opt.python.result import FeasibilityStatus
118from ortools.math_opt.python.result import Limit
119from ortools.math_opt.python.result import ObjectiveBounds
120from ortools.math_opt.python.result import parse_objective_bounds
121from ortools.math_opt.python.result import parse_problem_status
122from ortools.math_opt.python.result import parse_solve_result
123from ortools.math_opt.python.result import parse_solve_stats
124from ortools.math_opt.python.result import parse_termination
125from ortools.math_opt.python.result import ProblemStatus
126from ortools.math_opt.python.result import SolveResult
127from ortools.math_opt.python.result import SolveStats
128from ortools.math_opt.python.result import Termination
129from ortools.math_opt.python.result import TerminationReason
130from ortools.math_opt.python.solution import Basis
131from ortools.math_opt.python.solution import BasisStatus
132from ortools.math_opt.python.solution import DualRay
133from ortools.math_opt.python.solution import DualSolution
134from ortools.math_opt.python.solution import optional_solution_status_to_proto
135from ortools.math_opt.python.solution import parse_basis
136from ortools.math_opt.python.solution import parse_dual_ray
137from ortools.math_opt.python.solution import parse_dual_solution
138from ortools.math_opt.python.solution import parse_optional_solution_status
139from ortools.math_opt.python.solution import parse_primal_ray
140from ortools.math_opt.python.solution import parse_primal_solution
141from ortools.math_opt.python.solution import parse_solution
142from ortools.math_opt.python.solution import PrimalRay
143from ortools.math_opt.python.solution import PrimalSolution
144from ortools.math_opt.python.solution import Solution
145from ortools.math_opt.python.solution import SolutionStatus
146from ortools.math_opt.python.solve import compute_infeasible_subsystem
147from ortools.math_opt.python.solve import IncrementalSolver
148from ortools.math_opt.python.solve import solve
149from ortools.math_opt.python.solve import SolveCallback
150from ortools.math_opt.python.solver_resources import SolverResources
151from ortools.math_opt.python.sparse_containers import LinearConstraintFilter
152from ortools.math_opt.python.sparse_containers import parse_linear_constraint_map
153from ortools.math_opt.python.sparse_containers import parse_quadratic_constraint_map
154from ortools.math_opt.python.sparse_containers import parse_variable_map
155from ortools.math_opt.python.sparse_containers import QuadraticConstraintFilter
156from ortools.math_opt.python.sparse_containers import SparseVectorFilter
157from ortools.math_opt.python.sparse_containers import to_sparse_double_vector_proto
158from ortools.math_opt.python.sparse_containers import to_sparse_int32_vector_proto
159from ortools.math_opt.python.sparse_containers import VariableFilter
160from ortools.math_opt.python.sparse_containers import VarOrConstraintType
161from ortools.math_opt.python.variables import as_flat_linear_expression
162from ortools.math_opt.python.variables import as_flat_quadratic_expression
163from ortools.math_opt.python.variables import BoundedLinearExpression
164from ortools.math_opt.python.variables import BoundedLinearTypes
165from ortools.math_opt.python.variables import BoundedLinearTypesList
166from ortools.math_opt.python.variables import BoundedQuadraticExpression
167from ortools.math_opt.python.variables import BoundedQuadraticTypes
168from ortools.math_opt.python.variables import BoundedQuadraticTypesList
169from ortools.math_opt.python.variables import LinearBase
170from ortools.math_opt.python.variables import LinearExpression
171from ortools.math_opt.python.variables import LinearLinearProduct
172from ortools.math_opt.python.variables import LinearProduct
173from ortools.math_opt.python.variables import LinearSum
174from ortools.math_opt.python.variables import LinearTerm
175from ortools.math_opt.python.variables import LinearTypes
176from ortools.math_opt.python.variables import LinearTypesExceptVariable
177from ortools.math_opt.python.variables import LowerBoundedLinearExpression
178from ortools.math_opt.python.variables import LowerBoundedQuadraticExpression
179from ortools.math_opt.python.variables import QuadraticBase
180from ortools.math_opt.python.variables import QuadraticExpression
181from ortools.math_opt.python.variables import QuadraticProduct
182from ortools.math_opt.python.variables import QuadraticSum
183from ortools.math_opt.python.variables import QuadraticTerm
184from ortools.math_opt.python.variables import QuadraticTermKey
185from ortools.math_opt.python.variables import QuadraticTypes
186from ortools.math_opt.python.variables import UpperBoundedLinearExpression
187from ortools.math_opt.python.variables import UpperBoundedQuadraticExpression
188from ortools.math_opt.python.variables import VarEqVar
189from ortools.math_opt.python.variables import Variable
190
191# pylint: enable=unused-import
192# pylint: enable=g-importing-member