[CP-SAT] enable violation_ls by default
This commit is contained in:
@@ -575,7 +575,7 @@ class ConstraintGraphNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
class DecompositionGraphNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
public:
|
||||
explicit DecompositionGraphNeighborhoodGenerator(
|
||||
NeighborhoodGeneratorHelper const* helper, const std::string& name)
|
||||
NeighborhoodGeneratorHelper const* helper, absl::string_view name)
|
||||
: NeighborhoodGenerator(name, helper) {}
|
||||
Neighborhood Generate(const CpSolverResponse& initial_solution,
|
||||
double difficulty, absl::BitGenRef random) final;
|
||||
@@ -734,7 +734,7 @@ class SlicePackingNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
class RoutingRandomNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
public:
|
||||
RoutingRandomNeighborhoodGenerator(NeighborhoodGeneratorHelper const* helper,
|
||||
const std::string& name)
|
||||
absl::string_view name)
|
||||
: NeighborhoodGenerator(name, helper) {}
|
||||
|
||||
Neighborhood Generate(const CpSolverResponse& initial_solution,
|
||||
@@ -746,7 +746,7 @@ class RoutingRandomNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
class RoutingPathNeighborhoodGenerator : public NeighborhoodGenerator {
|
||||
public:
|
||||
RoutingPathNeighborhoodGenerator(NeighborhoodGeneratorHelper const* helper,
|
||||
const std::string& name)
|
||||
absl::string_view name)
|
||||
: NeighborhoodGenerator(name, helper) {}
|
||||
|
||||
Neighborhood Generate(const CpSolverResponse& initial_solution,
|
||||
|
||||
@@ -3452,13 +3452,16 @@ void SolveCpModelParallel(const CpModelProto& model_proto,
|
||||
shared.incomplete_solutions.get(), "rins/rens"),
|
||||
params, helper, &shared));
|
||||
}
|
||||
|
||||
const int num_incomplete_solvers =
|
||||
params.num_workers() - num_full_problem_solvers;
|
||||
const LinearModel* linear_model = global_model->Get<LinearModel>();
|
||||
if (params.num_violation_ls() > 0 && !params.interleave_search() &&
|
||||
model_proto.has_objective()) {
|
||||
const int num_violation_ls = params.test_feasibility_jump()
|
||||
? params.num_workers()
|
||||
: params.num_violation_ls();
|
||||
if (!params.interleave_search() && model_proto.has_objective()) {
|
||||
int num_violation_ls = params.has_num_violation_ls()
|
||||
? params.num_violation_ls()
|
||||
: num_incomplete_solvers / 8 + 1;
|
||||
if (params.test_feasibility_jump()) {
|
||||
num_violation_ls = params.num_workers();
|
||||
}
|
||||
for (int i = 0; i < num_violation_ls; ++i) {
|
||||
SatParameters local_params = params;
|
||||
local_params.set_random_seed(ValidSumSeed(params.random_seed(), i));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "ortools/base/stl_util.h"
|
||||
#include "ortools/base/strong_vector.h"
|
||||
@@ -136,7 +137,7 @@ struct DiffnEnergyEvent : DiffnBaseEvent {
|
||||
|
||||
void GenerateNoOverlap2dEnergyCut(
|
||||
const std::vector<std::vector<LiteralValueValue>>& energies,
|
||||
absl::Span<int> rectangles, const std::string& cut_name, Model* model,
|
||||
absl::Span<int> rectangles, absl::string_view cut_name, Model* model,
|
||||
LinearConstraintManager* manager, SchedulingConstraintHelper* x_helper,
|
||||
SchedulingConstraintHelper* y_helper,
|
||||
SchedulingDemandHelper* y_demands_helper) {
|
||||
@@ -295,7 +296,7 @@ void GenerateNoOverlap2dEnergyCut(
|
||||
add_energy_to_name = true;
|
||||
}
|
||||
}
|
||||
std::string full_name = cut_name;
|
||||
std::string full_name(cut_name);
|
||||
if (add_opt_to_name) full_name.append("_optional");
|
||||
if (add_quadratic_to_name) full_name.append("_quadratic");
|
||||
if (add_energy_to_name) full_name.append("_energy");
|
||||
@@ -401,7 +402,7 @@ std::string DiffnCtEvent::DebugString() const {
|
||||
//
|
||||
// TODO(user): merge with Packing cuts.
|
||||
void GenerateNoOvelap2dCompletionTimeCutsWithEnergy(
|
||||
const std::string& cut_name, std::vector<DiffnCtEvent> events,
|
||||
absl::string_view cut_name, std::vector<DiffnCtEvent> events,
|
||||
bool use_lifting, bool skip_low_sizes, Model* model,
|
||||
LinearConstraintManager* manager) {
|
||||
TopNCuts top_n_cuts(5);
|
||||
@@ -548,7 +549,7 @@ void GenerateNoOvelap2dCompletionTimeCutsWithEnergy(
|
||||
add_energy_to_name |= event.use_energy;
|
||||
cut.AddTerm(event.x_end, event.energy_min * best_capacity);
|
||||
}
|
||||
std::string full_name = cut_name;
|
||||
std::string full_name(cut_name);
|
||||
if (is_lifted) full_name.append("_lifted");
|
||||
if (add_energy_to_name) full_name.append("_energy");
|
||||
top_n_cuts.AddCut(cut.Build(), full_name, manager->LpValues());
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
#ifndef OR_TOOLS_SAT_PRECEDENCES_H_
|
||||
#define OR_TOOLS_SAT_PRECEDENCES_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/container/inlined_vector.h"
|
||||
|
||||
Reference in New Issue
Block a user