Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
solve_mp_model.cc
Go to the documentation of this file.
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
15
16#include <atomic>
17#include <string>
18#include <utility>
19
20#include "absl/base/nullability.h"
25
26namespace operations_research {
27
28// TODO(b/311704821): this function should not delegate to MPSolver, also true
29// for the functions below.
32 const SolveInterrupter* absl_nullable interrupter) {
33 MPSolutionResponse response;
34 if (interrupter != nullptr) {
35 std::atomic<bool> atomic_bool = false;
37 interrupter, [&atomic_bool] { atomic_bool.store(true); });
38 MPSolver::SolveLazyMutableRequest(std::move(request), &response,
39 &atomic_bool);
40 } else {
41 MPSolver::SolveLazyMutableRequest(std::move(request), &response);
42 }
43 return response;
44}
45
47 return MPSolver::SolverTypeSupportsInterruption(solver);
48}
49
50std::string MPModelRequestLoggingInfo(const MPModelRequest& request) {
52}
53
54} // namespace operations_research
MPModelRequest_SolverType SolverType
static void SolveLazyMutableRequest(LazyMutableCopy< MPModelRequest > request, MPSolutionResponse *response, std::atomic< bool > *interrupt=nullptr)
static std::string GetMPModelRequestLoggingInfo(const MPModelRequest &request)
OR-Tools root namespace.
bool SolverTypeSupportsInterruption(const MPModelRequest::SolverType solver)
MPSolutionResponse SolveMPModel(LazyMutableCopy< MPModelRequest > request, const SolveInterrupter *absl_nullable interrupter)
std::string MPModelRequestLoggingInfo(const MPModelRequest &request)