C++ Reference

C++ Reference: Linear solver

model_exporter_swig_helper.h
Go to the documentation of this file.
1 // Copyright 2010-2018 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_LINEAR_SOLVER_MODEL_EXPORTER_SWIG_HELPER_H_
15 #define OR_TOOLS_LINEAR_SOLVER_MODEL_EXPORTER_SWIG_HELPER_H_
16 
17 #include <string>
18 
19 #include "ortools/linear_solver/linear_solver.pb.h"
21 
22 namespace operations_research {
23 
25  const MPModelProto& input_model,
26  const MPModelExportOptions& options = MPModelExportOptions()) {
27  return operations_research::ExportModelAsLpFormat(input_model, options)
28  .value_or("");
29 }
30 
32  const MPModelProto& input_model,
33  const MPModelExportOptions& options = MPModelExportOptions()) {
34  return operations_research::ExportModelAsMpsFormat(input_model, options)
35  .value_or("");
36 }
37 } // namespace operations_research
38 
39 #endif // OR_TOOLS_LINEAR_SOLVER_MODEL_EXPORTER_SWIG_HELPER_H_
std::string ExportModelAsMpsFormatReturnString(const MPModelProto &input_model, const MPModelExportOptions &options=MPModelExportOptions())
std::string ExportModelAsLpFormatReturnString(const MPModelProto &input_model, const MPModelExportOptions &options=MPModelExportOptions())
absl::StatusOr< std::string > ExportModelAsMpsFormat(const MPModelProto &model, const MPModelExportOptions &options=MPModelExportOptions())
Outputs the current model (variables, constraints, objective) as a string encoded in MPS file format,...
absl::StatusOr< std::string > ExportModelAsLpFormat(const MPModelProto &model, const MPModelExportOptions &options=MPModelExportOptions())
Outputs the current model (variables, constraints, objective) as a string encoded in the so-called "C...