[CP-SAT] revisit search heuristics, lns workers search heuristics; scheduling propagation
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/sat/cp_model.h"
|
||||
#include "ortools/sat/cp_model.pb.h"
|
||||
@@ -29,9 +30,9 @@
|
||||
namespace operations_research {
|
||||
namespace sat {
|
||||
|
||||
void PrintSolution(const std::vector<std::vector<int> >& data,
|
||||
const std::vector<std::vector<bool> >& h_arcs,
|
||||
const std::vector<std::vector<bool> >& v_arcs) {
|
||||
void PrintSolution(absl::Span<const std::vector<int>> data,
|
||||
absl::Span<const std::vector<bool>> h_arcs,
|
||||
absl::Span<const std::vector<bool>> v_arcs) {
|
||||
const int num_rows = data.size();
|
||||
const int num_columns = data[0].size();
|
||||
|
||||
@@ -65,7 +66,7 @@ void PrintSolution(const std::vector<std::vector<int> >& data,
|
||||
std::cout << last_line << std::endl;
|
||||
}
|
||||
|
||||
void SlitherLink(const std::vector<std::vector<int> >& data) {
|
||||
void SlitherLink(const std::vector<std::vector<int>>& data) {
|
||||
const int num_rows = data.size();
|
||||
const int num_columns = data[0].size();
|
||||
|
||||
@@ -201,7 +202,7 @@ void SlitherLink(const std::vector<std::vector<int> >& data) {
|
||||
|
||||
const CpSolverResponse response = Solve(builder.Build());
|
||||
|
||||
std::vector<std::vector<bool> > h_arcs(num_rows + 1);
|
||||
std::vector<std::vector<bool>> h_arcs(num_rows + 1);
|
||||
for (int y = 0; y < num_rows + 1; ++y) {
|
||||
for (int x = 0; x < num_columns; ++x) {
|
||||
const int arc = undirected_horizontal_arc(x, y);
|
||||
@@ -211,7 +212,7 @@ void SlitherLink(const std::vector<std::vector<int> >& data) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::vector<bool> > v_arcs(num_columns + 1);
|
||||
std::vector<std::vector<bool>> v_arcs(num_columns + 1);
|
||||
for (int y = 0; y < num_rows; ++y) {
|
||||
for (int x = 0; x < num_columns + 1; ++x) {
|
||||
const int arc = undirected_vertical_arc(x, y);
|
||||
@@ -230,18 +231,18 @@ void SlitherLink(const std::vector<std::vector<int> >& data) {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
const std::vector<std::vector<int> > tiny = {{3, 3, 1}};
|
||||
const std::vector<std::vector<int>> tiny = {{3, 3, 1}};
|
||||
|
||||
const std::vector<std::vector<int> > small = {
|
||||
const std::vector<std::vector<int>> small = {
|
||||
{3, 2, -1, 3}, {-1, -1, -1, 2}, {3, -1, -1, -1}, {3, -1, 3, 1}};
|
||||
|
||||
const std::vector<std::vector<int> > medium = {
|
||||
const std::vector<std::vector<int>> medium = {
|
||||
{-1, 0, -1, 1, -1, -1, 1, -1}, {-1, 3, -1, -1, 2, 3, -1, 2},
|
||||
{-1, -1, 0, -1, -1, -1, -1, 0}, {-1, 3, -1, -1, 0, -1, -1, -1},
|
||||
{-1, -1, -1, 3, -1, -1, 0, -1}, {1, -1, -1, -1, -1, 3, -1, -1},
|
||||
{3, -1, 1, 3, -1, -1, 3, -1}, {-1, 0, -1, -1, 3, -1, 3, -1}};
|
||||
|
||||
const std::vector<std::vector<int> > big = {
|
||||
const std::vector<std::vector<int>> big = {
|
||||
{3, -1, -1, -1, 2, -1, 1, -1, 1, 2},
|
||||
{1, -1, 0, -1, 3, -1, 2, 0, -1, -1},
|
||||
{-1, 3, -1, -1, -1, -1, -1, -1, 3, -1},
|
||||
|
||||
Reference in New Issue
Block a user