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