20#include "absl/log/check.h"
21#include "absl/strings/numbers.h"
22#include "absl/strings/string_view.h"
39 size_t SkipBlanks(
size_t pos)
const;
40 size_t SkipNonBlanks(
size_t pos)
const;
42 absl::string_view line_;
55size_t SetCoverReader::SkipBlanks(
size_t pos)
const {
56 const size_t size = line_.size();
57 for (; pos <
size && std::isspace(line_[pos]); ++pos) {
62size_t SetCoverReader::SkipNonBlanks(
size_t pos)
const {
63 const size_t size = line_.size();
64 for (; pos <
size && !std::isspace(line_[pos]); ++pos) {
70 const size_t size = line_.size();
71 start_pos_ = SkipBlanks(end_pos_);
72 if (start_pos_ >=
size) {
75 start_pos_ = SkipBlanks(0);
77 end_pos_ = SkipNonBlanks(start_pos_);
78 return line_.substr(start_pos_, end_pos_ - start_pos_);
99 model.ReserveNumSubsets(num_cols.value());
102 model.SetSubsetCost(subset.value(), cost);
106 for (RowEntryIndex entry(0); entry < row_size; ++entry) {
108 model.AddElementToSubset(element.value(), subset);
121 model.ReserveNumSubsets(num_cols);
122 for (
int i(0); i < num_cols; ++i) {
124 model.SetSubsetCost(i, cost);
126 model.ReserveNumElementsInSubset(i, column_size.value());
129 model.AddElementToSubset(element.value(), i);
Implements the minimum interface for a range-based for loop iterator.
Main class for describing a weighted set-covering problem.
int64_t ParseNextInteger()
absl::string_view GetNextToken()
SetCoverReader(File *file)
File * OpenOrDie(absl::string_view filename, absl::string_view mode, Options options)
In SWIG mode, we don't want anything besides these top-level includes.
SetCoverModel ReadBeasleySetCoverProblem(absl::string_view filename)
util_intops::StrongIntRange< SubsetIndex > SubsetRange
util_intops::StrongIntRange< ColumnEntryIndex > ColumnEntryRange
SetCoverModel ReadRailSetCoverProblem(absl::string_view filename)
util_intops::StrongIntRange< ElementIndex > ElementRange