OR-Tools  9.2
pdlp_solver.h
Go to the documentation of this file.
1// Copyright 2010-2021 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#ifndef OR_TOOLS_MATH_OPT_SOLVERS_PDLP_SOLVER_H_
15#define OR_TOOLS_MATH_OPT_SOLVERS_PDLP_SOLVER_H_
16
17#include <memory>
18#include <string>
19#include <vector>
20
21#include "absl/status/status.h"
22#include "absl/status/statusor.h"
23#include "ortools/pdlp/primal_dual_hybrid_gradient.h"
24#include "ortools/pdlp/quadratic_program.h"
25#include "ortools/pdlp/solvers.pb.h"
26#include "ortools/math_opt/callback.pb.h"
29#include "ortools/math_opt/model.pb.h"
30#include "ortools/math_opt/model_parameters.pb.h"
31#include "ortools/math_opt/model_update.pb.h"
32#include "ortools/math_opt/parameters.pb.h"
33#include "ortools/math_opt/result.pb.h"
35
36namespace operations_research {
37namespace math_opt {
38
40 public:
41 static absl::StatusOr<std::unique_ptr<SolverInterface>> New(
42 const ModelProto& model, const InitArgs& init_args);
43
44 absl::StatusOr<SolveResultProto> Solve(
45 const SolveParametersProto& parameters,
46 const ModelSolveParametersProto& model_parameters,
47 MessageCallback message_cb,
48 const CallbackRegistrationProto& callback_registration, Callback cb,
49 SolveInterrupter* interrupter) override;
50 absl::Status Update(const ModelUpdateProto& model_update) override;
51 bool CanUpdate(const ModelUpdateProto& model_update) override;
52
53 // Returns the merged parameters and a list of warnings.
54 static std::pair<pdlp::PrimalDualHybridGradientParams,
55 std::vector<std::string>>
56 MergeParameters(const SolveParametersProto& parameters);
57
58 private:
59 PdlpSolver() = default;
60
61 absl::Status FillSolveResult(const pdlp::SolverResult& pdlp_result,
62 const ModelSolveParametersProto& model_params,
63 SolveResultProto& result);
64
65 PdlpBridge pdlp_bridge_;
66};
67
68} // namespace math_opt
69} // namespace operations_research
70
71#endif // OR_TOOLS_MATH_OPT_SOLVERS_PDLP_SOLVER_H_
bool CanUpdate(const ModelUpdateProto &model_update) override
Definition: pdlp_solver.cc:362
absl::Status Update(const ModelUpdateProto &model_update) override
Definition: pdlp_solver.cc:357
static absl::StatusOr< std::unique_ptr< SolverInterface > > New(const ModelProto &model, const InitArgs &init_args)
Definition: pdlp_solver.cc:62
absl::StatusOr< SolveResultProto > Solve(const SolveParametersProto &parameters, const ModelSolveParametersProto &model_parameters, MessageCallback message_cb, const CallbackRegistrationProto &callback_registration, Callback cb, SolveInterrupter *interrupter) override
Definition: pdlp_solver.cc:325
static std::pair< pdlp::PrimalDualHybridGradientParams, std::vector< std::string > > MergeParameters(const SolveParametersProto &parameters)
Definition: pdlp_solver.cc:70
std::function< void(const std::vector< std::string > &)> MessageCallback
std::function< absl::StatusOr< CallbackResultProto >(const CallbackDataProto &)> Callback
SatParameters parameters
GRBmodel * model
Collection of objects used to extend the Constraint Solver library.