remove obsolete macro
This commit is contained in:
@@ -547,6 +547,10 @@ class KnapsackBruteForceSolver : public BaseKnapsackSolver {
|
||||
public:
|
||||
explicit KnapsackBruteForceSolver(const std::string& solver_name);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackBruteForceSolver(const KnapsackBruteForceSolver&) = delete;
|
||||
KnapsackBruteForceSolver& operator=(const KnapsackBruteForceSolver&) = delete;
|
||||
|
||||
// Initializes the solver and enters the problem to be solved.
|
||||
void Init(const std::vector<int64_t>& profits,
|
||||
const std::vector<std::vector<int64_t>>& weights,
|
||||
@@ -566,8 +570,6 @@ class KnapsackBruteForceSolver : public BaseKnapsackSolver {
|
||||
int64_t capacity_;
|
||||
int64_t best_solution_profit_;
|
||||
uint32_t best_solution_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackBruteForceSolver);
|
||||
};
|
||||
|
||||
KnapsackBruteForceSolver::KnapsackBruteForceSolver(
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/util/time_limit.h"
|
||||
|
||||
namespace operations_research {
|
||||
@@ -196,6 +195,13 @@ class KnapsackSolver {
|
||||
|
||||
explicit KnapsackSolver(const std::string& solver_name);
|
||||
KnapsackSolver(SolverType solver_type, const std::string& solver_name);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackSolver(const KnapsackSolver&) = delete;
|
||||
KnapsackSolver& operator=(const KnapsackSolver&) = delete;
|
||||
#endif
|
||||
|
||||
virtual ~KnapsackSolver();
|
||||
|
||||
/**
|
||||
@@ -257,8 +263,6 @@ class KnapsackSolver {
|
||||
bool use_reduction_;
|
||||
double time_limit_seconds_;
|
||||
std::unique_ptr<TimeLimit> time_limit_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackSolver);
|
||||
};
|
||||
|
||||
#if !defined(SWIG)
|
||||
@@ -336,6 +340,13 @@ class KnapsackSearchNode {
|
||||
public:
|
||||
KnapsackSearchNode(const KnapsackSearchNode* parent,
|
||||
const KnapsackAssignment& assignment);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackSearchNode(const KnapsackSearchNode&) = delete;
|
||||
KnapsackSearchNode& operator=(const KnapsackSearchNode&) = delete;
|
||||
#endif
|
||||
|
||||
int depth() const { return depth_; }
|
||||
const KnapsackSearchNode* parent() const { return parent_; }
|
||||
const KnapsackAssignment& assignment() const { return assignment_; }
|
||||
@@ -366,8 +377,6 @@ class KnapsackSearchNode {
|
||||
// 'next_item_id' field allows to avoid an O(number_of_items) scan to find
|
||||
// next item to select. This is done for free by the upper bound computation.
|
||||
int next_item_id_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackSearchNode);
|
||||
};
|
||||
|
||||
// ----- KnapsackSearchPath -----
|
||||
@@ -390,6 +399,13 @@ class KnapsackSearchPath {
|
||||
public:
|
||||
KnapsackSearchPath(const KnapsackSearchNode& from,
|
||||
const KnapsackSearchNode& to);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackSearchPath(const KnapsackSearchPath&) = delete;
|
||||
KnapsackSearchPath& operator=(const KnapsackSearchPath&) = delete;
|
||||
#endif
|
||||
|
||||
void Init();
|
||||
const KnapsackSearchNode& from() const { return from_; }
|
||||
const KnapsackSearchNode& via() const { return *via_; }
|
||||
@@ -401,8 +417,6 @@ class KnapsackSearchPath {
|
||||
const KnapsackSearchNode& from_;
|
||||
const KnapsackSearchNode* via_; // Computed in 'Init'.
|
||||
const KnapsackSearchNode& to_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackSearchPath);
|
||||
};
|
||||
|
||||
// ----- KnapsackState -----
|
||||
@@ -411,6 +425,12 @@ class KnapsackState {
|
||||
public:
|
||||
KnapsackState();
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackState(const KnapsackState&) = delete;
|
||||
KnapsackState& operator=(const KnapsackState&) = delete;
|
||||
#endif
|
||||
|
||||
// Initializes vectors with number_of_items set to false (i.e. not bound yet).
|
||||
void Init(int number_of_items);
|
||||
// Updates the state by applying or reverting a decision.
|
||||
@@ -429,8 +449,6 @@ class KnapsackState {
|
||||
// the absence (false) of item_i in the current solution.
|
||||
std::vector<bool> is_bound_;
|
||||
std::vector<bool> is_in_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackState);
|
||||
};
|
||||
|
||||
// ----- KnapsackPropagator -----
|
||||
@@ -444,6 +462,13 @@ class KnapsackState {
|
||||
class KnapsackPropagator {
|
||||
public:
|
||||
explicit KnapsackPropagator(const KnapsackState& state);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackPropagator(const KnapsackPropagator&) = delete;
|
||||
KnapsackPropagator& operator=(const KnapsackPropagator&) = delete;
|
||||
#endif
|
||||
|
||||
virtual ~KnapsackPropagator();
|
||||
|
||||
// Initializes data structure and then calls InitPropagator.
|
||||
@@ -503,8 +528,6 @@ class KnapsackPropagator {
|
||||
int64_t profit_lower_bound_;
|
||||
int64_t profit_upper_bound_;
|
||||
const KnapsackState& state_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackPropagator);
|
||||
};
|
||||
|
||||
// ----- KnapsackCapacityPropagator -----
|
||||
@@ -530,6 +553,14 @@ class KnapsackPropagator {
|
||||
class KnapsackCapacityPropagator : public KnapsackPropagator {
|
||||
public:
|
||||
KnapsackCapacityPropagator(const KnapsackState& state, int64_t capacity);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackCapacityPropagator(const KnapsackCapacityPropagator&) = delete;
|
||||
KnapsackCapacityPropagator& operator=(const KnapsackCapacityPropagator&) =
|
||||
delete;
|
||||
#endif
|
||||
|
||||
~KnapsackCapacityPropagator() override;
|
||||
void ComputeProfitBounds() override;
|
||||
int GetNextItemId() const override { return break_item_id_; }
|
||||
@@ -562,8 +593,6 @@ class KnapsackCapacityPropagator : public KnapsackPropagator {
|
||||
int break_item_id_;
|
||||
std::vector<KnapsackItemPtr> sorted_items_;
|
||||
int64_t profit_max_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackCapacityPropagator);
|
||||
};
|
||||
|
||||
// ----- BaseKnapsackSolver -----
|
||||
@@ -610,6 +639,13 @@ class BaseKnapsackSolver {
|
||||
class KnapsackGenericSolver : public BaseKnapsackSolver {
|
||||
public:
|
||||
explicit KnapsackGenericSolver(const std::string& solver_name);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
KnapsackGenericSolver(const KnapsackGenericSolver&) = delete;
|
||||
KnapsackGenericSolver& operator=(const KnapsackGenericSolver&) = delete;
|
||||
#endif
|
||||
|
||||
~KnapsackGenericSolver() override;
|
||||
|
||||
// Initializes the solver and enters the problem to be solved.
|
||||
@@ -670,8 +706,6 @@ class KnapsackGenericSolver : public BaseKnapsackSolver {
|
||||
KnapsackState state_;
|
||||
int64_t best_solution_profit_;
|
||||
std::vector<bool> best_solution_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(KnapsackGenericSolver);
|
||||
};
|
||||
#endif // SWIG
|
||||
} // namespace operations_research
|
||||
|
||||
@@ -120,6 +120,10 @@ class ProblemState {
|
||||
public:
|
||||
explicit ProblemState(const sat::LinearBooleanProblem& problem);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
ProblemState(const ProblemState&) = delete;
|
||||
ProblemState& operator=(const ProblemState&) = delete;
|
||||
|
||||
// Sets parameters, used for instance to get the tolerance, the gap limit...
|
||||
void SetParameters(const BopParameters& parameters) {
|
||||
parameters_ = parameters;
|
||||
@@ -242,8 +246,6 @@ class ProblemState {
|
||||
|
||||
// Manage the set of the problem binary clauses (including the learned ones).
|
||||
sat::BinaryClauseManager binary_clause_manager_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ProblemState);
|
||||
};
|
||||
|
||||
// This struct represents what has been learned on the problem state by
|
||||
|
||||
@@ -63,6 +63,10 @@ class SatWrapper {
|
||||
public:
|
||||
explicit SatWrapper(sat::SatSolver* sat_solver);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
SatWrapper(const SatWrapper&) = delete;
|
||||
SatWrapper& operator=(const SatWrapper&) = delete;
|
||||
|
||||
// Returns the current state of the solver propagation trail.
|
||||
std::vector<sat::Literal> FullSatTrail() const;
|
||||
|
||||
@@ -107,7 +111,6 @@ class SatWrapper {
|
||||
|
||||
private:
|
||||
sat::SatSolver* sat_solver_;
|
||||
DISALLOW_COPY_AND_ASSIGN(SatWrapper);
|
||||
};
|
||||
|
||||
// Forward declaration.
|
||||
@@ -281,6 +284,12 @@ class AssignmentAndConstraintFeasibilityMaintainer {
|
||||
explicit AssignmentAndConstraintFeasibilityMaintainer(
|
||||
const sat::LinearBooleanProblem& problem, absl::BitGenRef random);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
AssignmentAndConstraintFeasibilityMaintainer(
|
||||
const AssignmentAndConstraintFeasibilityMaintainer&) = delete;
|
||||
AssignmentAndConstraintFeasibilityMaintainer& operator=(
|
||||
const AssignmentAndConstraintFeasibilityMaintainer&) = delete;
|
||||
|
||||
// When we construct the problem, we treat the objective as one constraint.
|
||||
// This is the index of this special "objective" constraint.
|
||||
static const ConstraintIndex kObjectiveConstraint;
|
||||
@@ -426,8 +435,6 @@ class AssignmentAndConstraintFeasibilityMaintainer {
|
||||
NonOrderedSetHasher<ConstraintIndexWithDirection> constraint_set_hasher_;
|
||||
absl::flat_hash_map<uint64_t, std::vector<sat::Literal>>
|
||||
hash_to_potential_repairs_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AssignmentAndConstraintFeasibilityMaintainer);
|
||||
};
|
||||
|
||||
// This class is an utility class used to select which infeasible constraint to
|
||||
@@ -455,6 +462,11 @@ class OneFlipConstraintRepairer {
|
||||
const AssignmentAndConstraintFeasibilityMaintainer& maintainer,
|
||||
const sat::VariablesAssignment& sat_assignment);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
OneFlipConstraintRepairer(const OneFlipConstraintRepairer&) = delete;
|
||||
OneFlipConstraintRepairer& operator=(const OneFlipConstraintRepairer&) =
|
||||
delete;
|
||||
|
||||
static const ConstraintIndex kInvalidConstraint;
|
||||
static const TermIndex kInitTerm;
|
||||
static const TermIndex kInvalidTerm;
|
||||
@@ -506,8 +518,6 @@ class OneFlipConstraintRepairer {
|
||||
by_constraint_matrix_;
|
||||
const AssignmentAndConstraintFeasibilityMaintainer& maintainer_;
|
||||
const sat::VariablesAssignment& sat_assignment_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(OneFlipConstraintRepairer);
|
||||
};
|
||||
|
||||
// This class is used to iterate on all assignments that can be obtained by
|
||||
@@ -522,6 +532,12 @@ class LocalSearchAssignmentIterator {
|
||||
int max_num_broken_constraints,
|
||||
absl::BitGenRef random,
|
||||
SatWrapper* sat_wrapper);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LocalSearchAssignmentIterator(const LocalSearchAssignmentIterator&) = delete;
|
||||
LocalSearchAssignmentIterator& operator=(
|
||||
const LocalSearchAssignmentIterator&) = delete;
|
||||
|
||||
~LocalSearchAssignmentIterator();
|
||||
|
||||
// Parameters of the LS algorithm.
|
||||
@@ -650,8 +666,6 @@ class LocalSearchAssignmentIterator {
|
||||
int64_t num_improvements_;
|
||||
int64_t num_improvements_by_one_flip_repairs_;
|
||||
int64_t num_inspected_one_flip_repairs_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LocalSearchAssignmentIterator);
|
||||
};
|
||||
|
||||
} // namespace bop
|
||||
|
||||
@@ -31,6 +31,11 @@ namespace bop {
|
||||
class IntegralSolver {
|
||||
public:
|
||||
IntegralSolver();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
IntegralSolver(const IntegralSolver&) = delete;
|
||||
IntegralSolver& operator=(const IntegralSolver&) = delete;
|
||||
|
||||
~IntegralSolver() = default;
|
||||
|
||||
// Sets the solver parameters.
|
||||
@@ -72,8 +77,6 @@ class IntegralSolver {
|
||||
glop::DenseRow variable_values_;
|
||||
glop::Fractional objective_value_;
|
||||
glop::Fractional best_bound_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(IntegralSolver);
|
||||
};
|
||||
} // namespace bop
|
||||
} // namespace operations_research
|
||||
|
||||
@@ -55,6 +55,11 @@ namespace glop {
|
||||
class EtaMatrix {
|
||||
public:
|
||||
EtaMatrix(ColIndex eta_col, const ScatteredColumn& direction);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
EtaMatrix(const EtaMatrix&) = delete;
|
||||
EtaMatrix& operator=(const EtaMatrix&) = delete;
|
||||
|
||||
virtual ~EtaMatrix();
|
||||
|
||||
// Solves the system y.E = c, 'c' beeing the initial value of 'y'.
|
||||
@@ -100,8 +105,6 @@ class EtaMatrix {
|
||||
// stored in eta_col_coefficient_ instead.
|
||||
DenseColumn eta_coeff_;
|
||||
SparseColumn sparse_eta_coeff_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(EtaMatrix);
|
||||
};
|
||||
|
||||
// An eta factorization corresponds to the product of k eta matrices,
|
||||
@@ -112,6 +115,11 @@ class EtaMatrix {
|
||||
class EtaFactorization {
|
||||
public:
|
||||
EtaFactorization();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
EtaFactorization(const EtaFactorization&) = delete;
|
||||
EtaFactorization& operator=(const EtaFactorization&) = delete;
|
||||
|
||||
virtual ~EtaFactorization();
|
||||
|
||||
// Deletes all eta matrices.
|
||||
@@ -136,8 +144,6 @@ class EtaFactorization {
|
||||
|
||||
private:
|
||||
std::vector<EtaMatrix*> eta_matrix_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(EtaFactorization);
|
||||
};
|
||||
|
||||
// A basis factorization is the product of an eta factorization and
|
||||
@@ -155,6 +161,11 @@ class BasisFactorization {
|
||||
public:
|
||||
BasisFactorization(const CompactSparseMatrix* compact_matrix,
|
||||
const RowToColMapping* basis);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
BasisFactorization(const BasisFactorization&) = delete;
|
||||
BasisFactorization& operator=(const BasisFactorization&) = delete;
|
||||
|
||||
virtual ~BasisFactorization();
|
||||
|
||||
// Sets the parameters for this component.
|
||||
@@ -382,8 +393,6 @@ class BasisFactorization {
|
||||
// mutable because the Solve() functions are const but need to update this.
|
||||
double last_factorization_deterministic_time_ = 0.0;
|
||||
mutable double deterministic_time_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BasisFactorization);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -51,6 +51,10 @@ class DualEdgeNorms {
|
||||
// Takes references to the linear program data we need.
|
||||
explicit DualEdgeNorms(const BasisFactorization& basis_factorization);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
DualEdgeNorms(const DualEdgeNorms&) = delete;
|
||||
DualEdgeNorms& operator=(const DualEdgeNorms&) = delete;
|
||||
|
||||
// Clears, i.e. reset the object to its initial value. This will trigger a
|
||||
// full norm recomputation on the next GetEdgeSquaredNorms().
|
||||
void Clear();
|
||||
@@ -136,8 +140,6 @@ class DualEdgeNorms {
|
||||
|
||||
// Whether we should recompute the norm from scratch.
|
||||
bool recompute_edge_squared_norms_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DualEdgeNorms);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -49,6 +49,10 @@ class EnteringVariable {
|
||||
EnteringVariable(const VariablesInfo& variables_info, absl::BitGenRef random,
|
||||
ReducedCosts* reduced_costs);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
EnteringVariable(const EnteringVariable&) = delete;
|
||||
EnteringVariable& operator=(const EnteringVariable&) = delete;
|
||||
|
||||
// Dual optimization phase (i.e. phase II) ratio test.
|
||||
// Returns the index of the entering column given that we want to move along
|
||||
// the "update" row vector in the direction given by the sign of
|
||||
@@ -133,8 +137,6 @@ class EnteringVariable {
|
||||
|
||||
// Counter for the deterministic time.
|
||||
int64_t num_operations_ = 0;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(EnteringVariable);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -51,6 +51,10 @@ class InitialBasis {
|
||||
const DenseRow& upper_bound,
|
||||
const VariableTypeRow& variable_type);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
InitialBasis(const InitialBasis&) = delete;
|
||||
InitialBasis& operator=(const InitialBasis&) = delete;
|
||||
|
||||
// Completes the entries of the given basis that are equal to kInvalidCol with
|
||||
// one of the first num_cols columns of A using Bixby's algorithm.
|
||||
//
|
||||
@@ -127,8 +131,6 @@ class InitialBasis {
|
||||
const DenseRow& lower_bound_;
|
||||
const DenseRow& upper_bound_;
|
||||
const VariableTypeRow& variable_type_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InitialBasis);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -32,6 +32,10 @@ class LPSolver {
|
||||
public:
|
||||
LPSolver();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LPSolver(const LPSolver&) = delete;
|
||||
LPSolver& operator=(const LPSolver&) = delete;
|
||||
|
||||
// Sets and gets the solver parameters.
|
||||
// See the proto for an extensive documentation.
|
||||
void SetParameters(const GlopParameters& parameters);
|
||||
@@ -299,8 +303,6 @@ class LPSolver {
|
||||
|
||||
// The number of times Solve() was called. Used to number dump files.
|
||||
int num_solves_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LPSolver);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -38,6 +38,10 @@ class LuFactorization {
|
||||
public:
|
||||
LuFactorization();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LuFactorization(const LuFactorization&) = delete;
|
||||
LuFactorization& operator=(const LuFactorization&) = delete;
|
||||
|
||||
// Returns true if the LuFactorization is a factorization of the identity
|
||||
// matrix. In this state, all the Solve() functions will work for any
|
||||
// vector dimension.
|
||||
@@ -298,8 +302,6 @@ class LuFactorization {
|
||||
|
||||
// The class doing the Markowitz LU factorization.
|
||||
Markowitz markowitz_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LuFactorization);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -64,6 +64,10 @@ class PrimalEdgeNorms {
|
||||
const VariablesInfo& variables_info,
|
||||
const BasisFactorization& basis_factorization);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
PrimalEdgeNorms(const PrimalEdgeNorms&) = delete;
|
||||
PrimalEdgeNorms& operator=(const PrimalEdgeNorms&) = delete;
|
||||
|
||||
// Clears, i.e. resets the object to its initial value. This will trigger
|
||||
// a recomputation for the next Get*() method call.
|
||||
void Clear();
|
||||
@@ -225,8 +229,6 @@ class PrimalEdgeNorms {
|
||||
// Boolean(s) to set to false when the norms are changed outside of the
|
||||
// UpdateBeforeBasisPivot() function.
|
||||
std::vector<bool*> watchers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PrimalEdgeNorms);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -138,6 +138,11 @@ class RankOneUpdateFactorization {
|
||||
// that switch between a sparse/dense version.
|
||||
RankOneUpdateFactorization() : hypersparse_ratio_(0.05) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RankOneUpdateFactorization(const RankOneUpdateFactorization&) = delete;
|
||||
RankOneUpdateFactorization& operator=(const RankOneUpdateFactorization&) =
|
||||
delete;
|
||||
|
||||
// This is currently only visible for testing.
|
||||
void set_hypersparse_ratio(double value) { hypersparse_ratio_ = value; }
|
||||
|
||||
@@ -242,7 +247,6 @@ class RankOneUpdateFactorization {
|
||||
double hypersparse_ratio_;
|
||||
EntryIndex num_entries_;
|
||||
std::vector<RankOneUpdateElementaryMatrix> elementary_matrices_;
|
||||
DISALLOW_COPY_AND_ASSIGN(RankOneUpdateFactorization);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -58,6 +58,10 @@ class ReducedCosts {
|
||||
const BasisFactorization& basis_factorization,
|
||||
absl::BitGenRef random);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
ReducedCosts(const ReducedCosts&) = delete;
|
||||
ReducedCosts& operator=(const ReducedCosts&) = delete;
|
||||
|
||||
// If this is true, then the caller must re-factorize the basis before the
|
||||
// next call to GetReducedCosts().
|
||||
bool NeedsBasisRefactorization() const;
|
||||
@@ -286,8 +290,6 @@ class ReducedCosts {
|
||||
std::vector<bool*> watchers_;
|
||||
|
||||
double deterministic_time_ = 0.0;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ReducedCosts);
|
||||
};
|
||||
|
||||
// Maintains the list of dual infeasible positions and their associated prices.
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/random/bit_gen_ref.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/glop/basis_representation.h"
|
||||
#include "ortools/glop/dual_edge_norms.h"
|
||||
@@ -126,6 +125,10 @@ class RevisedSimplex {
|
||||
public:
|
||||
RevisedSimplex();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RevisedSimplex(const RevisedSimplex&) = delete;
|
||||
RevisedSimplex& operator=(const RevisedSimplex&) = delete;
|
||||
|
||||
// Sets or gets the algorithm parameters to be used on the next Solve().
|
||||
void SetParameters(const GlopParameters& parameters);
|
||||
const GlopParameters& GetParameters() const { return parameters_; }
|
||||
@@ -826,8 +829,6 @@ class RevisedSimplex {
|
||||
|
||||
// This is used by Polish().
|
||||
DenseRow integrality_scale_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RevisedSimplex);
|
||||
};
|
||||
|
||||
// Hides the details of the dictionary matrix implementation. In the future,
|
||||
@@ -848,6 +849,10 @@ class RevisedSimplexDictionary {
|
||||
ABSL_DIE_IF_NULL(revised_simplex)->ComputeDictionary(col_scales)),
|
||||
basis_vars_(ABSL_DIE_IF_NULL(revised_simplex)->GetBasisVector()) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RevisedSimplexDictionary(const RevisedSimplexDictionary&) = delete;
|
||||
RevisedSimplexDictionary& operator=(const RevisedSimplexDictionary&) = delete;
|
||||
|
||||
ConstIterator begin() const { return dictionary_.begin(); }
|
||||
ConstIterator end() const { return dictionary_.end(); }
|
||||
|
||||
@@ -860,7 +865,6 @@ class RevisedSimplexDictionary {
|
||||
private:
|
||||
const RowMajorSparseMatrix dictionary_;
|
||||
const RowToColMapping basis_vars_;
|
||||
DISALLOW_COPY_AND_ASSIGN(RevisedSimplexDictionary);
|
||||
};
|
||||
|
||||
// TODO(user): When a row-by-row generation of the dictionary is supported,
|
||||
|
||||
@@ -47,6 +47,10 @@ class UpdateRow {
|
||||
const VariablesInfo& variables_info, const RowToColMapping& basis,
|
||||
const BasisFactorization& basis_factorization);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
UpdateRow(const UpdateRow&) = delete;
|
||||
UpdateRow& operator=(const UpdateRow&) = delete;
|
||||
|
||||
// Invalidates the current update row and unit_row_left_inverse so the next
|
||||
// call to ComputeUpdateRow() will recompute everything and not just return
|
||||
// right away.
|
||||
@@ -162,8 +166,6 @@ class UpdateRow {
|
||||
// Glop standard classes.
|
||||
GlopParameters parameters_;
|
||||
Stats stats_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(UpdateRow);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -52,6 +52,10 @@ class VariableValues {
|
||||
DualEdgeNorms* dual_edge_norms,
|
||||
DynamicMaximum<RowIndex>* dual_prices);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
VariableValues(const VariableValues&) = delete;
|
||||
VariableValues& operator=(const VariableValues&) = delete;
|
||||
|
||||
// Getters for the variable values.
|
||||
Fractional Get(ColIndex col) const { return variable_values_[col]; }
|
||||
const DenseRow& GetDenseRow() const { return variable_values_; }
|
||||
@@ -175,8 +179,6 @@ class VariableValues {
|
||||
|
||||
// A temporary scattered column that is always reset to all zero after use.
|
||||
ScatteredColumn initially_all_zero_scratchpad_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(VariableValues);
|
||||
};
|
||||
|
||||
template <typename Rows>
|
||||
|
||||
@@ -57,6 +57,10 @@ class VariablesInfo {
|
||||
// Takes references to the linear program data we need.
|
||||
explicit VariablesInfo(const CompactSparseMatrix& matrix);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
VariablesInfo(const VariablesInfo&) = delete;
|
||||
VariablesInfo& operator=(const VariablesInfo&) = delete;
|
||||
|
||||
// Updates the internal bounds and recomputes the variable types from the
|
||||
// bounds (this is the only function that changes them).
|
||||
//
|
||||
@@ -236,8 +240,6 @@ class VariablesInfo {
|
||||
// Whether we are between the calls TransformToDualPhaseIProblem() and
|
||||
// EndDualPhaseI().
|
||||
bool in_dual_phase_one_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(VariablesInfo);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -60,6 +60,13 @@ class SimpleLinearSumAssignment {
|
||||
// New node indices will be created lazily by AddArcWithCost().
|
||||
SimpleLinearSumAssignment();
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
SimpleLinearSumAssignment(const SimpleLinearSumAssignment&) = delete;
|
||||
SimpleLinearSumAssignment& operator=(const SimpleLinearSumAssignment&) =
|
||||
delete;
|
||||
#endif
|
||||
|
||||
// Adds an arc from a left node to a right node with a given cost.
|
||||
// * Node indices must be non-negative (>= 0). For a perfect
|
||||
// matching to exist on n nodes, the values taken by "left_node"
|
||||
@@ -122,7 +129,6 @@ class SimpleLinearSumAssignment {
|
||||
std::vector<CostValue> arc_cost_;
|
||||
std::vector<ArcIndex> assignment_arcs_;
|
||||
CostValue optimal_cost_;
|
||||
DISALLOW_COPY_AND_ASSIGN(SimpleLinearSumAssignment);
|
||||
};
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
@@ -177,7 +177,6 @@
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/util/permutation.h"
|
||||
#include "ortools/util/zvector.h"
|
||||
@@ -579,6 +578,11 @@ class ForwardStaticGraph
|
||||
: ArrayIndexCycleHandler<NodeIndexType, ArcIndexType>(&data[kFirstArc]),
|
||||
annotation_handler_(annotation_handler) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CycleHandlerForAnnotatedArcs(const CycleHandlerForAnnotatedArcs&) = delete;
|
||||
CycleHandlerForAnnotatedArcs& operator=(
|
||||
const CycleHandlerForAnnotatedArcs&) = delete;
|
||||
|
||||
void SetTempFromIndex(ArcIndexType source) override {
|
||||
Base::SetTempFromIndex(source);
|
||||
annotation_handler_->SetTempFromIndex(source);
|
||||
@@ -597,8 +601,6 @@ class ForwardStaticGraph
|
||||
|
||||
private:
|
||||
PermutationCycleHandler<ArcIndexType>* annotation_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CycleHandlerForAnnotatedArcs);
|
||||
};
|
||||
#endif // SWIG
|
||||
|
||||
@@ -1056,6 +1058,11 @@ class EbertGraphBase
|
||||
head_temp_(kNilNode),
|
||||
tail_temp_(kNilNode) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CycleHandlerForAnnotatedArcs(const CycleHandlerForAnnotatedArcs&) = delete;
|
||||
CycleHandlerForAnnotatedArcs& operator=(
|
||||
const CycleHandlerForAnnotatedArcs&) = delete;
|
||||
|
||||
void SetTempFromIndex(ArcIndexType source) override {
|
||||
if (annotation_handler_ != nullptr) {
|
||||
annotation_handler_->SetTempFromIndex(source);
|
||||
@@ -1100,8 +1107,6 @@ class EbertGraphBase
|
||||
DerivedGraph* graph_;
|
||||
NodeIndexType head_temp_;
|
||||
NodeIndexType tail_temp_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CycleHandlerForAnnotatedArcs);
|
||||
};
|
||||
#endif // SWIG
|
||||
|
||||
|
||||
@@ -207,7 +207,6 @@
|
||||
#include "absl/flags/declare.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/util/permutation.h"
|
||||
@@ -239,6 +238,10 @@ class LinearSumAssignment {
|
||||
// us later via the SetGraph() method, below.
|
||||
LinearSumAssignment(NodeIndex num_left_nodes, ArcIndex num_arcs);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LinearSumAssignment(const LinearSumAssignment&) = delete;
|
||||
LinearSumAssignment& operator=(const LinearSumAssignment&) = delete;
|
||||
|
||||
~LinearSumAssignment() {}
|
||||
|
||||
// Sets the graph used by the LinearSumAssignment instance, for use
|
||||
@@ -949,8 +952,6 @@ class LinearSumAssignment {
|
||||
// Statistics giving the numbers of various operations the algorithm
|
||||
// has performed in the current iteration.
|
||||
Stats iteration_stats_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LinearSumAssignment);
|
||||
};
|
||||
|
||||
// Implementation of out-of-line LinearSumAssignment template member
|
||||
@@ -1026,6 +1027,10 @@ class CostValueCycleHandler : public PermutationCycleHandler<ArcIndexType> {
|
||||
explicit CostValueCycleHandler(std::vector<CostValue>* cost)
|
||||
: temp_(0), cost_(cost) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CostValueCycleHandler(const CostValueCycleHandler&) = delete;
|
||||
CostValueCycleHandler& operator=(const CostValueCycleHandler&) = delete;
|
||||
|
||||
void SetTempFromIndex(ArcIndexType source) override {
|
||||
temp_ = (*cost_)[source];
|
||||
}
|
||||
@@ -1044,8 +1049,6 @@ class CostValueCycleHandler : public PermutationCycleHandler<ArcIndexType> {
|
||||
private:
|
||||
CostValue temp_;
|
||||
std::vector<CostValue>* const cost_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CostValueCycleHandler);
|
||||
};
|
||||
|
||||
// Logically this class should be defined inside OptimizeGraphLayout,
|
||||
|
||||
@@ -70,6 +70,10 @@ struct AssignmentProblemSetup {
|
||||
cycle_handler_scoped(assignment_scoped->ArcAnnotationCycleHandler()),
|
||||
cycle_handler(cycle_handler_scoped.get()) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
AssignmentProblemSetup(const AssignmentProblemSetup&) = delete;
|
||||
AssignmentProblemSetup& operator=(const AssignmentProblemSetup&) = delete;
|
||||
|
||||
virtual ~AssignmentProblemSetup() { delete &assignment->Graph(); }
|
||||
|
||||
void Finalize() {
|
||||
@@ -86,9 +90,6 @@ struct AssignmentProblemSetup {
|
||||
std::unique_ptr<PermutationCycleHandler<typename GraphType::ArcIndex>>
|
||||
cycle_handler_scoped;
|
||||
PermutationCycleHandler<typename GraphType::ArcIndex>* cycle_handler;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AssignmentProblemSetup);
|
||||
};
|
||||
|
||||
// A fixture template to collect the types of graphs on which we want to base
|
||||
|
||||
@@ -130,7 +130,6 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/flow_problem.pb.h"
|
||||
@@ -156,6 +155,12 @@ class SimpleMaxFlow {
|
||||
// New node indices will be created lazily by AddArcWithCapacity().
|
||||
SimpleMaxFlow();
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
SimpleMaxFlow(const SimpleMaxFlow&) = delete;
|
||||
SimpleMaxFlow& operator=(const SimpleMaxFlow&) = delete;
|
||||
#endif
|
||||
|
||||
// Adds a directed arc with the given capacity from tail to head.
|
||||
// * Node indices and capacity must be non-negative (>= 0).
|
||||
// * Self-looping and duplicate arcs are supported.
|
||||
@@ -243,8 +248,6 @@ class SimpleMaxFlow {
|
||||
typedef ::util::ReverseArcStaticGraph<NodeIndex, ArcIndex> Graph;
|
||||
std::unique_ptr<Graph> underlying_graph_;
|
||||
std::unique_ptr<GenericMaxFlow<Graph> > underlying_max_flow_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SimpleMaxFlow);
|
||||
};
|
||||
|
||||
// Specific but efficient priority queue implementation. The priority type must
|
||||
@@ -266,6 +269,14 @@ class PriorityQueueWithRestrictedPush {
|
||||
public:
|
||||
PriorityQueueWithRestrictedPush() : even_queue_(), odd_queue_() {}
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
PriorityQueueWithRestrictedPush(const PriorityQueueWithRestrictedPush&) =
|
||||
delete;
|
||||
PriorityQueueWithRestrictedPush& operator=(
|
||||
const PriorityQueueWithRestrictedPush&) = delete;
|
||||
#endif
|
||||
|
||||
// Is the queue empty?
|
||||
bool IsEmpty() const;
|
||||
|
||||
@@ -290,8 +301,6 @@ class PriorityQueueWithRestrictedPush {
|
||||
// both vectors are always sorted by increasing priority.
|
||||
std::vector<std::pair<Element, IntegerPriority> > even_queue_;
|
||||
std::vector<std::pair<Element, IntegerPriority> > odd_queue_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PriorityQueueWithRestrictedPush);
|
||||
};
|
||||
|
||||
// We want an enum for the Status of a max flow run, and we want this
|
||||
@@ -333,6 +342,13 @@ class GenericMaxFlow : public MaxFlowStatusClass {
|
||||
// the memory of this class. source and sink must also be valid node of
|
||||
// graph.
|
||||
GenericMaxFlow(const Graph* graph, NodeIndex source, NodeIndex sink);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
GenericMaxFlow(const GenericMaxFlow&) = delete;
|
||||
GenericMaxFlow& operator=(const GenericMaxFlow&) = delete;
|
||||
#endif
|
||||
|
||||
virtual ~GenericMaxFlow() {}
|
||||
|
||||
// Returns the graph associated to the current object.
|
||||
@@ -640,9 +656,6 @@ class GenericMaxFlow : public MaxFlowStatusClass {
|
||||
|
||||
// Statistics about this class.
|
||||
mutable StatsGroup stats_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(GenericMaxFlow);
|
||||
};
|
||||
|
||||
#if !SWIG
|
||||
|
||||
@@ -176,7 +176,6 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/graph.h"
|
||||
@@ -252,6 +251,12 @@ class SimpleMinCostFlow : public MinCostFlowBase {
|
||||
explicit SimpleMinCostFlow(NodeIndex reserve_num_nodes = 0,
|
||||
ArcIndex reserve_num_arcs = 0);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
SimpleMinCostFlow(const SimpleMinCostFlow&) = delete;
|
||||
SimpleMinCostFlow& operator=(const SimpleMinCostFlow&) = delete;
|
||||
#endif
|
||||
|
||||
// Adds a directed arc from tail to head to the underlying graph with
|
||||
// a given capacity and cost per unit of flow.
|
||||
// * Node indices and the capacity must be non-negative (>= 0).
|
||||
@@ -351,8 +356,6 @@ class SimpleMinCostFlow : public MinCostFlowBase {
|
||||
FlowQuantity maximum_flow_;
|
||||
|
||||
bool scale_prices_ = true;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SimpleMinCostFlow);
|
||||
};
|
||||
|
||||
// Generic MinCostFlow that works with StarGraph and all the graphs handling
|
||||
@@ -389,6 +392,12 @@ class GenericMinCostFlow : public MinCostFlowBase {
|
||||
// initialize the memory of this class.
|
||||
explicit GenericMinCostFlow(const Graph* graph);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
GenericMinCostFlow(const GenericMinCostFlow&) = delete;
|
||||
GenericMinCostFlow& operator=(const GenericMinCostFlow&) = delete;
|
||||
#endif
|
||||
|
||||
// Returns the graph associated to the current object.
|
||||
const Graph* graph() const { return graph_; }
|
||||
|
||||
@@ -660,8 +669,6 @@ class GenericMinCostFlow : public MinCostFlowBase {
|
||||
|
||||
// Whether to scale prices, see SimpleMinCostFlow::SetPriceScaling().
|
||||
bool scale_prices_ = true;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(GenericMinCostFlow);
|
||||
};
|
||||
|
||||
#if !SWIG
|
||||
|
||||
@@ -208,6 +208,10 @@ void PathTree::GetPath(NodeIndex from, NodeIndex to,
|
||||
class DistanceContainer : public PathContainerImpl {
|
||||
public:
|
||||
DistanceContainer() : reverse_sources_(), distances_() {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
DistanceContainer(const DistanceContainer&) = delete;
|
||||
DistanceContainer& operator=(const DistanceContainer&) = delete;
|
||||
~DistanceContainer() override {}
|
||||
void Initialize(const std::vector<NodeIndex>& sources,
|
||||
const std::vector<NodeIndex>& destinations,
|
||||
@@ -253,14 +257,17 @@ class DistanceContainer : public PathContainerImpl {
|
||||
}
|
||||
|
||||
std::vector<std::vector<PathDistance> > distances_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DistanceContainer);
|
||||
};
|
||||
|
||||
// Path container which stores explicit paths and distances between path nodes.
|
||||
class InMemoryCompactPathContainer : public DistanceContainer {
|
||||
public:
|
||||
InMemoryCompactPathContainer() : trees_(), destinations_() {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
InMemoryCompactPathContainer(const InMemoryCompactPathContainer&) = delete;
|
||||
InMemoryCompactPathContainer& operator=(const InMemoryCompactPathContainer&) =
|
||||
delete;
|
||||
~InMemoryCompactPathContainer() override {}
|
||||
void Initialize(const std::vector<NodeIndex>& sources,
|
||||
const std::vector<NodeIndex>& destinations,
|
||||
@@ -291,8 +298,6 @@ class InMemoryCompactPathContainer : public DistanceContainer {
|
||||
private:
|
||||
std::vector<PathTree> trees_;
|
||||
std::vector<NodeIndex> destinations_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InMemoryCompactPathContainer);
|
||||
};
|
||||
|
||||
// Priority queue node entry in the boundary of the Dijkstra algorithm.
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/graph/ebert_graph.h"
|
||||
#include "ortools/graph/graph.h"
|
||||
@@ -104,6 +103,11 @@ class PathContainerImpl;
|
||||
class PathContainer {
|
||||
public:
|
||||
PathContainer();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
PathContainer(const PathContainer&) = delete;
|
||||
PathContainer& operator=(const PathContainer&) = delete;
|
||||
|
||||
~PathContainer();
|
||||
|
||||
// Returns the distance between node 'from' and node 'to' following the path
|
||||
@@ -153,8 +157,6 @@ class PathContainer {
|
||||
|
||||
private:
|
||||
std::unique_ptr<PathContainerImpl> container_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PathContainer);
|
||||
};
|
||||
|
||||
// Utility function which returns a vector containing all nodes of a graph.
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "ortools/base/container_logging.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/map_util.h"
|
||||
#include "ortools/base/status_builder.h"
|
||||
#include "ortools/base/stl_util.h"
|
||||
@@ -208,6 +207,11 @@ class DenseIntTopologicalSorterTpl {
|
||||
num_edges_(0),
|
||||
num_edges_added_since_last_duplicate_removal_(0) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
DenseIntTopologicalSorterTpl(const DenseIntTopologicalSorterTpl&) = delete;
|
||||
DenseIntTopologicalSorterTpl& operator=(const DenseIntTopologicalSorterTpl&) =
|
||||
delete;
|
||||
|
||||
// Performs in constant amortized time. Calling this will make all
|
||||
// node indices in [0 .. node_index] be valid node indices. If you
|
||||
// can avoid using AddNode(), you should! If you know the number of
|
||||
@@ -269,9 +273,6 @@ class DenseIntTopologicalSorterTpl {
|
||||
// RemoveDuplicates(). See the .cc.
|
||||
int num_edges_; // current total number of edges.
|
||||
int num_edges_added_since_last_duplicate_removal_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(DenseIntTopologicalSorterTpl);
|
||||
};
|
||||
|
||||
extern template class DenseIntTopologicalSorterTpl<false>;
|
||||
@@ -323,6 +324,10 @@ template <typename T, bool stable_sort = false,
|
||||
class TopologicalSorter {
|
||||
public:
|
||||
TopologicalSorter() {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
TopologicalSorter(const TopologicalSorter&) = delete;
|
||||
TopologicalSorter& operator=(const TopologicalSorter&) = delete;
|
||||
~TopologicalSorter() {}
|
||||
|
||||
// Adds a node to the graph, if it has not already been added via
|
||||
@@ -436,8 +441,6 @@ class TopologicalSorter {
|
||||
int LookupOrInsertNode(const T& node) {
|
||||
return gtl::LookupOrInsert(&node_to_index_, node, node_to_index_.size());
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TopologicalSorter);
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
|
||||
@@ -159,7 +159,6 @@
|
||||
#include "absl/time/time.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/linear_solver/linear_expr.h"
|
||||
#include "ortools/linear_solver/linear_solver.pb.h"
|
||||
#include "ortools/linear_solver/linear_solver_callback.h"
|
||||
@@ -239,6 +238,13 @@ class MPSolver {
|
||||
|
||||
/// Create a solver with the given name and underlying solver backend.
|
||||
MPSolver(const std::string& name, OptimizationProblemType problem_type);
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
MPSolver(const MPSolver&) = delete;
|
||||
MPSolver& operator=(const MPSolver&) = delete;
|
||||
#endif
|
||||
|
||||
virtual ~MPSolver();
|
||||
|
||||
/**
|
||||
@@ -953,8 +959,6 @@ class MPSolver {
|
||||
MPSolverResponseStatus LoadModelFromProtoInternal(
|
||||
const MPModelProto& input_model, ModelProtoNamesPolicy name_policy,
|
||||
bool check_model_validity, std::string* error_message);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MPSolver);
|
||||
};
|
||||
|
||||
inline bool SolverTypeIsMip(MPSolver::OptimizationProblemType solver_type) {
|
||||
@@ -988,6 +992,12 @@ inline std::string AbslUnparseFlag(
|
||||
/// A class to express a linear objective.
|
||||
class MPObjective {
|
||||
public:
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
MPObjective(const MPObjective&) = delete;
|
||||
MPObjective& operator=(const MPObjective&) = delete;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clears the offset, all variables and coefficients, and the optimization
|
||||
* direction.
|
||||
@@ -1110,13 +1120,17 @@ class MPObjective {
|
||||
absl::flat_hash_map<const MPVariable*, double> coefficients_;
|
||||
// Constant term.
|
||||
double offset_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MPObjective);
|
||||
};
|
||||
|
||||
/// The class for variables of a Mathematical Programming (MP) model.
|
||||
class MPVariable {
|
||||
public:
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
MPVariable(const MPVariable&) = delete;
|
||||
MPVariable& operator=(const MPVariable&) = delete;
|
||||
#endif
|
||||
|
||||
/// Returns the name of the variable.
|
||||
const std::string& name() const { return name_; }
|
||||
|
||||
@@ -1234,7 +1248,6 @@ class MPVariable {
|
||||
double reduced_cost_;
|
||||
int branching_priority_ = 0;
|
||||
MPSolverInterface* const interface_;
|
||||
DISALLOW_COPY_AND_ASSIGN(MPVariable);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1244,6 +1257,12 @@ class MPVariable {
|
||||
*/
|
||||
class MPConstraint {
|
||||
public:
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
MPConstraint(const MPConstraint&) = delete;
|
||||
MPConstraint& operator=(const MPConstraint&) = delete;
|
||||
#endif
|
||||
|
||||
/// Returns the name of the constraint.
|
||||
const std::string& name() const { return name_; }
|
||||
|
||||
@@ -1398,7 +1417,6 @@ class MPConstraint {
|
||||
|
||||
double dual_value_;
|
||||
MPSolverInterface* const interface_;
|
||||
DISALLOW_COPY_AND_ASSIGN(MPConstraint);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1518,6 +1536,12 @@ class MPSolverParameters {
|
||||
/// The constructor sets all parameters to their default value.
|
||||
MPSolverParameters();
|
||||
|
||||
#ifndef SWIG
|
||||
// This type is neither copyable nor movable.
|
||||
MPSolverParameters(const MPSolverParameters&) = delete;
|
||||
MPSolverParameters& operator=(const MPSolverParameters&) = delete;
|
||||
#endif
|
||||
|
||||
/// Sets a double parameter to a specific value.
|
||||
void SetDoubleParam(MPSolverParameters::DoubleParam param, double value);
|
||||
|
||||
@@ -1563,8 +1587,6 @@ class MPSolverParameters {
|
||||
// solver's default value. Only parameters for which the wrapper
|
||||
// does not define a default value need such an indicator.
|
||||
bool lp_algorithm_is_default_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MPSolverParameters);
|
||||
};
|
||||
|
||||
// Whether the given MPSolverResponseStatus (of a solve) would yield an RPC
|
||||
|
||||
@@ -82,6 +82,11 @@ void LineBreaker::Append(const std::string& s) {
|
||||
class MPModelProtoExporter {
|
||||
public:
|
||||
explicit MPModelProtoExporter(const MPModelProto& model);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
MPModelProtoExporter(const MPModelProtoExporter&) = delete;
|
||||
MPModelProtoExporter& operator=(const MPModelProtoExporter&) = delete;
|
||||
|
||||
bool ExportModelAsLpFormat(const MPModelExportOptions& options,
|
||||
std::string* output);
|
||||
bool ExportModelAsMpsFormat(const MPModelExportOptions& options,
|
||||
@@ -207,8 +212,6 @@ class MPModelProtoExporter {
|
||||
// Format for MPS file lines.
|
||||
std::unique_ptr<absl::ParsedFormat<'s', 's'>> mps_header_format_;
|
||||
std::unique_ptr<absl::ParsedFormat<'s', 's'>> mps_format_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MPModelProtoExporter);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "ortools/base/hash.h"
|
||||
#include "ortools/base/logging.h" // for CHECK*
|
||||
#include "ortools/base/macros.h" // for DISALLOW_COPY_AND_ASSIGN, NULL
|
||||
#include "ortools/glop/parameters.pb.h"
|
||||
#include "ortools/lp_data/lp_types.h"
|
||||
#include "ortools/lp_data/sparse.h"
|
||||
@@ -68,6 +67,10 @@ class LinearProgram {
|
||||
|
||||
LinearProgram();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LinearProgram(const LinearProgram&) = delete;
|
||||
LinearProgram& operator=(const LinearProgram&) = delete;
|
||||
|
||||
// Clears, i.e. reset the object to its initial value.
|
||||
void Clear();
|
||||
|
||||
@@ -650,8 +653,6 @@ class LinearProgram {
|
||||
|
||||
friend void Scale(LinearProgram* lp, SparseMatrixScaler* scaler,
|
||||
GlopParameters::ScalingAlgorithm scaling_method);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LinearProgram);
|
||||
};
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
@@ -51,6 +51,10 @@ class LPDecomposer {
|
||||
public:
|
||||
LPDecomposer();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LPDecomposer(const LPDecomposer&) = delete;
|
||||
LPDecomposer& operator=(const LPDecomposer&) = delete;
|
||||
|
||||
// Decomposes the problem into independent problems.
|
||||
// Note that a pointer is kept (no copy) on the linear_problem, so the problem
|
||||
// should not change during the life of the LPDecomposer object.
|
||||
@@ -84,8 +88,6 @@ class LPDecomposer {
|
||||
std::vector<std::vector<ColIndex>> clusters_;
|
||||
|
||||
mutable absl::Mutex mutex_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LPDecomposer);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/glop/parameters.pb.h"
|
||||
#include "ortools/glop/revised_simplex.h"
|
||||
@@ -80,6 +79,10 @@ class SparseMatrixScaler {
|
||||
public:
|
||||
SparseMatrixScaler();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
SparseMatrixScaler(const SparseMatrixScaler&) = delete;
|
||||
SparseMatrixScaler& operator=(const SparseMatrixScaler&) = delete;
|
||||
|
||||
// Initializes the object with the SparseMatrix passed as argument.
|
||||
// The row and column scaling factors are all set to 1.0 (i.e. no scaling.)
|
||||
// In terms of matrices, R and C are set to identity matrices.
|
||||
@@ -184,8 +187,6 @@ class SparseMatrixScaler {
|
||||
|
||||
// Array of scaling factors for each column. Indexed by column number.
|
||||
DenseRow col_scale_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SparseMatrixScaler);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -47,6 +47,10 @@ class Permutation {
|
||||
|
||||
explicit Permutation(IndexType size) : perm_(size.value(), IndexType(0)) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
Permutation(const Permutation&) = delete;
|
||||
Permutation& operator=(const Permutation&) = delete;
|
||||
|
||||
IndexType size() const { return IndexType(perm_.size()); }
|
||||
bool empty() const { return perm_.empty(); }
|
||||
|
||||
@@ -87,8 +91,6 @@ class Permutation {
|
||||
|
||||
private:
|
||||
absl::StrongVector<IndexType, IndexType> perm_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Permutation);
|
||||
};
|
||||
|
||||
typedef Permutation<RowIndex> RowPermutation;
|
||||
|
||||
@@ -73,6 +73,11 @@ class SparseMatrix {
|
||||
#if (!defined(_MSC_VER) || _MSC_VER >= 1800)
|
||||
SparseMatrix(
|
||||
std::initializer_list<std::initializer_list<Fractional>> init_list);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
SparseMatrix(const SparseMatrix&) = delete;
|
||||
SparseMatrix& operator=(const SparseMatrix&) = delete;
|
||||
|
||||
#endif
|
||||
// Clears internal data structure, i.e. erases all the columns and set
|
||||
// the number of rows to zero.
|
||||
@@ -211,8 +216,6 @@ class SparseMatrix {
|
||||
// Number of rows. This is needed as sparse columns don't have a maximum
|
||||
// number of rows.
|
||||
RowIndex num_rows_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SparseMatrix);
|
||||
};
|
||||
|
||||
// A matrix constructed from a list of already existing SparseColumn. This class
|
||||
@@ -339,6 +342,10 @@ class CompactSparseMatrix {
|
||||
PopulateFromMatrixView(MatrixView(matrix));
|
||||
}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CompactSparseMatrix(const CompactSparseMatrix&) = delete;
|
||||
CompactSparseMatrix& operator=(const CompactSparseMatrix&) = delete;
|
||||
|
||||
// Creates a CompactSparseMatrix from the given MatrixView. The matrices are
|
||||
// the same, only the representation differ. Note that the entry order in
|
||||
// each column is preserved.
|
||||
@@ -506,9 +513,6 @@ class CompactSparseMatrix {
|
||||
StrictITIVector<EntryIndex, Fractional> coefficients_;
|
||||
StrictITIVector<EntryIndex, RowIndex> rows_;
|
||||
StrictITIVector<ColIndex, EntryIndex> starts_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CompactSparseMatrix);
|
||||
};
|
||||
|
||||
inline Fractional CompactSparseMatrix::ConstView::ColumnScalarProduct(
|
||||
@@ -584,6 +588,10 @@ class TriangularMatrix : private CompactSparseMatrix {
|
||||
public:
|
||||
TriangularMatrix() : all_diagonal_coefficients_are_one_(true) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
TriangularMatrix(const TriangularMatrix&) = delete;
|
||||
TriangularMatrix& operator=(const TriangularMatrix&) = delete;
|
||||
|
||||
// Only a subset of the functions from CompactSparseMatrix are exposed (note
|
||||
// the private inheritance). They are extended to deal with diagonal
|
||||
// coefficients properly.
|
||||
@@ -917,8 +925,6 @@ class TriangularMatrix : private CompactSparseMatrix {
|
||||
// TODO(user): Use this during the "normal" hyper-sparse solves so that
|
||||
// we can benefit from the pruned lower matrix there?
|
||||
StrictITIVector<ColIndex, EntryIndex> pruned_ends_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TriangularMatrix);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -134,6 +134,11 @@ class RandomAccessSparseColumn {
|
||||
// Creates a RandomAccessSparseColumn.
|
||||
// Runs in O(num_rows).
|
||||
explicit RandomAccessSparseColumn(RowIndex num_rows);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RandomAccessSparseColumn(const RandomAccessSparseColumn&) = delete;
|
||||
RandomAccessSparseColumn& operator=(const RandomAccessSparseColumn&) = delete;
|
||||
|
||||
virtual ~RandomAccessSparseColumn();
|
||||
|
||||
// Clears the column.
|
||||
@@ -189,8 +194,6 @@ class RandomAccessSparseColumn {
|
||||
|
||||
// Stack to store changes.
|
||||
std::vector<RowIndex> row_change_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RandomAccessSparseColumn);
|
||||
};
|
||||
|
||||
} // namespace glop
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
|
||||
namespace operations_research {
|
||||
@@ -433,6 +432,10 @@ class Bitset64 {
|
||||
: size_(Value(size) > 0 ? size : IndexType(0)),
|
||||
data_(BitLength64(Value(size_))) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
Bitset64(const Bitset64&) = delete;
|
||||
Bitset64& operator=(const Bitset64&) = delete;
|
||||
|
||||
ConstView const_view() const { return ConstView(this); }
|
||||
|
||||
// Returns how many bits this Bitset64 can hold.
|
||||
@@ -657,7 +660,6 @@ class Bitset64 {
|
||||
|
||||
template <class OtherIndexType>
|
||||
friend class Bitset64;
|
||||
DISALLOW_COPY_AND_ASSIGN(Bitset64);
|
||||
};
|
||||
|
||||
// Specialized version of Bitset64 that allows to query the last bit set more
|
||||
@@ -668,6 +670,10 @@ class BitQueue64 {
|
||||
explicit BitQueue64(int size)
|
||||
: size_(size), top_(-1), data_(BitLength64(size), 0) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
BitQueue64(const BitQueue64&) = delete;
|
||||
BitQueue64& operator=(const BitQueue64&) = delete;
|
||||
|
||||
void IncreaseSize(int size) {
|
||||
CHECK_GE(size, size_);
|
||||
size_ = size;
|
||||
@@ -726,7 +732,6 @@ class BitQueue64 {
|
||||
int size_;
|
||||
int top_;
|
||||
std::vector<uint64_t> data_;
|
||||
DISALLOW_COPY_AND_ASSIGN(BitQueue64);
|
||||
};
|
||||
|
||||
// The specialization of Value() for IntType and int64_t.
|
||||
@@ -753,6 +758,10 @@ class SparseBitset {
|
||||
public:
|
||||
SparseBitset() {}
|
||||
explicit SparseBitset(IntegerType size) : bitset_(size) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
SparseBitset(const SparseBitset&) = delete;
|
||||
SparseBitset& operator=(const SparseBitset&) = delete;
|
||||
IntegerType size() const { return bitset_.size(); }
|
||||
void SparseClearAll() {
|
||||
for (const IntegerType i : to_clear_) bitset_.ClearBucket(i);
|
||||
@@ -825,7 +834,6 @@ class SparseBitset {
|
||||
private:
|
||||
Bitset64<IntegerType> bitset_;
|
||||
std::vector<IntegerType> to_clear_;
|
||||
DISALLOW_COPY_AND_ASSIGN(SparseBitset);
|
||||
};
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/macros.h"
|
||||
|
||||
namespace operations_research {
|
||||
// This class is used when manipulating search space estimations. It
|
||||
// provides fast access to log of a domain size.
|
||||
@@ -29,6 +27,11 @@ namespace operations_research {
|
||||
class CachedLog {
|
||||
public:
|
||||
CachedLog();
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CachedLog(const CachedLog&) = delete;
|
||||
CachedLog& operator=(const CachedLog&) = delete;
|
||||
|
||||
~CachedLog();
|
||||
|
||||
// This method can only be called once, and with a cache_size > 0.
|
||||
@@ -39,7 +42,6 @@ class CachedLog {
|
||||
|
||||
private:
|
||||
std::vector<double> cache_;
|
||||
DISALLOW_COPY_AND_ASSIGN(CachedLog);
|
||||
};
|
||||
} // namespace operations_research
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -58,6 +57,10 @@ class MonoidOperationTree {
|
||||
// Constructs a MonoidOperationTree able to store 'size' operands.
|
||||
explicit MonoidOperationTree(int size);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
MonoidOperationTree(const MonoidOperationTree&) = delete;
|
||||
MonoidOperationTree& operator=(const MonoidOperationTree&) = delete;
|
||||
|
||||
// Returns the root of the tree, containing the result of the operation.
|
||||
const T& result() const { return *result_; }
|
||||
|
||||
@@ -132,8 +135,6 @@ class MonoidOperationTree {
|
||||
|
||||
// A pointer to the root node
|
||||
T const* result_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MonoidOperationTree);
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------- //
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
#define OR_TOOLS_UTIL_PERMUTATION_H_
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -88,6 +87,10 @@ namespace operations_research {
|
||||
template <typename IndexType>
|
||||
class PermutationCycleHandler {
|
||||
public:
|
||||
// This type is neither copyable nor movable.
|
||||
PermutationCycleHandler(const PermutationCycleHandler&) = delete;
|
||||
PermutationCycleHandler& operator=(const PermutationCycleHandler&) = delete;
|
||||
|
||||
// Sets the internal temporary storage from the given index in the
|
||||
// underlying container(s).
|
||||
virtual void SetTempFromIndex(IndexType source) = 0;
|
||||
@@ -128,9 +131,6 @@ class PermutationCycleHandler {
|
||||
|
||||
protected:
|
||||
PermutationCycleHandler() {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(PermutationCycleHandler);
|
||||
};
|
||||
|
||||
// A generic cycle handler class for the common case in which the
|
||||
@@ -143,6 +143,10 @@ class ArrayIndexCycleHandler : public PermutationCycleHandler<IndexType> {
|
||||
public:
|
||||
explicit ArrayIndexCycleHandler(DataType* data) : data_(data) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
ArrayIndexCycleHandler(const ArrayIndexCycleHandler&) = delete;
|
||||
ArrayIndexCycleHandler& operator=(const ArrayIndexCycleHandler&) = delete;
|
||||
|
||||
void SetTempFromIndex(IndexType source) override { temp_ = data_[source]; }
|
||||
void SetIndexFromIndex(IndexType source,
|
||||
IndexType destination) const override {
|
||||
@@ -164,8 +168,6 @@ class ArrayIndexCycleHandler : public PermutationCycleHandler<IndexType> {
|
||||
|
||||
// Temporary storage for the one extra element we need.
|
||||
DataType temp_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ArrayIndexCycleHandler);
|
||||
};
|
||||
|
||||
// Note that this template is not implemented in an especially
|
||||
@@ -177,6 +179,10 @@ class PermutationApplier {
|
||||
explicit PermutationApplier(PermutationCycleHandler<IndexType>* cycle_handler)
|
||||
: cycle_handler_(cycle_handler) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
PermutationApplier(const PermutationApplier&) = delete;
|
||||
PermutationApplier& operator=(const PermutationApplier&) = delete;
|
||||
|
||||
void Apply(IndexType permutation[], int permutation_start,
|
||||
int permutation_end) {
|
||||
for (IndexType current = permutation_start; current < permutation_end;
|
||||
@@ -205,8 +211,6 @@ class PermutationApplier {
|
||||
|
||||
private:
|
||||
PermutationCycleHandler<IndexType>* cycle_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PermutationApplier);
|
||||
};
|
||||
} // namespace operations_research
|
||||
#endif // OR_TOOLS_UTIL_PERMUTATION_H_
|
||||
|
||||
@@ -48,6 +48,10 @@ class RangeMinimumQuery {
|
||||
explicit RangeMinimumQuery(std::vector<T> array);
|
||||
RangeMinimumQuery(std::vector<T> array, Compare cmp);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RangeMinimumQuery(const RangeMinimumQuery&) = delete;
|
||||
RangeMinimumQuery& operator=(const RangeMinimumQuery&) = delete;
|
||||
|
||||
// Returns the minimum (w.r.t. Compare) arr[x], where x is contained in
|
||||
// [from, to).
|
||||
T GetMinimumFromRange(int from, int to) const;
|
||||
@@ -58,8 +62,6 @@ class RangeMinimumQuery {
|
||||
// cache_[k][i] = min(arr, i, i+2^k).
|
||||
std::vector<std::vector<T>> cache_;
|
||||
Compare cmp_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RangeMinimumQuery);
|
||||
};
|
||||
|
||||
// RangeMinimumIndexQuery is similar to RangeMinimumQuery, but
|
||||
@@ -70,6 +72,10 @@ class RangeMinimumIndexQuery {
|
||||
explicit RangeMinimumIndexQuery(std::vector<T> array);
|
||||
RangeMinimumIndexQuery(std::vector<T> array, Compare cmp);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RangeMinimumIndexQuery(const RangeMinimumIndexQuery&) = delete;
|
||||
RangeMinimumIndexQuery& operator=(const RangeMinimumIndexQuery&) = delete;
|
||||
|
||||
// Returns an index idx from [from, to) such that arr[idx] is the minimum
|
||||
// value of arr over the interval [from, to).
|
||||
int GetMinimumIndexFromRange(int from, int to) const;
|
||||
@@ -86,7 +92,6 @@ class RangeMinimumIndexQuery {
|
||||
Compare cmp;
|
||||
} cmp_;
|
||||
const RangeMinimumQuery<int, IndexComparator> rmq_;
|
||||
DISALLOW_COPY_AND_ASSIGN(RangeMinimumIndexQuery);
|
||||
};
|
||||
|
||||
// RangeMinimumQuery implementation
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/util/range_minimum_query.h"
|
||||
|
||||
@@ -34,6 +33,11 @@ class LinearRangeIntToIntFunction : public RangeIntToIntFunction {
|
||||
std::function<int64_t(int64_t)> base_function)
|
||||
: base_function_(std::move(base_function)) {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
LinearRangeIntToIntFunction(const LinearRangeIntToIntFunction&) = delete;
|
||||
LinearRangeIntToIntFunction& operator=(const LinearRangeIntToIntFunction&) =
|
||||
delete;
|
||||
|
||||
int64_t Query(int64_t argument) const override {
|
||||
return base_function_(argument);
|
||||
}
|
||||
@@ -87,8 +91,6 @@ class LinearRangeIntToIntFunction : public RangeIntToIntFunction {
|
||||
|
||||
private:
|
||||
std::function<int64_t(int64_t)> base_function_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LinearRangeIntToIntFunction);
|
||||
};
|
||||
|
||||
std::vector<int64_t> FunctionToVector(const std::function<int64_t(int64_t)>& f,
|
||||
@@ -117,6 +119,11 @@ class CachedRangeIntToIntFunction : public RangeIntToIntFunction {
|
||||
CHECK_LT(domain_start, domain_end);
|
||||
}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CachedRangeIntToIntFunction(const CachedRangeIntToIntFunction&) = delete;
|
||||
CachedRangeIntToIntFunction& operator=(const CachedRangeIntToIntFunction&) =
|
||||
delete;
|
||||
|
||||
int64_t Query(int64_t argument) const override {
|
||||
DCHECK_LE(domain_start_, argument);
|
||||
DCHECK_LE(argument, domain_start_ + static_cast<int64_t>(array().size()));
|
||||
@@ -173,8 +180,6 @@ class CachedRangeIntToIntFunction : public RangeIntToIntFunction {
|
||||
const int64_t domain_start_;
|
||||
const RangeMinimumQuery<int64_t, std::less<int64_t>> rmq_min_;
|
||||
const RangeMinimumQuery<int64_t, std::greater<int64_t>> rmq_max_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CachedRangeIntToIntFunction);
|
||||
};
|
||||
|
||||
class CachedRangeMinMaxIndexFunction : public RangeMinMaxIndexFunction {
|
||||
@@ -188,6 +193,12 @@ class CachedRangeMinMaxIndexFunction : public RangeMinMaxIndexFunction {
|
||||
CHECK_LT(domain_start, domain_end);
|
||||
}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
CachedRangeMinMaxIndexFunction(const CachedRangeMinMaxIndexFunction&) =
|
||||
delete;
|
||||
CachedRangeMinMaxIndexFunction& operator=(
|
||||
const CachedRangeMinMaxIndexFunction&) = delete;
|
||||
|
||||
inline int64_t RangeMinArgument(int64_t from, int64_t to) const override {
|
||||
DCHECK_LE(domain_start_, from);
|
||||
DCHECK_LT(from, to);
|
||||
@@ -210,8 +221,6 @@ class CachedRangeMinMaxIndexFunction : public RangeMinMaxIndexFunction {
|
||||
const int64_t domain_end_;
|
||||
const RangeMinimumIndexQuery<int64_t, std::less<int64_t>> index_rmq_min_;
|
||||
const RangeMinimumIndexQuery<int64_t, std::greater<int64_t>> index_rmq_max_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CachedRangeMinMaxIndexFunction);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <deque>
|
||||
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/macros.h"
|
||||
|
||||
namespace operations_research {
|
||||
|
||||
@@ -29,6 +28,10 @@ class RunningAverage {
|
||||
// It must be positive (this is CHECKed).
|
||||
explicit RunningAverage(int window_size = 1);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RunningAverage(const RunningAverage&) = delete;
|
||||
RunningAverage& operator=(const RunningAverage&) = delete;
|
||||
|
||||
// Resets the class to the exact same state as if it was just constructed with
|
||||
// the given window size.
|
||||
void Reset(int window_size);
|
||||
@@ -57,8 +60,6 @@ class RunningAverage {
|
||||
double global_sum_;
|
||||
double local_sum_;
|
||||
std::deque<int> values_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RunningAverage);
|
||||
};
|
||||
|
||||
// Simple class to compute efficiently the maximum over a fixed size window
|
||||
@@ -69,6 +70,10 @@ class RunningMax {
|
||||
// Takes the size of the running window. The size must be positive.
|
||||
explicit RunningMax(int window_size);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
RunningMax(const RunningMax&) = delete;
|
||||
RunningMax& operator=(const RunningMax&) = delete;
|
||||
|
||||
// Processes a new element from the stream.
|
||||
void Add(Number value);
|
||||
|
||||
@@ -87,8 +92,6 @@ class RunningMax {
|
||||
|
||||
// Index of the current maximum element.
|
||||
int max_index_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RunningMax);
|
||||
};
|
||||
|
||||
// ################## Implementations below #####################
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/timer.h"
|
||||
|
||||
namespace operations_research {
|
||||
@@ -134,6 +133,10 @@ class StatsGroup {
|
||||
|
||||
explicit StatsGroup(absl::string_view name)
|
||||
: name_(name), stats_(), time_distributions_() {}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
StatsGroup(const StatsGroup&) = delete;
|
||||
StatsGroup& operator=(const StatsGroup&) = delete;
|
||||
~StatsGroup();
|
||||
|
||||
// Registers a Stat, which will appear in the string returned by StatString().
|
||||
@@ -162,8 +165,6 @@ class StatsGroup {
|
||||
PrintOrder print_order_ = SORT_BY_PRIORITY_THEN_VALUE;
|
||||
std::vector<Stat*> stats_;
|
||||
std::map<std::string, TimeDistribution*> time_distributions_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(StatsGroup);
|
||||
};
|
||||
|
||||
// Base class to track and compute statistics about the distribution of a
|
||||
@@ -315,6 +316,12 @@ class EnabledScopedTimeDistributionUpdater {
|
||||
: stat_(stat), also_update_(nullptr) {
|
||||
stat->StartTimer();
|
||||
}
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
EnabledScopedTimeDistributionUpdater(
|
||||
const EnabledScopedTimeDistributionUpdater&) = delete;
|
||||
EnabledScopedTimeDistributionUpdater& operator=(
|
||||
const EnabledScopedTimeDistributionUpdater&) = delete;
|
||||
~EnabledScopedTimeDistributionUpdater() {
|
||||
const double cycles = stat_->StopTimerAndAddElapsedTime();
|
||||
if (also_update_ != nullptr) {
|
||||
@@ -336,16 +343,18 @@ class EnabledScopedTimeDistributionUpdater {
|
||||
private:
|
||||
TimeDistribution* stat_;
|
||||
TimeDistribution* also_update_;
|
||||
DISALLOW_COPY_AND_ASSIGN(EnabledScopedTimeDistributionUpdater);
|
||||
};
|
||||
|
||||
class DisabledScopedTimeDistributionUpdater {
|
||||
public:
|
||||
explicit DisabledScopedTimeDistributionUpdater(TimeDistribution* stat) {}
|
||||
void AlsoUpdate(TimeDistribution* also_update) {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(DisabledScopedTimeDistributionUpdater);
|
||||
// This type is neither copyable nor movable.
|
||||
DisabledScopedTimeDistributionUpdater(
|
||||
const DisabledScopedTimeDistributionUpdater&) = delete;
|
||||
DisabledScopedTimeDistributionUpdater& operator=(
|
||||
const DisabledScopedTimeDistributionUpdater&) = delete;
|
||||
void AlsoUpdate(TimeDistribution* also_update) {}
|
||||
};
|
||||
|
||||
class DisabledScopedInstructionCounter {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "absl/flags/declare.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "ortools/base/macros.h"
|
||||
#include "ortools/base/timer.h"
|
||||
#include "ortools/base/types.h"
|
||||
#include "ortools/util/running_stat.h"
|
||||
@@ -392,6 +391,10 @@ class NestedTimeLimit {
|
||||
NestedTimeLimit(TimeLimit* base_time_limit, double limit_in_seconds,
|
||||
double deterministic_limit);
|
||||
|
||||
// This type is neither copyable nor movable.
|
||||
NestedTimeLimit(const NestedTimeLimit&) = delete;
|
||||
NestedTimeLimit& operator=(const NestedTimeLimit&) = delete;
|
||||
|
||||
/**
|
||||
* Updates elapsed deterministic time in the base time limit object.
|
||||
*/
|
||||
@@ -423,8 +426,6 @@ class NestedTimeLimit {
|
||||
private:
|
||||
TimeLimit* const base_time_limit_;
|
||||
TimeLimit time_limit_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NestedTimeLimit);
|
||||
};
|
||||
|
||||
// ################## Implementations below #####################
|
||||
|
||||
Reference in New Issue
Block a user