Google OR-Tools v9.11
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-2024 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
21#include "ortools/linear_solver/linear_solver.pb.h"
24
25namespace operations_research {
26
27// TODO(b/311704821): this function should not delegate to MPSolver, also true
28// for the functions below.
30 const SolveInterrupter* interrupter) {
31 MPSolutionResponse response;
32 if (interrupter != nullptr) {
33 std::atomic<bool> atomic_bool = false;
35 interrupter, [&atomic_bool] { atomic_bool.store(true); });
36 MPSolver::SolveLazyMutableRequest(std::move(request), &response,
37 &atomic_bool);
38 } else {
39 MPSolver::SolveLazyMutableRequest(std::move(request), &response);
40 }
41 return response;
42}
43
44bool SolverTypeSupportsInterruption(const MPModelRequest::SolverType solver) {
45 return MPSolver::SolverTypeSupportsInterruption(solver);
46}
47
48std::string MPModelRequestLoggingInfo(const MPModelRequest& request) {
50}
51
52} // namespace operations_research
static void SolveLazyMutableRequest(LazyMutableCopy< MPModelRequest > request, MPSolutionResponse *response, std::atomic< bool > *interrupt=nullptr)
static
static std::string GetMPModelRequestLoggingInfo(const MPModelRequest &request)
static
In SWIG mode, we don't want anything besides these top-level includes.
MPSolutionResponse SolveMPModel(LazyMutableCopy< MPModelRequest > request, const SolveInterrupter *interrupter)
bool SolverTypeSupportsInterruption(const MPModelRequest::SolverType solver)
std::string MPModelRequestLoggingInfo(const MPModelRequest &request)