Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
mathopt_convert.cc File Reference
#include <optional>
#include <string>
#include "absl/flags/flag.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "ortools/base/init_google.h"
#include "ortools/base/logging.h"
#include "ortools/base/status_macros.h"
#include "ortools/math_opt/io/names_removal.h"
#include "ortools/math_opt/tools/file_format_flags.h"
#include "ortools/util/status_macros.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
namespace  operations_research::math_opt
 An object oriented wrapper for quadratic constraints in ModelStorage.
 

Functions

input_file model textproto input_format linear_solver_txt output_file model mps input_file model pb output_file model_linear_solver pb output_format linear_solver input_file model pb output_file model lp input_file model pb nonames output_file anonymous model pb ABSL_FLAG (std::string, input_file, "", "the file containing the model to solve; use --input_format to specify" " the file format")
 
 ABSL_FLAG (std::optional< operations_research::math_opt::FileFormat >, input_format, std::nullopt, absl::StrCat("the format of the --input_file; possible values:", operations_research::math_opt::OptionalFormatFlagPossibleValuesList()))
 
 ABSL_FLAG (std::string, output_file, "", "the file to write to; use --output_format to specify" " the file format")
 
 ABSL_FLAG (std::optional< operations_research::math_opt::FileFormat >, output_format, std::nullopt, absl::StrCat("the format of the --output_file; possible values:", operations_research::math_opt::OptionalFormatFlagPossibleValuesList()))
 
 ABSL_FLAG (bool, names, true, "use the names in the input models; ignoring names is useful when " "the input contains duplicates or if the model must be anonymized")
 
int main (int argc, char *argv[])
 

Function Documentation

◆ ABSL_FLAG() [1/5]

ABSL_FLAG ( bool ,
names ,
true ,
"use the names in the input models; ignoring names is useful when " "the input contains duplicates or if the model must be anonymized"  )

◆ ABSL_FLAG() [2/5]

ABSL_FLAG ( std::optional< operations_research::math_opt::FileFormat > ,
input_format ,
std::nullopt ,
absl::StrCat("the format of the --input_file; possible values:", operations_research::math_opt::OptionalFormatFlagPossibleValuesList())  )

◆ ABSL_FLAG() [3/5]

ABSL_FLAG ( std::optional< operations_research::math_opt::FileFormat > ,
output_format ,
std::nullopt ,
absl::StrCat("the format of the --output_file; possible values:", operations_research::math_opt::OptionalFormatFlagPossibleValuesList())  )

◆ ABSL_FLAG() [4/5]

input_file model textproto input_format linear_solver_txt output_file model mps input_file model pb output_file model_linear_solver pb output_format linear_solver input_file model pb output_file model lp input_file model pb nonames output_file anonymous model pb ABSL_FLAG ( std::string ,
input_file ,
"" ,
"the file containing the model to solve; use --input_format to specify" " the file format"  )

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Tool to run use MathOpt to convert MIP/LP models formats.

Examples:

  • Convert a text MPModelProto to a MPS file: mathopt_convert \

Convert a binary ModelProto to a binary MPModelProto: mathopt_convert \

  • Convert a binary ModelProto to a LP file: mathopt_convert \
  • Anonymize a binary ModelProto: mathopt_convert \

◆ ABSL_FLAG() [5/5]

ABSL_FLAG ( std::string ,
output_file ,
"" ,
"the file to write to; use --output_format to specify" " the file format"  )

◆ main()

int main ( int argc,
char * argv[] )

We don't use QCHECK_OK() here since the logged message contains more than the failing status.

Definition at line 134 of file mathopt_convert.cc.