OR-Tools  8.0
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 LiteralIndex guided by the underlying LP constraints.
175  // This looks at all unassigned 0-1 variables, takes the one with
176  // a support value closest to 0.5, and tries to assign it to 1.
177  // If all 0-1 variables have an integer support, returns kNoLiteralIndex.
178  // Tie-breaking is done using the variable natural order.
179  //
180  // TODO(user): This fixes to 1, but for some problems fixing to 0
181  // or to the std::round(support value) might work better. When this is the
182  // case, change behaviour automatically?
183  std::function<LiteralIndex()> HeuristicLPMostInfeasibleBinary(Model* model);
184 
185  // Returns a LiteralIndex guided by the underlying LP constraints.
186  // This computes the mean of reduced costs over successive calls,
187  // and tries to fix the variable which has the highest reduced cost.
188  // Tie-breaking is done using the variable natural order.
189  // Only works for 0/1 variables.
190  //
191  // TODO(user): Try to get better pseudocosts than averaging every time
192  // the heuristic is called. MIP solvers initialize this with strong branching,
193  // then keep track of the pseudocosts when doing tree search. Also, this
194  // version only branches on var >= 1 and keeps track of reduced costs from var
195  // = 1 to var = 0. This works better than the conventional MIP where the
196  // chosen variable will be argmax_var min(pseudocost_var(0->1),
197  // pseudocost_var(1->0)), probably because we are doing DFS search where MIP
198  // does BFS. This might depend on the model, more trials are necessary. We
199  // could also do exponential smoothing instead of decaying every N calls, i.e.
200  // pseudo = a * pseudo + (1-a) reduced.
201  std::function<LiteralIndex()> HeuristicLPPseudoCostBinary(Model* model);
202 
203  // Returns a LiteralIndex guided by the underlying LP constraints.
204  // This computes the mean of reduced costs over successive calls,
205  // and tries to fix the variable which has the highest reduced cost.
206  // Tie-breaking is done using the variable natural order.
207  std::function<LiteralIndex()> LPReducedCostAverageBranching();
208 
209  // Average number of nonbasic variables with zero reduced costs.
210  double average_degeneracy() const {
211  return average_degeneracy_.CurrentAverage();
212  }
213 
214  private:
215  // Helper methods for branching. Returns true if branching on the given
216  // variable helps with more propagation or finds a conflict.
217  bool BranchOnVar(IntegerVariable var);
218  LPSolveInfo SolveLpForBranching();
219 
220  // Helper method to fill reduced cost / dual ray reason in 'integer_reason'.
221  // Generates a set of IntegerLiterals explaining why the best solution can not
222  // be improved using reduced costs. This is used to generate explanations for
223  // both infeasibility and bounds deductions.
224  void FillReducedCostReasonIn(const glop::DenseRow& reduced_costs,
225  std::vector<IntegerLiteral>* integer_reason);
226 
227  // Reinitialize the LP from a potentially new set of constraints.
228  // This fills all data structure and properly rescale the underlying LP.
229  //
230  // Returns false if the problem is UNSAT (it can happen when presolve is off
231  // and some LP constraint are trivially false).
232  bool CreateLpFromConstraintManager();
233 
234  // Solve the LP, returns false if something went wrong in the LP solver.
235  bool SolveLp();
236 
237  // Add a "MIR" cut obtained by first taking the linear combination of the
238  // row of the matrix according to "integer_multipliers" and then trying
239  // some integer rounding heuristic.
240  //
241  // Return true if a new cut was added to the cut manager.
242  bool AddCutFromConstraints(
243  const std::string& name,
244  const std::vector<std::pair<glop::RowIndex, IntegerValue>>&
245  integer_multipliers);
246 
247  // Second half of AddCutFromConstraints().
248  bool PostprocessAndAddCut(
249  const std::string& name, const std::string& info,
250  IntegerVariable first_new_var, IntegerVariable first_slack,
251  const std::vector<ImpliedBoundsProcessor::SlackInfo>& ib_slack_infos,
252  LinearConstraint* cut);
253 
254  // Computes and adds the corresponding type of cuts.
255  // This can currently only be called at the root node.
256  void AddCGCuts();
257  void AddMirCuts();
258  void AddZeroHalfCuts();
259 
260  // Updates the bounds of the LP variables from the CP bounds.
261  void UpdateBoundsOfLpVariables();
262 
263  // Use the dual optimal lp values to compute an EXACT lower bound on the
264  // objective. Fills its reason and perform reduced cost strenghtening.
265  // Returns false in case of conflict.
266  bool ExactLpReasonning();
267 
268  // Same as FillDualRayReason() but perform the computation EXACTLY. Returns
269  // false in the case that the problem is not provably infeasible with exact
270  // computations, true otherwise.
271  bool FillExactDualRayReason();
272 
273  // Returns number of non basic variables with zero reduced costs.
274  int64 CalculateDegeneracy();
275 
276  // From a set of row multipliers (at LP scale), scale them back to the CP
277  // world and then make them integer (eventually multiplying them by a new
278  // scaling factor returned in *scaling).
279  //
280  // Note that this will loose some precision, but our subsequent computation
281  // will still be exact as it will work for any set of multiplier.
282  std::vector<std::pair<glop::RowIndex, IntegerValue>> ScaleLpMultiplier(
283  bool take_objective_into_account,
284  const glop::DenseColumn& dense_lp_multipliers, glop::Fractional* scaling,
285  int max_pow = 62) const;
286 
287  // Computes from an integer linear combination of the integer rows of the LP a
288  // new constraint of the form "sum terms <= upper_bound". All computation are
289  // exact here.
290  //
291  // Returns false if we encountered any integer overflow.
292  bool ComputeNewLinearConstraint(
293  const std::vector<std::pair<glop::RowIndex, IntegerValue>>&
294  integer_multipliers,
295  ScatteredIntegerVector* scattered_vector,
296  IntegerValue* upper_bound) const;
297 
298  // Simple heuristic to try to minimize |upper_bound - ImpliedLB(terms)|. This
299  // should make the new constraint tighter and correct a bit the imprecision
300  // introduced by rounding the floating points values.
301  void AdjustNewLinearConstraint(
302  std::vector<std::pair<glop::RowIndex, IntegerValue>>* integer_multipliers,
303  ScatteredIntegerVector* scattered_vector,
304  IntegerValue* upper_bound) const;
305 
306  // Shortcut for an integer linear expression type.
307  using LinearExpression = std::vector<std::pair<glop::ColIndex, IntegerValue>>;
308 
309  // Converts a dense represenation of a linear constraint to a sparse one
310  // expressed in terms of IntegerVariable.
311  void ConvertToLinearConstraint(
313  IntegerValue upper_bound, LinearConstraint* result);
314 
315  // Compute the implied lower bound of the given linear expression using the
316  // current variable bound. Return kMinIntegerValue in case of overflow.
317  IntegerValue GetImpliedLowerBound(const LinearConstraint& terms) const;
318 
319  // Tests for possible overflow in the propagation of the given linear
320  // constraint.
321  bool PossibleOverflow(const LinearConstraint& constraint);
322 
323  // Reduce the coefficient of the constraint so that we cannot have overflow
324  // in the propagation of the given linear constraint. Note that we may loose
325  // some strength by doing so.
326  //
327  // We make sure that any partial sum involving any variable value in their
328  // domain do not exceed 2 ^ max_pow.
329  void PreventOverflow(LinearConstraint* constraint, int max_pow = 62);
330 
331  // Fills integer_reason_ with the reason for the implied lower bound of the
332  // given linear expression. We relax the reason if we have some slack.
333  void SetImpliedLowerBoundReason(const LinearConstraint& terms,
334  IntegerValue slack);
335 
336  // Fills the deductions vector with reduced cost deductions that can be made
337  // from the current state of the LP solver. The given delta should be the
338  // difference between the cp objective upper bound and lower bound given by
339  // the lp.
340  void ReducedCostStrengtheningDeductions(double cp_objective_delta);
341 
342  // Returns the variable value on the same scale as the CP variable value.
343  glop::Fractional GetVariableValueAtCpScale(glop::ColIndex var);
344 
345  // Gets or creates an LP variable that mirrors a CP variable.
346  // The variable should be a positive reference.
347  glop::ColIndex GetOrCreateMirrorVariable(IntegerVariable positive_variable);
348 
349  // This must be called on an OPTIMAL LP and will update the data for
350  // LPReducedCostAverageDecision().
351  void UpdateAverageReducedCosts();
352 
353  // Callback underlying LPReducedCostAverageBranching().
354  LiteralIndex LPReducedCostAverageDecision();
355 
356  // Updates the simplex iteration limit for the next visit.
357  // As per current algorithm, we use a limit which is dependent on size of the
358  // problem and drop it significantly if degeneracy is detected. We use
359  // DUAL_FEASIBLE status as a signal to correct the prediction. The next limit
360  // is capped by 'min_iter' and 'max_iter'. Note that this is enabled only for
361  // linearization level 2 and above.
362  void UpdateSimplexIterationLimit(const int64 min_iter, const int64 max_iter);
363 
364  // This epsilon is related to the precision of the value/reduced_cost returned
365  // by the LP once they have been scaled back into the CP domain. So for large
366  // domain or cost coefficient, we may have some issues.
367  static const double kCpEpsilon;
368 
369  // Same but at the LP scale.
370  static const double kLpEpsilon;
371 
372  // Class responsible for managing all possible constraints that may be part
373  // of the LP.
374  LinearConstraintManager constraint_manager_;
375 
376  // Initial problem in integer form.
377  // We always sort the inner vectors by increasing glop::ColIndex.
378  struct LinearConstraintInternal {
379  IntegerValue lb;
380  IntegerValue ub;
381  LinearExpression terms;
382  };
383  LinearExpression integer_objective_;
384  IntegerValue objective_infinity_norm_ = IntegerValue(0);
387 
388  // Underlying LP solver API.
389  glop::LinearProgram lp_data_;
390  glop::RevisedSimplex simplex_;
391  int64 next_simplex_iter_ = 500;
392 
393  // For the scaling.
394  glop::LpScalingHelper scaler_;
395 
396  // Temporary data for cuts.
397  ZeroHalfCutHelper zero_half_cut_helper_;
398  CoverCutHelper cover_cut_helper_;
399  IntegerRoundingCutHelper integer_rounding_cut_helper_;
400  LinearConstraint cut_;
401 
402  ScatteredIntegerVector tmp_scattered_vector_;
403 
404  std::vector<double> tmp_lp_values_;
405  std::vector<IntegerValue> tmp_var_lbs_;
406  std::vector<IntegerValue> tmp_var_ubs_;
407  std::vector<glop::RowIndex> tmp_slack_rows_;
408  std::vector<IntegerValue> tmp_slack_bounds_;
409 
410  // Structures used for mirroring IntegerVariables inside the underlying LP
411  // solver: an integer variable var is mirrored by mirror_lp_variable_[var].
412  // Note that these indices are dense in [0, mirror_lp_variable_.size()] so
413  // they can be used as vector indices.
414  //
415  // TODO(user): This should be gtl::ITIVector<glop::ColIndex, IntegerVariable>.
416  std::vector<IntegerVariable> integer_variables_;
417  absl::flat_hash_map<IntegerVariable, glop::ColIndex> mirror_lp_variable_;
418 
419  // We need to remember what to optimize if an objective is given, because
420  // then we will switch the objective between feasibility and optimization.
421  bool objective_is_defined_ = false;
422  IntegerVariable objective_cp_;
423 
424  // Singletons from Model.
425  const SatParameters& sat_parameters_;
426  Model* model_;
427  TimeLimit* time_limit_;
428  IntegerTrail* integer_trail_;
429  Trail* trail_;
430  SearchHeuristicsVector* model_heuristics_;
431  IntegerEncoder* integer_encoder_;
432  ModelRandomGenerator* random_;
433 
434  // Used while deriving cuts.
435  ImpliedBoundsProcessor implied_bounds_processor_;
436 
437  // The dispatcher for all LP propagators of the model, allows to find which
438  // LinearProgrammingConstraint has a given IntegerVariable.
439  LinearProgrammingDispatcher* dispatcher_;
440 
441  std::vector<IntegerLiteral> integer_reason_;
442  std::vector<IntegerLiteral> deductions_;
443  std::vector<IntegerLiteral> deductions_reason_;
444 
445  // Repository of IntegerSumLE that needs to be kept around for the lazy
446  // reasons. Those are new integer constraint that are created each time we
447  // solve the LP to a dual-feasible solution. Propagating these constraints
448  // both improve the objective lower bound but also perform reduced cost
449  // fixing.
450  int rev_optimal_constraints_size_ = 0;
451  std::vector<std::unique_ptr<IntegerSumLE>> optimal_constraints_;
452 
453  // Last OPTIMAL solution found by a call to the underlying LP solver.
454  // On IncrementalPropagate(), if the bound updates do not invalidate this
455  // solution, Propagate() will not find domain reductions, no need to call it.
456  int lp_solution_level_ = 0;
457  bool lp_solution_is_set_ = false;
458  bool lp_solution_is_integer_ = false;
459  double lp_objective_;
460  std::vector<double> lp_solution_;
461  std::vector<double> lp_reduced_cost_;
462 
463  // If non-empty, this is the last known optimal lp solution at root-node. If
464  // the variable bounds changed, or cuts where added, it is possible that this
465  // solution is no longer optimal though.
466  std::vector<double> level_zero_lp_solution_;
467 
468  // True if the last time we solved the exact same LP at level zero, no cuts
469  // and no lazy constraints where added.
470  bool lp_at_level_zero_is_final_ = false;
471 
472  // Same as lp_solution_ but this vector is indexed differently.
473  LinearProgrammingConstraintLpSolution& expanded_lp_solution_;
474 
475  // Linear constraints cannot be created or modified after this is registered.
476  bool lp_constraint_is_registered_ = false;
477 
478  std::vector<CutGenerator> cut_generators_;
479 
480  // Store some statistics for HeuristicLPReducedCostAverage().
481  bool compute_reduced_cost_averages_ = false;
482  int num_calls_since_reduced_cost_averages_reset_ = 0;
483  std::vector<double> sum_cost_up_;
484  std::vector<double> sum_cost_down_;
485  std::vector<int> num_cost_up_;
486  std::vector<int> num_cost_down_;
487  std::vector<double> rc_scores_;
488 
489  // All the entries before rev_rc_start_ in the sorted positions correspond
490  // to fixed variables and can be ignored.
491  int rev_rc_start_ = 0;
492  RevRepository<int> rc_rev_int_repository_;
493  std::vector<std::pair<double, int>> positions_by_decreasing_rc_score_;
494 
495  // Defined as average number of nonbasic variables with zero reduced costs.
496  IncrementalAverage average_degeneracy_;
497  bool is_degenerate_ = false;
498 
499  // Used by the strong branching heuristic.
500  int branching_frequency_ = 1;
501  int64 count_since_last_branching_ = 0;
502 
503  // Sum of all simplex iterations performed by this class. This is useful to
504  // test the incrementality and compare to other solvers.
505  int64 total_num_simplex_iterations_ = 0;
506 };
507 
508 // A class that stores which LP propagator is associated to each variable.
509 // We need to give the hash_map a name so it can be used as a singleton in our
510 // model.
511 //
512 // Important: only positive variable do appear here.
514  : public absl::flat_hash_map<IntegerVariable,
515  LinearProgrammingConstraint*> {
516  public:
518 };
519 
520 // A class that stores the collection of all LP constraints in a model.
522  : public std::vector<LinearProgrammingConstraint*> {
523  public:
525 };
526 
527 // Cut generator for the circuit constraint, where in any feasible solution, the
528 // arcs that are present (variable at 1) must form a circuit through all the
529 // nodes of the graph. Self arc are forbidden in this case.
530 //
531 // In more generality, this currently enforce the resulting graph to be strongly
532 // connected. Note that we already assume basic constraint to be in the lp, so
533 // we do not add any cuts for components of size 1.
535  int num_nodes, const std::vector<int>& tails, const std::vector<int>& heads,
536  const std::vector<Literal>& literals, Model* model);
537 
538 // Almost the same as CreateStronglyConnectedGraphCutGenerator() but for each
539 // components, computes the demand needed to serves it, and depending on whether
540 // it contains the depot (node zero) or not, compute the minimum number of
541 // vehicle that needs to cross the component border.
542 CutGenerator CreateCVRPCutGenerator(int num_nodes,
543  const std::vector<int>& tails,
544  const std::vector<int>& heads,
545  const std::vector<Literal>& literals,
546  const std::vector<int64>& demands,
547  int64 capacity, Model* model);
548 } // namespace sat
549 } // namespace operations_research
550 
551 #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:589
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:524
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:594
operations_research::sat::LinearProgrammingConstraint::LPReducedCostAverageBranching
std::function< LiteralIndex()> LPReducedCostAverageBranching()
Definition: linear_programming_constraint.cc:2707
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:2462
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:1019
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:184
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:480
operations_research::sat::LinearProgrammingConstraint::IncrementalPropagate
bool IncrementalPropagate(const std::vector< int > &watch_indices) override
Definition: linear_programming_constraint.cc:552
operations_research::sat::LinearProgrammingDispatcher::LinearProgrammingDispatcher
LinearProgrammingDispatcher(Model *model)
Definition: linear_programming_constraint.h:517
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:522
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::LinearProgrammingConstraintCollection
Definition: linear_programming_constraint.h:522
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
operations_research::sat::LinearProgrammingConstraint::HeuristicLPMostInfeasibleBinary
std::function< LiteralIndex()> HeuristicLPMostInfeasibleBinary(Model *model)
Definition: linear_programming_constraint.cc:2498
rev.h
operations_research::sat::LinearProgrammingConstraint::HeuristicLPPseudoCostBinary
std::function< LiteralIndex()> HeuristicLPPseudoCostBinary(Model *model)
Definition: linear_programming_constraint.cc:2549
operations_research::sat::ScatteredIntegerVector
Definition: linear_programming_constraint.h:64
zero_half_cuts.h
model
GRBmodel * model
Definition: gurobi_interface.cc:195
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:545
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::glop::LinearProgram
Definition: lp_data.h:55
operations_research::Trail
Definition: constraint_solver.cc:716
operations_research::sat::LinearProgrammingConstraint::SetObjectiveCoefficient
void SetObjectiveCoefficient(IntegerVariable ivar, IntegerValue coeff)
Definition: linear_programming_constraint.cc:227
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:189
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:515
operations_research::sat::LinearProgrammingConstraint::average_degeneracy
double average_degeneracy() const
Definition: linear_programming_constraint.h:210
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:2478
operations_research::sat::LinearProgrammingConstraintLpSolution::LinearProgrammingConstraintLpSolution
LinearProgrammingConstraintLpSolution()
Definition: linear_programming_constraint.h:52
lp_types.h
cuts.h
operations_research::sat::LinearProgrammingConstraint::Propagate
bool Propagate() override
Definition: linear_programming_constraint.cc:1303
integer.h
name
const std::string name
Definition: default_search.cc:807