cleanup and formatting

This commit is contained in:
Corentin Le Molgat
2025-06-16 17:55:44 +02:00
parent 7096031050
commit 478c8b5309
6 changed files with 10 additions and 7 deletions

View File

@@ -142,7 +142,8 @@ std::ostream& operator<<(std::ostream& os, const ::std::optional<T>& opt) {
// needed by graph tests
template <typename T, typename U>
std::ostream& operator<<(std::ostream& os, const ::util_intops::StrongVector<T, U>& vec) {
std::ostream& operator<<(std::ostream& os,
const ::util_intops::StrongVector<T, U>& vec) {
for (U it : vec) {
os << ::std::to_string(it) << ',';
}

View File

@@ -137,7 +137,8 @@ TEST(DumpVars, StrongInt) {
}
TEST(DumpVars, StrongVector) {
::util_intops::StrongVector<::util_intops::CustomStrongInt, float> vec = {49.3, 3.14};
::util_intops::StrongVector<::util_intops::CustomStrongInt, float> vec = {
49.3, 3.14};
EXPECT_EQ(R"(vec = 49.299999,3.140000,)", ToString(DUMP_VARS(vec)));
EXPECT_EQ(R"(vec = 49.299999,3.140000,)", DUMP_VARS(vec).str());
}

View File

@@ -57,7 +57,7 @@ class LineBreaker {
// Returns true if string s will fit on the current line without adding a
// carriage return.
bool WillFit(const std::string& s) {
bool WillFit(absl::string_view s) {
return line_size_ + static_cast<int>(s.size()) < max_line_size_;
}

View File

@@ -20,8 +20,8 @@
#include <limits>
#include <memory>
#include <mutex>
#include <string>
#include <numeric>
#include <string>
#include "absl/strings/numbers.h"
#include "absl/strings/str_format.h"
@@ -1094,7 +1094,8 @@ void XpressInterface::SetCoefficient(MPConstraint* const constraint,
double new_value, double) {
InvalidateSolutionSynchronization();
fixedOrderCoefficientsPerConstraint[constraint->index()][variable->index()] = new_value;
fixedOrderCoefficientsPerConstraint[constraint->index()][variable->index()] =
new_value;
// Changing a single coefficient in the matrix is potentially pretty
// slow since that coefficient has to be found in the sparse matrix

View File

@@ -317,7 +317,7 @@ MPModelProtoToMathOptModel(const ::operations_research::MPModelProto& model) {
for (const MPGeneralConstraintProto& general_constraint :
model.general_constraint()) {
const std::string& in_name = general_constraint.name();
absl::string_view in_name = general_constraint.name();
switch (general_constraint.general_constraint_case()) {
case MPGeneralConstraintProto::kQuadraticConstraint: {
(*output.mutable_quadratic_constraints())