cleanups
This commit is contained in:
@@ -34,8 +34,8 @@ from typing import Dict, Sequence
|
||||
from absl import app
|
||||
from absl import flags
|
||||
|
||||
from ortools.sat.python import cp_model
|
||||
|
||||
from ortools.sat.python import cp_model
|
||||
|
||||
_INPUT = flags.DEFINE_string("input", "", "Input file to parse and solve.")
|
||||
_PARAMS = flags.DEFINE_string("params", "", "Sat solver parameters.")
|
||||
|
||||
@@ -26,9 +26,9 @@ import collections
|
||||
from absl import app
|
||||
from absl import flags
|
||||
|
||||
from ortools.sat.python import cp_model
|
||||
from ortools.scheduling import rcpsp_pb2
|
||||
from ortools.scheduling.python import rcpsp
|
||||
from ortools.sat.python import cp_model
|
||||
|
||||
_INPUT = flags.DEFINE_string("input", "", "Input file to parse and solve.")
|
||||
_OUTPUT_PROTO = flags.DEFINE_string(
|
||||
|
||||
@@ -68,12 +68,8 @@ def solve_sudoku() -> None:
|
||||
if initial_grid[i][j]:
|
||||
model.add(grid[(i, j)] == initial_grid[i][j])
|
||||
|
||||
model.export_to_file('/tmp/sudoku_sat.pb.txt')
|
||||
|
||||
# Solves and prints out the solution.
|
||||
solver = cp_model.CpSolver()
|
||||
solver.parameters.num_workers = 1
|
||||
solver.parameters.log_search_progress = True
|
||||
status = solver.solve(model)
|
||||
if status == cp_model.OPTIMAL:
|
||||
for i in line:
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "ortools/util/saturated_arithmetic.h"
|
||||
#include "ortools/util/sorted_interval_list.h"
|
||||
|
||||
ABSL_FLAG(bool, cp_model_dump_models, true,
|
||||
ABSL_FLAG(bool, cp_model_dump_models, false,
|
||||
"DEBUG ONLY. When set to true, SolveCpModel() will dump its model "
|
||||
"protos (original model, presolved model, mapping model) in text "
|
||||
"format to 'FLAGS_cp_model_dump_prefix'{model|presolved_model|"
|
||||
@@ -955,7 +955,6 @@ void RegisterFieldPrinters(
|
||||
if (field->type() == google::protobuf::FieldDescriptor::TYPE_MESSAGE) {
|
||||
if (field->message_type() == IntegerVariableProto::descriptor() ||
|
||||
field->message_type() == LinearExpressionProto::descriptor()) {
|
||||
LOG(INFO) << "########### Register printer";
|
||||
printer->RegisterFieldValuePrinter(field, new InlineFieldPrinter());
|
||||
} else {
|
||||
RegisterFieldPrinters(field->message_type(), descriptors, printer);
|
||||
|
||||
Reference in New Issue
Block a user