sync with internal code; minor changes
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "ortools/base/join.h"
|
||||
#if defined(_MSC_VER)
|
||||
#include <io.h>
|
||||
#define access _access
|
||||
@@ -27,7 +28,6 @@
|
||||
|
||||
#include "ortools/base/file.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/join.h"
|
||||
|
||||
File::File(FILE* const f_des, const std::string& name) : f_(f_des), name_(name) {}
|
||||
|
||||
|
||||
@@ -312,12 +312,12 @@ void MPVariable::SetInteger(bool integer) {
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Version -----
|
||||
// ----- Interface shortcuts -----
|
||||
|
||||
bool MPSolver::IsMIP() const { return interface_->IsMIP(); }
|
||||
|
||||
std::string MPSolver::SolverVersion() const { return interface_->SolverVersion(); }
|
||||
|
||||
// ---- Underlying solver ----
|
||||
|
||||
void* MPSolver::underlying_solver() { return interface_->underlying_solver(); }
|
||||
|
||||
// ---- Solver-specific parameters ----
|
||||
@@ -920,9 +920,9 @@ MPSolver::ResultStatus MPSolver::Solve(const MPSolverParameters& param) {
|
||||
|
||||
MPSolver::ResultStatus status = interface_->Solve(param);
|
||||
if (FLAGS_verify_solution) {
|
||||
if (status != MPSolver::OPTIMAL) {
|
||||
VLOG(1) << "--verify_solution enabled, but the solver did not find an"
|
||||
<< " optimal solution: skipping the verification.";
|
||||
if (status != MPSolver::OPTIMAL && status != MPSolver::FEASIBLE) {
|
||||
VLOG(1) << "--verify_solution enabled, but the solver did not find a"
|
||||
<< " solution: skipping the verification.";
|
||||
} else if (!VerifySolution(
|
||||
param.GetDoubleParam(MPSolverParameters::PRIMAL_TOLERANCE),
|
||||
FLAGS_log_verification_errors)) {
|
||||
|
||||
@@ -216,6 +216,8 @@ class MPSolver {
|
||||
// targets that you linked).
|
||||
static bool SupportsProblemType(OptimizationProblemType problem_type);
|
||||
|
||||
bool IsMIP() const;
|
||||
|
||||
std::string Name() const {
|
||||
return name_; // Set at construction.
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ package operations_research;
|
||||
// MPVariableProto furthermore stores:
|
||||
// - The coefficient of the variable in the objective.
|
||||
// - Whether the variable is integer.
|
||||
// - Whether the variable domain is {0} union [lower_bound, upper_bound].
|
||||
message MPVariableProto {
|
||||
// lower_bound must be <= upper_bound.
|
||||
optional double lower_bound = 1 [default = -inf];
|
||||
@@ -97,7 +96,7 @@ message MPConstraintProto {
|
||||
optional bool is_lazy = 5 [default = false];
|
||||
}
|
||||
|
||||
// This message encode a partial (or full) assignment of the variables of a
|
||||
// This message encodes a partial (or full) assignment of the variables of a
|
||||
// MPModelProto problem. The indices in var_index should be unique and valid
|
||||
// variable indices of the associated problem.
|
||||
message PartialVariableAssignment {
|
||||
|
||||
@@ -310,6 +310,11 @@ class SumWithOneMissing {
|
||||
++num_infinities_;
|
||||
}
|
||||
|
||||
Fractional Sum() const {
|
||||
if (num_infinities_ > 0) return Infinity();
|
||||
return sum_.Value();
|
||||
}
|
||||
|
||||
Fractional SumWithout(Fractional x) const {
|
||||
if (IsFinite(x)) {
|
||||
if (num_infinities_ > 0) return Infinity();
|
||||
|
||||
Reference in New Issue
Block a user