[CP-SAT] fix int_prod presolve; better checker; better treatment of floating point constraints (from the linear solver) and objective

This commit is contained in:
Laurent Perron
2021-12-08 11:48:14 +01:00
parent 0fa4545ed5
commit ef4106b549
3 changed files with 9 additions and 17 deletions

View File

@@ -166,24 +166,13 @@ absl::StatusOr<MPSolutionResponse> SatSolveProto(
}
return response;
}
MPModelProto* const mp_model = request.mutable_model();
// Abort if there is constraint type we don't currently support.
for (const MPGeneralConstraintProto& general_constraint :
mp_model->general_constraint()) {
switch (general_constraint.general_constraint_case()) {
case MPGeneralConstraintProto::kIndicatorConstraint:
break;
case MPGeneralConstraintProto::kAndConstraint:
break;
case MPGeneralConstraintProto::kOrConstraint:
break;
default:
SOLVER_LOG(&logger, "General constraints of type ",
general_constraint.general_constraint_case(),
" are not supported.");
return ModelInvalidResponse(logger, "Unsupported constraint type");
}
// We start by some extra validation since our code do not accept any kind
// of input.
MPModelProto* const mp_model = request.mutable_model();
if (!sat::MPModelProtoValidationBeforeConversion(params, *mp_model,
&logger)) {
return ModelInvalidResponse(logger, "Extra CP-SAT validation failed.");
}
// This is good to do before any presolve.

View File

@@ -15,6 +15,7 @@
#define OR_TOOLS_LINEAR_SOLVER_SAT_PROTO_SOLVER_H_
#include <functional>
#include <string>
#include "absl/status/statusor.h"
#include "ortools/linear_solver/linear_solver.pb.h"

View File

@@ -14,6 +14,8 @@
#ifndef OR_TOOLS_LINEAR_SOLVER_SCIP_PROTO_SOLVER_H_
#define OR_TOOLS_LINEAR_SOLVER_SCIP_PROTO_SOLVER_H_
#include <string>
#include "absl/status/statusor.h"
#include "ortools/linear_solver/linear_solver.pb.h"
#include "scip/type_scip.h"