Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
set_cover_solve.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include "absl/base/macros.h"
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "ortools/base/init_google.h"
#include "ortools/base/timer.h"
#include "ortools/set_cover/base_types.h"
#include "ortools/set_cover/set_cover_heuristics.h"
#include "ortools/set_cover/set_cover_invariant.h"
#include "ortools/set_cover/set_cover_model.h"
#include "ortools/set_cover/set_cover_reader.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.

Macros

#define BUILD_VECTOR(files)

Typedefs

using operations_research::BenchmarksTableRow

Enumerations

enum class  operations_research::FileFormat {
  operations_research::EMPTY , operations_research::ORLIB , operations_research::RAIL , operations_research::FIMI ,
  operations_research::PROTO , operations_research::PROTO_BIN , operations_research::TXT
}

Functions

 ABSL_FLAG (std::string, input, "", "REQUIRED: Input file name.")
 Display statistics about trail4284_1B.txt:
 ABSL_FLAG (std::string, input_fmt, "", "REQUIRED: Input file format. Either proto, proto_bin, rail, " "orlib or fimi.")
 ABSL_FLAG (std::string, output, "", "If non-empty, write the returned solution to the given file.")
 ABSL_FLAG (std::string, output_fmt, "", "If out is non-empty, use the given format for the output.")
 ABSL_FLAG (bool, generate, false, "Generate a new model from the input model.")
 ABSL_FLAG (int, num_elements_wanted, 0, "Number of elements wanted in the new generated model.")
 ABSL_FLAG (int, num_subsets_wanted, 0, "Number of subsets wanted in the new generated model.")
 ABSL_FLAG (float, row_scale, 1.0, "Row scale for the new generated model.")
 ABSL_FLAG (float, column_scale, 1.0, "Column scale for the new generated model.")
 ABSL_FLAG (float, cost_scale, 1.0, "Cost scale for the new generated model.")
 ABSL_FLAG (bool, unicost, false, "Set all costs to 1.0.")
 ABSL_FLAG (bool, latex, false, "Output in LaTeX format. CSV otherwise.")
 ABSL_FLAG (bool, solve, false, "Solve the model.")
 ABSL_FLAG (bool, stats, false, "Log stats about the model.")
 ABSL_FLAG (bool, summarize, false, "Display the comparison of the solution generators.")
 ABSL_FLAG (bool, tlns, false, "Run thrifty LNS.")
 ABSL_FLAG (int, max_elements_for_classic, 5000, "Do not use classic on larger problems.")
 ABSL_FLAG (bool, benchmarks, false, "Run benchmarks.")
 ABSL_FLAG (std::string, benchmarks_dir, "", "Benchmarks directory.")
 ABSL_FLAG (bool, collate_scp, false, "Collate the SCP benchmarks.")
int64_t operations_research::RunTimeInMicroseconds (const SetCoverSolutionGenerator &gen)
int64_t operations_research::RunTimeInNanoseconds (const SetCoverSolutionGenerator &gen)
void operations_research::LogStats (const SetCoverModel &model)
void operations_research::LogCostAndTiming (const absl::string_view problem_name, absl::string_view alg_name, const SetCoverInvariant &inv, int64_t run_time)
void operations_research::LogCostAndTiming (const SetCoverSolutionGenerator &generator)
FileFormat operations_research::ParseFileFormat (const std::string &format_name)
SetCoverModel operations_research::ReadModel (absl::string_view filename, FileFormat format)
SubsetBoolVector operations_research::ReadSolution (absl::string_view filename, FileFormat format)
void operations_research::WriteModel (const SetCoverModel &model, const std::string &filename, FileFormat format)
void operations_research::WriteSolution (const SetCoverModel &model, const SubsetBoolVector &solution, absl::string_view filename, FileFormat format)
SetCoverInvariant operations_research::RunLazyElementDegree (SetCoverModel *model)
SetCoverInvariant operations_research::RunGreedy (SetCoverModel *model)
std::vector< BenchmarksTableRowoperations_research::BenchmarksTable ()
void operations_research::Benchmarks ()
void operations_research::Run ()
int main (int argc, char **argv)

Variables

static const char *const operations_research::kRailFiles []
 List all the files from the literature.
static const char *const operations_research::kScp4To6Files []
static const char *const operations_research::kScpAToEFiles []
static const char *const operations_research::kScpNrFiles []
static const char *const operations_research::kScpClrFiles []
static const char *const operations_research::kScpCycFiles []
static const char *const operations_research::kWedelinFiles []
static const char *const operations_research::kBalasFiles []
static const char *const operations_research::kFimiFiles []

Macro Definition Documentation

◆ BUILD_VECTOR

#define BUILD_VECTOR ( files)
Value:
BuildVector(files, ABSL_ARRAYSIZE(files))

Function Documentation

◆ ABSL_FLAG() [1/20]

ABSL_FLAG ( bool ,
benchmarks ,
false ,
"Run benchmarks."  )

◆ ABSL_FLAG() [2/20]

ABSL_FLAG ( bool ,
collate_scp ,
false ,
"Collate the SCP benchmarks."  )

◆ ABSL_FLAG() [3/20]

ABSL_FLAG ( bool ,
generate ,
false ,
"Generate a new model from the input model."  )

◆ ABSL_FLAG() [4/20]

ABSL_FLAG ( bool ,
latex ,
false ,
"Output in LaTeX format. CSV otherwise."  )

◆ ABSL_FLAG() [5/20]

ABSL_FLAG ( bool ,
solve ,
false ,
"Solve the model."  )

◆ ABSL_FLAG() [6/20]

ABSL_FLAG ( bool ,
stats ,
false ,
"Log stats about the model."  )

◆ ABSL_FLAG() [7/20]

ABSL_FLAG ( bool ,
summarize ,
false ,
"Display the comparison of the solution generators."  )

◆ ABSL_FLAG() [8/20]

ABSL_FLAG ( bool ,
tlns ,
false ,
"Run thrifty LNS."  )

◆ ABSL_FLAG() [9/20]

ABSL_FLAG ( bool ,
unicost ,
false ,
"Set all costs to 1.0."  )

◆ ABSL_FLAG() [10/20]

ABSL_FLAG ( float ,
column_scale ,
1. 0,
"Column scale for the new generated model."  )

◆ ABSL_FLAG() [11/20]

ABSL_FLAG ( float ,
cost_scale ,
1. 0,
"Cost scale for the new generated model."  )

◆ ABSL_FLAG() [12/20]

ABSL_FLAG ( float ,
row_scale ,
1. 0,
"Row scale for the new generated model."  )

◆ ABSL_FLAG() [13/20]

ABSL_FLAG ( int ,
max_elements_for_classic ,
5000 ,
"Do not use classic on larger problems."  )

◆ ABSL_FLAG() [14/20]

ABSL_FLAG ( int ,
num_elements_wanted ,
0 ,
"Number of elements wanted in the new generated model."  )

◆ ABSL_FLAG() [15/20]

ABSL_FLAG ( int ,
num_subsets_wanted ,
0 ,
"Number of subsets wanted in the new generated model."  )

◆ ABSL_FLAG() [16/20]

ABSL_FLAG ( std::string ,
benchmarks_dir ,
"" ,
"Benchmarks directory."  )

◆ ABSL_FLAG() [17/20]

ABSL_FLAG ( std::string ,
input ,
"" ,
"REQUIRED: Input file name."  )

Display statistics about trail4284_1B.txt:

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. Example usages:

Solve all the problems in the benchmarks directory and produce LaTeX output. Run the classic algorithms on problem with up to 100,000 elements. Display summaries (with geomean ratios) for each group of problems. Generate a new model from the rail4284 problem, with 100,000 elements and 1,000,000,000 subsets, with row_scale = 1.1, column_scale = 1.1, and cost_scale = 10.0:

◆ ABSL_FLAG() [18/20]

ABSL_FLAG ( std::string ,
input_fmt ,
"" ,
"REQUIRED: Input file format. Either proto,
proto_bin ,
rail ,
" "orlib or fimi."  )

◆ ABSL_FLAG() [19/20]

ABSL_FLAG ( std::string ,
output ,
"" ,
"If non- empty,
write the returned solution to the given file."  )

◆ ABSL_FLAG() [20/20]

ABSL_FLAG ( std::string ,
output_fmt ,
"" ,
"If out is non- empty,
use the given format for the output."  )

◆ main()

int main ( int argc,
char ** argv )

Definition at line 716 of file set_cover_solve.cc.