OR-Tools  8.1
linear_programming_constraint.h
Go to the documentation of this file.
1 // Copyright 2010-2018 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #ifndef OR_TOOLS_SAT_LINEAR_PROGRAMMING_CONSTRAINT_H_
15 #define OR_TOOLS_SAT_LINEAR_PROGRAMMING_CONSTRAINT_H_
16 
17 #include <limits>
18 #include <utility>
19 #include <vector>
20 
21 #include "absl/container/flat_hash_map.h"
22 #include "ortools/base/int_type.h"
27 #include "ortools/sat/cuts.h"
29 #include "ortools/sat/integer.h"
33 #include "ortools/sat/model.h"
34 #include "ortools/sat/util.h"
36 #include "ortools/util/rev.h"
38 
39 namespace operations_research {
40 namespace sat {
41 
42 // Stores for each IntegerVariable its temporary LP solution.
43 //
44 // This is shared between all LinearProgrammingConstraint because in the corner
45 // case where we have many different LinearProgrammingConstraint and a lot of
46 // variable, we could theoretically use up a quadratic amount of memory
47 // otherwise.
48 //
49 // TODO(user): find a better way?
51  : public gtl::ITIVector<IntegerVariable, double> {
53 };
54 
55 // Helper struct to combine info generated from solving LP.
56 struct LPSolveInfo {
58  double lp_objective = -std::numeric_limits<double>::infinity();
60 };
61 
62 // Simple class to combine linear expression efficiently. First in a sparse
63 // way that switch to dense when the number of non-zeros grows.
65  public:
66  // This must be called with the correct size before any other functions are
67  // used.
68  void ClearAndResize(int size);
69 
70  // Does vector[col] += value and return false in case of overflow.
71  bool Add(glop::ColIndex col, IntegerValue value);
72 
73  // Similar to Add() but for multiplier * terms.
74  // Returns false in case of overflow.
76  IntegerValue multiplier,
77  const std::vector<std::pair<glop::ColIndex, IntegerValue>>& terms);
78 
79  // This is not const only because non_zeros is sorted. Note that sorting the
80  // non-zeros make the result deterministic whether or not we were in sparse
81  // mode.
82  //
83  // TODO(user): Ideally we should convert to IntegerVariable as late as
84  // possible. Prefer to use GetTerms().
86  const std::vector<IntegerVariable>& integer_variables,
87  IntegerValue upper_bound, LinearConstraint* result);
88 
89  // Similar to ConvertToLinearConstraint().
90  std::vector<std::pair<glop::ColIndex, IntegerValue>> GetTerms();
91 
92  // We only provide the const [].
93  IntegerValue operator[](glop::ColIndex col) const {
94  return dense_vector_[col];
95  }
96 
97  private:
98  // If is_sparse is true we maintain the non_zeros positions and bool vector
99  // of dense_vector_. Otherwise we don't. Note that we automatically switch
100  // from sparse to dense as needed.
101  bool is_sparse_ = true;
102  std::vector<glop::ColIndex> non_zeros_;
104 
105  // The dense representation of the vector.
107 };
108 
109 // A SAT constraint that enforces a set of linear inequality constraints on
110 // integer variables using an LP solver.
111 //
112 // The propagator uses glop's revised simplex for feasibility and propagation.
113 // It uses the Reduced Cost Strengthening technique, a classic in mixed integer
114 // programming, for instance see the thesis of Tobias Achterberg,
115 // "Constraint Integer Programming", sections 7.7 and 8.8, algorithm 7.11.
116 // http://nbn-resolving.de/urn:nbn:de:0297-zib-11129
117 //
118 // Per-constraint bounds propagation is NOT done by this constraint,
119 // it should be done by redundant constraints, as reduced cost propagation
120 // may miss some filtering.
121 //
122 // Note that this constraint works with double floating-point numbers, so one
123 // could be worried that it may filter too much in case of precision issues.
124 // However, by default, we interpret the LP result by recomputing everything
125 // in integer arithmetic, so we are exact.
126 class LinearProgrammingDispatcher;
129  public:
130  typedef glop::RowIndex ConstraintIndex;
131 
133  ~LinearProgrammingConstraint() override;
134 
135  // Add a new linear constraint to this LP.
137 
138  // Set the coefficient of the variable in the objective. Calling it twice will
139  // overwrite the previous value.
140  void SetObjectiveCoefficient(IntegerVariable ivar, IntegerValue coeff);
141 
142  // The main objective variable should be equal to the linear sum of
143  // the arguments passed to SetObjectiveCoefficient().
144  void SetMainObjectiveVariable(IntegerVariable ivar) { objective_cp_ = ivar; }
145 
146  // Register a new cut generator with this constraint.
147  void AddCutGenerator(CutGenerator generator);
148 
149  // Returns the LP value and reduced cost of a variable in the current
150  // solution. These functions should only be called when HasSolution() is true.
151  //
152  // Note that this solution is always an OPTIMAL solution of an LP above or
153  // at the current decision level. We "erase" it when we backtrack over it.
154  bool HasSolution() const { return lp_solution_is_set_; }
155  double SolutionObjectiveValue() const { return lp_objective_; }
156  double GetSolutionValue(IntegerVariable variable) const;
157  double GetSolutionReducedCost(IntegerVariable variable) const;
158  bool SolutionIsInteger() const { return lp_solution_is_integer_; }
159 
160  // PropagatorInterface API.
161  bool Propagate() override;
162  bool IncrementalPropagate(const std::vector<int>& watch_indices) override;
163  void RegisterWith(Model* model);
164 
165  // ReversibleInterface API.
166  void SetLevel(int level) override;
167 
168  int NumVariables() const { return integer_variables_.size(); }
169  const std::vector<IntegerVariable>& integer_variables() const {
170  return integer_variables_;
171  }
172  std::string DimensionString() const { return lp_data_.GetDimensionString(); }
173 
174  // Returns a IntegerLiteral guided by the underlying LP constraints.
175  //
176  // This looks at all unassigned 0-1 variables, takes the one with
177  // a support value closest to 0.5, and tries to assign it to 1.
178  // If all 0-1 variables have an integer support, returns kNoLiteralIndex.
179  // Tie-breaking is done using the variable natural order.
180  //
181  // TODO(user): This fixes to 1, but for some problems fixing to 0
182  // or to the std::round(support value) might work better. When this is the
183  // case, change behaviour automatically?
185 
186  // Returns a IntegerLiteral guided by the underlying LP constraints.
187  //
188  // This computes the mean of reduced costs over successive calls,
189  // and tries to fix the variable which has the highest reduced cost.
190  // Tie-breaking is done using the variable natural order.
191  // Only works for 0/1 variables.
192  //
193  // TODO(user): Try to get better pseudocosts than averaging every time
194  // the heuristic is called. MIP solvers initialize this with strong branching,
195  // then keep track of the pseudocosts when doing tree search. Also, this
196  // version only branches on var >= 1 and keeps track of reduced costs from var
197  // = 1 to var = 0. This works better than the conventional MIP where the
198  // chosen variable will be argmax_var min(pseudocost_var(0->1),
199  // pseudocost_var(1->0)), probably because we are doing DFS search where MIP
200  // does BFS. This might depend on the model, more trials are necessary. We
201  // could also do exponential smoothing instead of decaying every N calls, i.e.
202  // pseudo = a * pseudo + (1-a) reduced.
204 
205  // Returns a IntegerLiteral guided by the underlying LP constraints.
206  //
207  // This computes the mean of reduced costs over successive calls,
208  // and tries to fix the variable which has the highest reduced cost.
209  // Tie-breaking is done using the variable natural order.
211 
212  // Average number of nonbasic variables with zero reduced costs.
213  double average_degeneracy() const {
214  return average_degeneracy_.CurrentAverage();
215  }
216 
218  return total_num_simplex_iterations_;
219  }
220 
221  private:
222  // Helper methods for branching. Returns true if branching on the given
223  // variable helps with more propagation or finds a conflict.
224  bool BranchOnVar(IntegerVariable var);
225  LPSolveInfo SolveLpForBranching();
226 
227  // Helper method to fill reduced cost / dual ray reason in 'integer_reason'.
228  // Generates a set of IntegerLiterals explaining why the best solution can not
229  // be improved using reduced costs. This is used to generate explanations for
230  // both infeasibility and bounds deductions.
231  void FillReducedCostReasonIn(const glop::DenseRow& reduced_costs,
232  std::vector<IntegerLiteral>* integer_reason);
233 
234  // Reinitialize the LP from a potentially new set of constraints.
235  // This fills all data structure and properly rescale the underlying LP.
236  //
237  // Returns false if the problem is UNSAT (it can happen when presolve is off
238  // and some LP constraint are trivially false).
239  bool CreateLpFromConstraintManager();
240 
241  // Solve the LP, returns false if something went wrong in the LP solver.
242  bool SolveLp();
243 
244  // Add a "MIR" cut obtained by first taking the linear combination of the
245  // row of the matrix according to "integer_multipliers" and then trying
246  // some integer rounding heuristic.
247  //
248  // Return true if a new cut was added to the cut manager.
249  bool AddCutFromConstraints(
250  const std::string& name,
251  const std::vector<std::pair<glop::RowIndex, IntegerValue>>&
252  integer_multipliers);
253 
254  // Second half of AddCutFromConstraints().
255  bool PostprocessAndAddCut(
256  const std::string& name, const std::string& info,
257  IntegerVariable first_new_var, IntegerVariable first_slack,
258  const std::vector<ImpliedBoundsProcessor::SlackInfo>& ib_slack_infos,
259  LinearConstraint* cut);
260 
261  // Computes and adds the corresponding type of cuts.
262  // This can currently only be called at the root node.
263  void AddCGCuts();
264  void AddMirCuts();
265  void AddZeroHalfCuts();
266 
267  // Updates the bounds of the LP variables from the CP bounds.
268  void UpdateBoundsOfLpVariables();
269 
270  // Use the dual optimal lp values to compute an EXACT lower bound on the
271  // objective. Fills its reason and perform reduced cost strenghtening.
272  // Returns false in case of conflict.
273  bool ExactLpReasonning();
274 
275  // Same as FillDualRayReason() but perform the computation EXACTLY. Returns
276  // false in the case that the problem is not provably infeasible with exact
277  // computations, true otherwise.
278  bool FillExactDualRayReason();
279 
280  // Returns number of non basic variables with zero reduced costs.
281  int64 CalculateDegeneracy();
282 
283  // From a set of row multipliers (at LP scale), scale them back to the CP
284  // world and then make them integer (eventually multiplying them by a new
285  // scaling factor returned in *scaling).
286  //
287  // Note that this will loose some precision, but our subsequent computation
288  // will still be exact as it will work for any set of multiplier.
289  std::vector<std::pair<glop::RowIndex, IntegerValue>> ScaleLpMultiplier(
290  bool take_objective_into_account,
291  const glop::DenseColumn& dense_lp_multipliers, glop::Fractional* scaling,
292  int max_pow = 62) const;
293 
294  // Computes from an integer linear combination of the integer rows of the LP a
295  // new constraint of the form "sum terms <= upper_bound". All computation are
296  // exact here.
297  //
298  // Returns false if we encountered any integer overflow.
299  bool ComputeNewLinearConstraint(
300  const std::vector<std::pair<glop::RowIndex, IntegerValue>>&
301  integer_multipliers,
302  ScatteredIntegerVector* scattered_vector,
303  IntegerValue* upper_bound) const;
304 
305  // Simple heuristic to try to minimize |upper_bound - ImpliedLB(terms)|. This
306  // should make the new constraint tighter and correct a bit the imprecision
307  // introduced by rounding the floating points values.
308  void AdjustNewLinearConstraint(
309  std::vector<std::pair<glop::RowIndex, IntegerValue>>* integer_multipliers,
310  ScatteredIntegerVector* scattered_vector,
311  IntegerValue* upper_bound) const;
312 
313  // Shortcut for an integer linear expression type.
314  using LinearExpression = std::vector<std::pair<glop::ColIndex, IntegerValue>>;
315 
316  // Converts a dense represenation of a linear constraint to a sparse one
317  // expressed in terms of IntegerVariable.
318  void ConvertToLinearConstraint(
320  IntegerValue upper_bound, LinearConstraint* result);
321 
322  // Compute the implied lower bound of the given linear expression using the
323  // current variable bound. Return kMinIntegerValue in case of overflow.
324  IntegerValue GetImpliedLowerBound(const LinearConstraint& terms) const;
325 
326  // Tests for possible overflow in the propagation of the given linear
327  // constraint.
328  bool PossibleOverflow(const LinearConstraint& constraint);
329 
330  // Reduce the coefficient of the constraint so that we cannot have overflow
331  // in the propagation of the given linear constraint. Note that we may loose
332  // some strength by doing so.
333  //
334  // We make sure that any partial sum involving any variable value in their
335  // domain do not exceed 2 ^ max_pow.
336  void PreventOverflow(LinearConstraint* constraint, int max_pow = 62);
337 
338  // Fills integer_reason_ with the reason for the implied lower bound of the
339  // given linear expression. We relax the reason if we have some slack.
340  void SetImpliedLowerBoundReason(const LinearConstraint& terms,
341  IntegerValue slack);
342 
343  // Fills the deductions vector with reduced cost deductions that can be made
344  // from the current state of the LP solver. The given delta should be the
345  // difference between the cp objective upper bound and lower bound given by
346  // the lp.
347  void ReducedCostStrengtheningDeductions(double cp_objective_delta);
348 
349  // Returns the variable value on the same scale as the CP variable value.
350  glop::Fractional GetVariableValueAtCpScale(glop::ColIndex var);
351 
352  // Gets or creates an LP variable that mirrors a CP variable.
353  // The variable should be a positive reference.
354  glop::ColIndex GetOrCreateMirrorVariable(IntegerVariable positive_variable);
355 
356  // This must be called on an OPTIMAL LP and will update the data for
357  // LPReducedCostAverageDecision().
358  void UpdateAverageReducedCosts();
359 
360  // Callback underlying LPReducedCostAverageBranching().
361  IntegerLiteral LPReducedCostAverageDecision();
362 
363  // Updates the simplex iteration limit for the next visit.
364  // As per current algorithm, we use a limit which is dependent on size of the
365  // problem and drop it significantly if degeneracy is detected. We use
366  // DUAL_FEASIBLE status as a signal to correct the prediction. The next limit
367  // is capped by 'min_iter' and 'max_iter'. Note that this is enabled only for
368  // linearization level 2 and above.
369  void UpdateSimplexIterationLimit(const int64 min_iter, const int64 max_iter);
370 
371  // This epsilon is related to the precision of the value/reduced_cost returned
372  // by the LP once they have been scaled back into the CP domain. So for large
373  // domain or cost coefficient, we may have some issues.
374  static const double kCpEpsilon;
375 
376  // Same but at the LP scale.
377  static const double kLpEpsilon;
378 
379  // Class responsible for managing all possible constraints that may be part
380  // of the LP.
381  LinearConstraintManager constraint_manager_;
382 
383  // Initial problem in integer form.
384  // We always sort the inner vectors by increasing glop::ColIndex.
385  struct LinearConstraintInternal {
386  IntegerValue lb;
387  IntegerValue ub;
388  LinearExpression terms;
389  };
390  LinearExpression integer_objective_;
391  IntegerValue integer_objective_offset_ = IntegerValue(0);
392  IntegerValue objective_infinity_norm_ = IntegerValue(0);
395 
396  // Underlying LP solver API.
397  glop::LinearProgram lp_data_;
398  glop::RevisedSimplex simplex_;
399  int64 next_simplex_iter_ = 500;
400 
401  // For the scaling.
402  glop::LpScalingHelper scaler_;
403 
404  // Temporary data for cuts.
405  ZeroHalfCutHelper zero_half_cut_helper_;
406  CoverCutHelper cover_cut_helper_;
407  IntegerRoundingCutHelper integer_rounding_cut_helper_;
408  LinearConstraint cut_;
409 
410  ScatteredIntegerVector tmp_scattered_vector_;
411 
412  std::vector<double> tmp_lp_values_;
413  std::vector<IntegerValue> tmp_var_lbs_;
414  std::vector<IntegerValue> tmp_var_ubs_;
415  std::vector<glop::RowIndex> tmp_slack_rows_;
416  std::vector<IntegerValue> tmp_slack_bounds_;
417 
418  // Structures used for mirroring IntegerVariables inside the underlying LP
419  // solver: an integer variable var is mirrored by mirror_lp_variable_[var].
420  // Note that these indices are dense in [0, mirror_lp_variable_.size()] so
421  // they can be used as vector indices.
422  //
423  // TODO(user): This should be gtl::ITIVector<glop::ColIndex, IntegerVariable>.
424  std::vector<IntegerVariable> integer_variables_;
425  absl::flat_hash_map<IntegerVariable, glop::ColIndex> mirror_lp_variable_;
426 
427  // We need to remember what to optimize if an objective is given, because
428  // then we will switch the objective between feasibility and optimization.
429  bool objective_is_defined_ = false;
430  IntegerVariable objective_cp_;
431 
432  // Singletons from Model.
433  const SatParameters& sat_parameters_;
434  Model* model_;
435  TimeLimit* time_limit_;
436  IntegerTrail* integer_trail_;
437  Trail* trail_;
438  IntegerEncoder* integer_encoder_;
439  ModelRandomGenerator* random_;
440 
441  // Used while deriving cuts.
442  ImpliedBoundsProcessor implied_bounds_processor_;
443 
444  // The dispatcher for all LP propagators of the model, allows to find which
445  // LinearProgrammingConstraint has a given IntegerVariable.
446  LinearProgrammingDispatcher* dispatcher_;
447 
448  std::vector<IntegerLiteral> integer_reason_;
449  std::vector<IntegerLiteral> deductions_;
450  std::vector<IntegerLiteral> deductions_reason_;
451 
452  // Repository of IntegerSumLE that needs to be kept around for the lazy
453  // reasons. Those are new integer constraint that are created each time we
454  // solve the LP to a dual-feasible solution. Propagating these constraints
455  // both improve the objective lower bound but also perform reduced cost
456  // fixing.
457  int rev_optimal_constraints_size_ = 0;
458  std::vector<std::unique_ptr<IntegerSumLE>> optimal_constraints_;
459 
460  // Last OPTIMAL solution found by a call to the underlying LP solver.
461  // On IncrementalPropagate(), if the bound updates do not invalidate this
462  // solution, Propagate() will not find domain reductions, no need to call it.
463  int lp_solution_level_ = 0;
464  bool lp_solution_is_set_ = false;
465  bool lp_solution_is_integer_ = false;
466  double lp_objective_;
467  std::vector<double> lp_solution_;
468  std::vector<double> lp_reduced_cost_;
469 
470  // If non-empty, this is the last known optimal lp solution at root-node. If
471  // the variable bounds changed, or cuts where added, it is possible that this
472  // solution is no longer optimal though.
473  std::vector<double> level_zero_lp_solution_;
474 
475  // True if the last time we solved the exact same LP at level zero, no cuts
476  // and no lazy constraints where added.
477  bool lp_at_level_zero_is_final_ = false;
478 
479  // Same as lp_solution_ but this vector is indexed differently.
480  LinearProgrammingConstraintLpSolution& expanded_lp_solution_;
481 
482  // Linear constraints cannot be created or modified after this is registered.
483  bool lp_constraint_is_registered_ = false;
484 
485  std::vector<CutGenerator> cut_generators_;
486 
487  // Store some statistics for HeuristicLPReducedCostAverage().
488  bool compute_reduced_cost_averages_ = false;
489  int num_calls_since_reduced_cost_averages_reset_ = 0;
490  std::vector<double> sum_cost_up_;
491  std::vector<double> sum_cost_down_;
492  std::vector<int> num_cost_up_;
493  std::vector<int> num_cost_down_;
494  std::vector<double> rc_scores_;
495 
496  // All the entries before rev_rc_start_ in the sorted positions correspond
497  // to fixed variables and can be ignored.
498  int rev_rc_start_ = 0;
499  RevRepository<int> rc_rev_int_repository_;
500  std::vector<std::pair<double, int>> positions_by_decreasing_rc_score_;
501 
502  // Defined as average number of nonbasic variables with zero reduced costs.
503  IncrementalAverage average_degeneracy_;
504  bool is_degenerate_ = false;
505 
506  // Used by the strong branching heuristic.
507  int branching_frequency_ = 1;
508  int64 count_since_last_branching_ = 0;
509 
510  // Sum of all simplex iterations performed by this class. This is useful to
511  // test the incrementality and compare to other solvers.
512  int64 total_num_simplex_iterations_ = 0;
513 
514  // Some stats on the LP statuses encountered.
515  std::vector<int64> num_solves_by_status_;
516 };
517 
518 // A class that stores which LP propagator is associated to each variable.
519 // We need to give the hash_map a name so it can be used as a singleton in our
520 // model.
521 //
522 // Important: only positive variable do appear here.
524  : public absl::flat_hash_map<IntegerVariable,
525  LinearProgrammingConstraint*> {
526  public:
528 };
529 
530 // A class that stores the collection of all LP constraints in a model.
532  : public std::vector<LinearProgrammingConstraint*> {
533  public:
535 };
536 
537 // Cut generator for the circuit constraint, where in any feasible solution, the
538 // arcs that are present (variable at 1) must form a circuit through all the
539 // nodes of the graph. Self arc are forbidden in this case.
540 //
541 // In more generality, this currently enforce the resulting graph to be strongly
542 // connected. Note that we already assume basic constraint to be in the lp, so
543 // we do not add any cuts for components of size 1.
545  int num_nodes, const std::vector<int>& tails, const std::vector<int>& heads,
546  const std::vector<Literal>& literals, Model* model);
547 
548 // Almost the same as CreateStronglyConnectedGraphCutGenerator() but for each
549 // components, computes the demand needed to serves it, and depending on whether
550 // it contains the depot (node zero) or not, compute the minimum number of
551 // vehicle that needs to cross the component border.
552 CutGenerator CreateCVRPCutGenerator(int num_nodes,
553  const std::vector<int>& tails,
554  const std::vector<int>& heads,
555  const std::vector<Literal>& literals,
556  const std::vector<int64>& demands,
557  int64 capacity, Model* model);
558 } // namespace sat
559 } // namespace operations_research
560 
561 #endif // OR_TOOLS_SAT_LINEAR_PROGRAMMING_CONSTRAINT_H_
var
IntVar * var
Definition: expr_array.cc:1858
operations_research::sat::LinearProgrammingConstraint::GetSolutionValue
double GetSolutionValue(IntegerVariable variable) const
Definition: linear_programming_constraint.cc:626
operations_research::sat::LPSolveInfo::status
glop::ProblemStatus status
Definition: linear_programming_constraint.h:57
operations_research::sat::LinearProgrammingConstraintCollection::LinearProgrammingConstraintCollection
LinearProgrammingConstraintCollection()
Definition: linear_programming_constraint.h:534
operations_research::sat::LinearProgrammingConstraint::HasSolution
bool HasSolution() const
Definition: linear_programming_constraint.h:154
time_limit.h
operations_research::sat::LinearProgrammingConstraint::ConstraintIndex
glop::RowIndex ConstraintIndex
Definition: linear_programming_constraint.h:130
operations_research::sat::CutGenerator
Definition: cuts.h:40
lp_data.h
operations_research::sat::LinearProgrammingConstraint::GetSolutionReducedCost
double GetSolutionReducedCost(IntegerVariable variable) const
Definition: linear_programming_constraint.cc:631
operations_research::sat::CreateStronglyConnectedGraphCutGenerator
CutGenerator CreateStronglyConnectedGraphCutGenerator(int num_nodes, const std::vector< int > &tails, const std::vector< int > &heads, const std::vector< Literal > &literals, Model *model)
Definition: linear_programming_constraint.cc:2514
linear_constraint.h
gtl::ITIVector
Definition: int_type_indexed_vector.h:76
operations_research::sat::LinearProgrammingConstraint::SetMainObjectiveVariable
void SetMainObjectiveVariable(IntegerVariable ivar)
Definition: linear_programming_constraint.h:144
operations_research::sat::PropagatorInterface
Definition: integer.h:1027
value
int64 value
Definition: demon_profiler.cc:43
operations_research::sat::ScatteredIntegerVector::ConvertToLinearConstraint
void ConvertToLinearConstraint(const std::vector< IntegerVariable > &integer_variables, IntegerValue upper_bound, LinearConstraint *result)
Definition: linear_programming_constraint.cc:109
operations_research::sat::LinearProgrammingConstraint::~LinearProgrammingConstraint
~LinearProgrammingConstraint() override
Definition: linear_programming_constraint.cc:183
operations_research::RevRepository< int >
model.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: dense_doubly_linked_list.h:21
operations_research::sat::LinearProgrammingConstraint::RegisterWith
void RegisterWith(Model *model)
Definition: linear_programming_constraint.cc:523
operations_research::sat::LinearProgrammingConstraint::IncrementalPropagate
bool IncrementalPropagate(const std::vector< int > &watch_indices) override
Definition: linear_programming_constraint.cc:589
operations_research::sat::LinearProgrammingDispatcher::LinearProgrammingDispatcher
LinearProgrammingDispatcher(Model *model)
Definition: linear_programming_constraint.h:527
int64
int64_t int64
Definition: integral_types.h:34
operations_research::sat::IncrementalAverage::CurrentAverage
double CurrentAverage() const
Definition: sat/util.h:113
operations_research::TimeLimit
A simple class to enforce both an elapsed time limit and a deterministic time limit in the same threa...
Definition: time_limit.h:105
revised_simplex.h
operations_research::glop::Fractional
double Fractional
Definition: lp_types.h:77
operations_research::sat::ScatteredIntegerVector::GetTerms
std::vector< std::pair< glop::ColIndex, IntegerValue > > GetTerms()
Definition: linear_programming_constraint.cc:136
operations_research::sat::ScatteredIntegerVector::ClearAndResize
void ClearAndResize(int size)
Definition: linear_programming_constraint.cc:53
operations_research::sat::LinearConstraintManager
Definition: linear_constraint_manager.h:40
operations_research::sat::LinearConstraint
Definition: linear_constraint.h:39
lp_data_utils.h
operations_research::sat::LPSolveInfo::new_obj_bound
IntegerValue new_obj_bound
Definition: linear_programming_constraint.h:59
operations_research::glop::RevisedSimplex
Definition: revised_simplex.h:147
int_type.h
operations_research::sat::LinearProgrammingConstraint::SolutionObjectiveValue
double SolutionObjectiveValue() const
Definition: linear_programming_constraint.h:155
operations_research::sat::LinearProgrammingConstraint::SetLevel
void SetLevel(int level) override
Definition: linear_programming_constraint.cc:559
integer_expr.h
operations_research::glop::LpScalingHelper
Definition: lp_data_utils.h:51
operations_research::glop::StrictITIVector< ColIndex, Fractional >
operations_research::sat::LinearExpression
Definition: linear_constraint.h:172
operations_research::sat::Model
Class that owns everything related to a particular optimization model.
Definition: sat/model.h:38
operations_research::sat::LinearProgrammingConstraint::NumVariables
int NumVariables() const
Definition: linear_programming_constraint.h:168
ct
const Constraint * ct
Definition: demon_profiler.cc:42
operations_research::sat::IntegerLiteral
Definition: integer.h:153
operations_research::sat::LinearProgrammingConstraint::total_num_simplex_iterations
int64 total_num_simplex_iterations() const
Definition: linear_programming_constraint.h:217
operations_research::sat::LinearProgrammingConstraintCollection
Definition: linear_programming_constraint.h:532
operations_research::sat::ScatteredIntegerVector::AddLinearExpressionMultiple
bool AddLinearExpressionMultiple(IntegerValue multiplier, const std::vector< std::pair< glop::ColIndex, IntegerValue >> &terms)
Definition: linear_programming_constraint.cc:81
operations_research::sat::ScatteredIntegerVector::operator[]
IntegerValue operator[](glop::ColIndex col) const
Definition: linear_programming_constraint.h:93
operations_research::sat::LinearProgrammingConstraintLpSolution
Definition: linear_programming_constraint.h:51
operations_research::sat::LPSolveInfo
Definition: linear_programming_constraint.h:56
operations_research::sat::LinearProgrammingConstraint::DimensionString
std::string DimensionString() const
Definition: linear_programming_constraint.h:172
operations_research::sat::LinearProgrammingConstraint::SolutionIsInteger
bool SolutionIsInteger() const
Definition: linear_programming_constraint.h:158
implied_bounds.h
rev.h
operations_research::sat::ScatteredIntegerVector
Definition: linear_programming_constraint.h:64
zero_half_cuts.h
model
GRBmodel * model
Definition: gurobi_interface.cc:269
operations_research::sat::LPSolveInfo::lp_objective
double lp_objective
Definition: linear_programming_constraint.h:58
operations_research::sat::LinearProgrammingConstraint::AddCutGenerator
void AddCutGenerator(CutGenerator generator)
Definition: linear_programming_constraint.cc:582
operations_research::sat::LinearProgrammingConstraint
Definition: linear_programming_constraint.h:128
operations_research::glop::LinearProgram::GetDimensionString
std::string GetDimensionString() const
Definition: lp_data.cc:423
col
ColIndex col
Definition: markowitz.cc:176
operations_research::ReversibleInterface
Definition: rev.h:29
operations_research::sat::kMinIntegerValue
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
util.h
linear_constraint_manager.h
operations_research::glop::ProblemStatus
ProblemStatus
Definition: lp_types.h:101
operations_research::sat::LinearProgrammingConstraint::HeuristicLpReducedCostAverageBranching
std::function< IntegerLiteral()> HeuristicLpReducedCostAverageBranching()
Definition: linear_programming_constraint.cc:2751
operations_research::glop::LinearProgram
Definition: lp_data.h:55
operations_research::Trail
Definition: constraint_solver.cc:723
operations_research::sat::LinearProgrammingConstraint::HeuristicLpReducedCostBinary
std::function< IntegerLiteral()> HeuristicLpReducedCostBinary(Model *model)
Definition: linear_programming_constraint.cc:2596
operations_research::sat::LinearProgrammingConstraint::SetObjectiveCoefficient
void SetObjectiveCoefficient(IntegerVariable ivar, IntegerValue coeff)
Definition: linear_programming_constraint.cc:231
operations_research::sat::LinearProgrammingConstraint::LinearProgrammingConstraint
LinearProgrammingConstraint(Model *model)
Definition: linear_programming_constraint.cc:156
operations_research::sat::LinearProgrammingConstraint::AddLinearConstraint
void AddLinearConstraint(const LinearConstraint &ct)
Definition: linear_programming_constraint.cc:193
operations_research::sat::LinearProgrammingConstraint::integer_variables
const std::vector< IntegerVariable > & integer_variables() const
Definition: linear_programming_constraint.h:169
operations_research::sat::LinearProgrammingDispatcher
Definition: linear_programming_constraint.h:525
operations_research::sat::LinearProgrammingConstraint::average_degeneracy
double average_degeneracy() const
Definition: linear_programming_constraint.h:213
capacity
int64 capacity
Definition: routing_flow.cc:129
operations_research::sat::ScatteredIntegerVector::Add
bool Add(glop::ColIndex col, IntegerValue value)
Definition: linear_programming_constraint.cc:70
operations_research::sat::CreateCVRPCutGenerator
CutGenerator CreateCVRPCutGenerator(int num_nodes, const std::vector< int > &tails, const std::vector< int > &heads, const std::vector< Literal > &literals, const std::vector< int64 > &demands, int64 capacity, Model *model)
Definition: linear_programming_constraint.cc:2530
operations_research::sat::LinearProgrammingConstraintLpSolution::LinearProgrammingConstraintLpSolution
LinearProgrammingConstraintLpSolution()
Definition: linear_programming_constraint.h:52
lp_types.h
operations_research::sat::LinearProgrammingConstraint::HeuristicLpMostInfeasibleBinary
std::function< IntegerLiteral()> HeuristicLpMostInfeasibleBinary(Model *model)
Definition: linear_programming_constraint.cc:2550
cuts.h
operations_research::sat::LinearProgrammingConstraint::Propagate
bool Propagate() override
Definition: linear_programming_constraint.cc:1353
integer.h
name
const std::string name
Definition: default_search.cc:808