[CP-SAT] fix bug in symmetries;
This commit is contained in:
@@ -555,11 +555,11 @@ void FindCpModelSymmetries(
|
||||
}
|
||||
}
|
||||
generators->resize(num_generators);
|
||||
average_support_size /= num_generators;
|
||||
SOLVER_LOG(logger, "[Symmetry] Symmetry computation done. time: ",
|
||||
time_limit->GetElapsedTime(),
|
||||
" dtime: ", time_limit->GetElapsedDeterministicTime());
|
||||
if (num_generators > 0) {
|
||||
average_support_size /= num_generators;
|
||||
SOLVER_LOG(logger, "[Symmetry] #generators: ", num_generators,
|
||||
", average support size: ", average_support_size);
|
||||
if (num_duplicate_constraints > 0) {
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/meta/type_traits.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "ortools/base/hash.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/strong_vector.h"
|
||||
@@ -785,14 +786,14 @@ bool LinearConstraintManager::DebugCheckConstraint(
|
||||
}
|
||||
|
||||
void TopNCuts::AddCut(
|
||||
LinearConstraint ct, const std::string& name,
|
||||
LinearConstraint ct, absl::string_view name,
|
||||
const absl::StrongVector<IntegerVariable, double>& lp_solution) {
|
||||
if (ct.vars.empty()) return;
|
||||
const double activity = ComputeActivity(ct, lp_solution);
|
||||
const double violation =
|
||||
std::max(activity - ToDouble(ct.ub), ToDouble(ct.lb) - activity);
|
||||
const double l2_norm = ComputeL2Norm(ct);
|
||||
cuts_.Add({name, ct}, violation / l2_norm);
|
||||
cuts_.Add({std::string(name), ct}, violation / l2_norm);
|
||||
}
|
||||
|
||||
void TopNCuts::TransferToManager(LinearConstraintManager* manager) {
|
||||
|
||||
@@ -292,7 +292,7 @@ class TopNCuts {
|
||||
explicit TopNCuts(int n) : cuts_(n) {}
|
||||
|
||||
// Adds a cut to the local pool.
|
||||
void AddCut(LinearConstraint ct, const std::string& name,
|
||||
void AddCut(LinearConstraint ct, absl::string_view name,
|
||||
const absl::StrongVector<IntegerVariable, double>& lp_solution);
|
||||
|
||||
// Empty the local pool and add all its content to the manager.
|
||||
|
||||
Reference in New Issue
Block a user