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.hash_model_storage import HashModelStorage
 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.message_callback import list_message_callback
 89from ortools.math_opt.python.message_callback import log_messages
 90from ortools.math_opt.python.message_callback import printer_message_callback
 91from ortools.math_opt.python.message_callback import SolveMessageCallback
 92from ortools.math_opt.python.message_callback import vlog_messages
 93from ortools.math_opt.python.model import as_flat_linear_expression
 94from ortools.math_opt.python.model import as_flat_quadratic_expression
 95from ortools.math_opt.python.model import as_normalized_linear_inequality
 96from ortools.math_opt.python.model import BoundedLinearExpression
 97from ortools.math_opt.python.model import BoundedLinearTypes
 98from ortools.math_opt.python.model import BoundedLinearTypesList
 99from ortools.math_opt.python.model import LinearBase
100from ortools.math_opt.python.model import LinearConstraint
101from ortools.math_opt.python.model import LinearConstraintMatrixEntry
102from ortools.math_opt.python.model import LinearExpression
103from ortools.math_opt.python.model import LinearLinearProduct
104from ortools.math_opt.python.model import LinearProduct
105from ortools.math_opt.python.model import LinearSum
106from ortools.math_opt.python.model import LinearTerm
107from ortools.math_opt.python.model import LinearTypes
108from ortools.math_opt.python.model import LinearTypesExceptVariable
109from ortools.math_opt.python.model import LowerBoundedLinearExpression
110from ortools.math_opt.python.model import Model
111from ortools.math_opt.python.model import NormalizedLinearInequality
112from ortools.math_opt.python.model import Objective
113from ortools.math_opt.python.model import QuadraticBase
114from ortools.math_opt.python.model import QuadraticExpression
115from ortools.math_opt.python.model import QuadraticProduct
116from ortools.math_opt.python.model import QuadraticSum
117from ortools.math_opt.python.model import QuadraticTerm
118from ortools.math_opt.python.model import QuadraticTermKey
119from ortools.math_opt.python.model import QuadraticTypes
120from ortools.math_opt.python.model import Storage
121from ortools.math_opt.python.model import StorageClass
122from ortools.math_opt.python.model import UpdateTracker
123from ortools.math_opt.python.model import UpperBoundedLinearExpression
124from ortools.math_opt.python.model import VarEqVar
125from ortools.math_opt.python.model import Variable
126from ortools.math_opt.python.model_parameters import ModelSolveParameters
127from ortools.math_opt.python.model_parameters import parse_solution_hint
128from ortools.math_opt.python.model_parameters import SolutionHint
129from ortools.math_opt.python.model_storage import BadLinearConstraintIdError
130from ortools.math_opt.python.model_storage import BadVariableIdError
131from ortools.math_opt.python.model_storage import LinearConstraintMatrixIdEntry
132from ortools.math_opt.python.model_storage import LinearObjectiveEntry
133from ortools.math_opt.python.model_storage import ModelStorage
134from ortools.math_opt.python.model_storage import ModelStorageImpl
135from ortools.math_opt.python.model_storage import ModelStorageImplClass
136from ortools.math_opt.python.model_storage import QuadraticEntry
137from ortools.math_opt.python.model_storage import QuadraticTermIdKey
138from ortools.math_opt.python.model_storage import StorageUpdateTracker
139from ortools.math_opt.python.model_storage import UsedUpdateTrackerAfterRemovalError
140from ortools.math_opt.python.parameters import Emphasis
141from ortools.math_opt.python.parameters import emphasis_from_proto
142from ortools.math_opt.python.parameters import emphasis_to_proto
143from ortools.math_opt.python.parameters import GlpkParameters
144from ortools.math_opt.python.parameters import GurobiParameters
145from ortools.math_opt.python.parameters import lp_algorithm_from_proto
146from ortools.math_opt.python.parameters import lp_algorithm_to_proto
147from ortools.math_opt.python.parameters import LPAlgorithm
148from ortools.math_opt.python.parameters import SolveParameters
149from ortools.math_opt.python.parameters import solver_type_from_proto
150from ortools.math_opt.python.parameters import solver_type_to_proto
151from ortools.math_opt.python.parameters import SolverType
152from ortools.math_opt.python.result import FeasibilityStatus
153from ortools.math_opt.python.result import Limit
154from ortools.math_opt.python.result import ObjectiveBounds
155from ortools.math_opt.python.result import parse_objective_bounds
156from ortools.math_opt.python.result import parse_problem_status
157from ortools.math_opt.python.result import parse_solve_result
158from ortools.math_opt.python.result import parse_solve_stats
159from ortools.math_opt.python.result import parse_termination
160from ortools.math_opt.python.result import ProblemStatus
161from ortools.math_opt.python.result import SolveResult
162from ortools.math_opt.python.result import SolveStats
163from ortools.math_opt.python.result import Termination
164from ortools.math_opt.python.result import TerminationReason
165from ortools.math_opt.python.solution import Basis
166from ortools.math_opt.python.solution import BasisStatus
167from ortools.math_opt.python.solution import DualRay
168from ortools.math_opt.python.solution import DualSolution
169from ortools.math_opt.python.solution import optional_solution_status_to_proto
170from ortools.math_opt.python.solution import parse_basis
171from ortools.math_opt.python.solution import parse_dual_ray
172from ortools.math_opt.python.solution import parse_dual_solution
173from ortools.math_opt.python.solution import parse_optional_solution_status
174from ortools.math_opt.python.solution import parse_primal_ray
175from ortools.math_opt.python.solution import parse_primal_solution
176from ortools.math_opt.python.solution import parse_solution
177from ortools.math_opt.python.solution import PrimalRay
178from ortools.math_opt.python.solution import PrimalSolution
179from ortools.math_opt.python.solution import Solution
180from ortools.math_opt.python.solution import SolutionStatus
181from ortools.math_opt.python.solve import compute_infeasible_subsystem
182from ortools.math_opt.python.solve import IncrementalSolver
183from ortools.math_opt.python.solve import solve
184from ortools.math_opt.python.solve import SolveCallback
185from ortools.math_opt.python.solver_resources import SolverResources
186from ortools.math_opt.python.sparse_containers import LinearConstraintFilter
187from ortools.math_opt.python.sparse_containers import parse_linear_constraint_map
188from ortools.math_opt.python.sparse_containers import parse_variable_map
189from ortools.math_opt.python.sparse_containers import SparseVectorFilter
190from ortools.math_opt.python.sparse_containers import to_sparse_double_vector_proto
191from ortools.math_opt.python.sparse_containers import to_sparse_int32_vector_proto
192from ortools.math_opt.python.sparse_containers import VariableFilter
193from ortools.math_opt.python.sparse_containers import VarOrConstraintType
194
195# pylint: enable=unused-import
196# pylint: enable=g-importing-member