OR-Tools  8.1
gscip.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 // Simplified bindings for the SCIP solver. This is not designed to be used
15 // directly by users, the API is not friendly to a modeler. For most common
16 // cases, use MPSolver instead.
17 //
18 // Notable differences between gSCIP and SCIP:
19 // * Unless callbacks are used, gSCIP only exposes the SCIP stage PROBLEM to
20 // the user through public APIs.
21 // * Instead of the stateful SCIP parameters API, parameters are passed in at
22 // Solve() time and cleared at the end of solve. Parameters that effect
23 // problem creation are thus not supported.
24 // * gSCIP uses std::numeric_limits<double>::infinity(), rather than SCIPs
25 // infinity (a default value of 1e20). Doubles with absolute value >= 1e20
26 // are automatically converting to std::numeric_limits<double>::infinity()
27 // by gSCIP. Changing the underlying SCIP's infinity is not supported.
28 // * absl::Status and absl::StatusOr are used to propagate SCIP errors (and on
29 // a best effort basis, also filter out bad input to gSCIP functions).
30 //
31 // A note on error propagation and reliability:
32 // Many methods on SCIP return an error code. Errors can be triggered by
33 // both invalid input and bugs in SCIP. We propagate these errors back to the
34 // user through gSCIP through Status and StatusOr. If you are solving a single
35 // MIP and you have previously successfully solved similar MIPs, it is unlikely
36 // gSCIP would return any status errors. Depending on your application, CHECK
37 // failing on these errors may be appropriate (e.g. a benchmark that is run by
38 // hand). If you are solving a very large number of MIPs (e.g. in a flume job),
39 // your instances are numerically challenging, or the model/data are drawn from
40 // an unreliable source, or you are running a server that cannot crash, you may
41 // want to try and process these errors instead. Note that on bad instances,
42 // SCIP may still crash, so highly reliable systems should run SCIP in a
43 // separate process.
44 //
45 // NOTE(user): much of the API uses const std::string& instead of
46 // absl::string_view because the underlying SCIP API needs a null terminated
47 // char*.
48 #ifndef OR_TOOLS_GSCIP_GSCIP_H_
49 #define OR_TOOLS_GSCIP_GSCIP_H_
50 
51 #include <cstdint>
52 #include <limits>
53 #include <memory>
54 #include <vector>
55 
56 #include "absl/container/flat_hash_map.h"
57 #include "absl/container/flat_hash_set.h"
58 #include "absl/status/status.h"
59 #include "absl/status/statusor.h"
60 #include "ortools/gscip/gscip.pb.h"
61 #include "scip/scip.h"
62 #include "scip/scip_prob.h"
63 #include "scip/type_cons.h"
64 #include "scip/type_scip.h"
65 #include "scip/type_var.h"
66 
67 namespace operations_research {
68 
69 using GScipSolution = absl::flat_hash_map<SCIP_VAR*, double>;
70 
71 // The result of GScip::Solve(). Contains the solve status, statistics, and the
72 // solutions found.
73 struct GScipResult {
74  GScipOutput gscip_output;
75  // The number of solutions returned is at most GScipParameters::num_solutions.
76  // They are ordered from best objective value to worst. When
77  // gscip_output.status() is optimal, solutions will have at least one element.
78  std::vector<GScipSolution> solutions;
79  // Of the same size as solutions.
80  std::vector<double> objective_values;
81  // Advanced use below
82 
83  // If the problem was unbounded, a primal ray in the unbounded direction of
84  // the LP relaxation should be produced.
85  absl::flat_hash_map<SCIP_VAR*, double> primal_ray;
86  // TODO(user): add dual support:
87  // 1. The dual solution for LPs.
88  // 2. The dual ray for infeasible LP/MIPs.
89 };
90 
91 // Models the constraint lb <= a*x <= ub. Members variables and coefficients
92 // must have the same size.
94  double lower_bound = -std::numeric_limits<double>::infinity();
95  std::vector<SCIP_VAR*> variables;
96  std::vector<double> coefficients;
97  double upper_bound = std::numeric_limits<double>::infinity();
98 };
99 
100 // A variable is implied integer if the integrality constraint is not required
101 // for the model to be valid, but the variable takes an integer value in any
102 // optimal solution to the problem.
103 enum class GScipVarType { kContinuous, kInteger, kImpliedInteger };
104 
105 // Some advanced features, defined at the end of the header file.
106 struct GScipQuadraticRange;
107 struct GScipSOSData;
108 struct GScipIndicatorConstraint;
109 struct GScipLogicalConstraintData;
110 struct GScipVariableOptions;
111 const GScipVariableOptions& DefaultGScipVariableOptions();
112 struct GScipConstraintOptions;
113 const GScipConstraintOptions& DefaultGScipConstraintOptions();
114 using GScipBranchingPriority = absl::flat_hash_map<SCIP_VAR*, int>;
115 enum class GScipHintResult;
116 
117 // A thin wrapper around the SCIP solver that provides C++ bindings that are
118 // idiomatic for Google. Unless callbacks are used, the SCIP stage is always
119 // PROBLEM.
120 class GScip {
121  public:
122  // Create a new GScip (the constructor is private). The default objective
123  // direction is minimization.
124  static absl::StatusOr<std::unique_ptr<GScip>> Create(
125  const std::string& problem_name);
126  ~GScip();
127  static std::string ScipVersion();
128 
129  // After Solve() the parameters are reset and SCIP stage is restored to
130  // PROBLEM. "legacy_params" are in the format of legacy_scip_params.h and are
131  // applied after "params". Use of "legacy_params" is discouraged.
132  //
133  // The returned StatusOr will contain an error only if an:
134  // * An underlying function from SCIP fails.
135  // * There is an I/O error with managing SCIP output.
136  // The above cases are not mutually exclusive. If the problem is infeasible,
137  // this will be reflected in the value of GScipResult::gscip_output::status.
138  absl::StatusOr<GScipResult> Solve(
139  const GScipParameters& params = GScipParameters(),
140  const std::string& legacy_params = "");
141 
142  // ///////////////////////////////////////////////////////////////////////////
143  // Basic Model Construction
144  // ///////////////////////////////////////////////////////////////////////////
145 
146  // Use true for maximization, false for minimization.
147  absl::Status SetMaximize(bool is_maximize);
148  absl::Status SetObjectiveOffset(double offset);
149 
150  // The returned SCIP_VAR is owned by GScip. With default options, the
151  // returned variable will have the same lifetime as GScip (if instead,
152  // GScipVariableOptions::keep_alive is false, SCIP may free the variable at
153  // any time, see GScipVariableOptions::keep_alive for details).
154  absl::StatusOr<SCIP_VAR*> AddVariable(
155  double lb, double ub, double obj_coef, GScipVarType var_type,
156  const std::string& var_name = "",
158 
159  // The returned SCIP_CONS is owned by GScip. With default options, the
160  // returned variable will have the same lifetime as GScip (if instead,
161  // GScipConstraintOptions::keep_alive is false, SCIP may free the constraint
162  // at any time, see GScipConstraintOptions::keep_alive for details).
163  //
164  // Can be called while creating the model or in a callback (e.g. in a
165  // GScipConstraintHandler).
166  absl::StatusOr<SCIP_CONS*> AddLinearConstraint(
167  const GScipLinearRange& range, const std::string& name = "",
169 
170  // ///////////////////////////////////////////////////////////////////////////
171  // Model Queries
172  // ///////////////////////////////////////////////////////////////////////////
173 
174  bool ObjectiveIsMaximize();
175  double ObjectiveOffset();
176 
177  double Lb(SCIP_VAR* var);
178  double Ub(SCIP_VAR* var);
179  double ObjCoef(SCIP_VAR* var);
180  GScipVarType VarType(SCIP_VAR* var);
181  absl::string_view Name(SCIP_VAR* var);
182  const absl::flat_hash_set<SCIP_VAR*>& variables() { return variables_; }
183 
184  // These methods works on all constraint types.
185  absl::string_view Name(SCIP_CONS* constraint);
186  bool IsConstraintLinear(SCIP_CONS* constraint);
187  const absl::flat_hash_set<SCIP_CONS*>& constraints() { return constraints_; }
188 
189  // These methods will CHECK fail if constraint is not a linear constraint.
190  absl::Span<const double> LinearConstraintCoefficients(SCIP_CONS* constraint);
191  absl::Span<SCIP_VAR* const> LinearConstraintVariables(SCIP_CONS* constraint);
192  double LinearConstraintLb(SCIP_CONS* constraint);
193  double LinearConstraintUb(SCIP_CONS* constraint);
194 
195  // ///////////////////////////////////////////////////////////////////////////
196  // Model Updates (needed for incrementalism)
197  // ///////////////////////////////////////////////////////////////////////////
198  absl::Status SetLb(SCIP_VAR* var, double lb);
199  absl::Status SetUb(SCIP_VAR* var, double ub);
200  absl::Status SetObjCoef(SCIP_VAR* var, double obj_coef);
201  absl::Status SetVarType(SCIP_VAR* var, GScipVarType var_type);
202 
203  // Warning: you need to ensure that no constraint has a reference to this
204  // variable before deleting it, or undefined behavior will occur. For linear
205  // constraints, you can set the coefficient of this variable to zero to remove
206  // the variable from the constriant.
207  absl::Status DeleteVariable(SCIP_VAR* var);
208 
209  // Checks if SafeBulkDelete will succeed for vars, and returns a description
210  // the problematic variables/constraints on a failure (the returned status
211  // will not contain a propagated SCIP error). Will not modify the underyling
212  // SCIP, it is safe to continue using this if an error is returned.
213  absl::Status CanSafeBulkDelete(const absl::flat_hash_set<SCIP_VAR*>& vars);
214 
215  // Attempts to remove vars from all constraints and then remove vars from
216  // the model. As of August 7, 2020, will fail if the model contains any
217  // constraints that are not linear.
218  //
219  // Will call CanSafeBulkDelete above, but can also return an error Status
220  // propagated from SCIP. Do not assume SCIP is in a valid state if this fails.
221  absl::Status SafeBulkDelete(const absl::flat_hash_set<SCIP_VAR*>& vars);
222 
223  // These methods will CHECK fail if constraint is not a linear constraint.
224  absl::Status SetLinearConstraintLb(SCIP_CONS* constraint, double lb);
225  absl::Status SetLinearConstraintUb(SCIP_CONS* constraint, double ub);
226  absl::Status SetLinearConstraintCoef(SCIP_CONS* constraint, SCIP_VAR* var,
227  double value);
228 
229  // Works on all constraint types. Unlike DeleteVariable, no special action is
230  // required before deleting a constraint.
231  absl::Status DeleteConstraint(SCIP_CONS* constraint);
232 
233  // ///////////////////////////////////////////////////////////////////////////
234  // Nonlinear constraint types.
235  // For now, only basic support (adding to the model) is provided. Reading and
236  // updating support may be added in the future.
237  // ///////////////////////////////////////////////////////////////////////////
238 
239  // Adds a constraint of the form:
240  // if z then a * x <= b
241  // where z is a binary variable, x is a vector of decision variables, a is
242  // vector of constants, and b is a constant. z can be negated.
243  //
244  // NOTE(user): options.modifiable is ignored.
245  absl::StatusOr<SCIP_CONS*> AddIndicatorConstraint(
246  const GScipIndicatorConstraint& indicator_constraint,
247  const std::string& name = "",
249 
250  // Adds a constraint of form lb <= x * Q * x + a * x <= ub.
251  //
252  // NOTE(user): options.modifiable and options.sticking_at_node are ignored.
253  absl::StatusOr<SCIP_CONS*> AddQuadraticConstraint(
254  const GScipQuadraticRange& range, const std::string& name = "",
256 
257  // Adds the constraint:
258  // logical_data.resultant = AND_i logical_data.operators[i],
259  // where logical_data.resultant and logical_data.operators[i] are all binary
260  // variables.
261  absl::StatusOr<SCIP_CONS*> AddAndConstraint(
262  const GScipLogicalConstraintData& logical_data,
263  const std::string& name = "",
265 
266  // Adds the constraint:
267  // logical_data.resultant = OR_i logical_data.operators[i],
268  // where logical_data.resultant and logical_data.operators[i] must be binary
269  // variables.
270  absl::StatusOr<SCIP_CONS*> AddOrConstraint(
271  const GScipLogicalConstraintData& logical_data,
272  const std::string& name = "",
274 
275  // Adds the constraint that at most one of the variables in sos_data can be
276  // nonzero. The variables can be integer or continuous. See GScipSOSData for
277  // details.
278  //
279  // NOTE(user): options.modifiable is ignored (these constraints are not
280  // modifiable).
281  absl::StatusOr<SCIP_CONS*> AddSOS1Constraint(
282  const GScipSOSData& sos_data, const std::string& name = "",
284 
285  // Adds the constraint that at most two of the variables in sos_data can be
286  // nonzero, and they must be adjacent under the ordering for sos_data. See
287  // GScipSOSData for details.
288  //
289  // NOTE(user): options.modifiable is ignored (these constraints are not
290  // modifiable).
291  absl::StatusOr<SCIP_CONS*> AddSOS2Constraint(
292  const GScipSOSData& sos_data, const std::string& name = "",
294 
295  // ///////////////////////////////////////////////////////////////////////////
296  // Advanced use
297  // ///////////////////////////////////////////////////////////////////////////
298 
299  // Returns the name of the constraint handler for this constraint.
300  absl::string_view ConstraintType(SCIP_CONS* constraint);
301 
302  // The proposed solution can be partial (only specify some of the variables)
303  // or complete. Complete solutions will be checked for feasibility and
304  // objective quality, and might be unused for these reasons. Partial solutions
305  // will always be accepted.
306  absl::StatusOr<GScipHintResult> SuggestHint(
307  const GScipSolution& partial_solution);
308 
309  // All variables have a default branching priority of zero. Variables are
310  // partitioned by their branching priority, and a fractional variable from the
311  // highest partition will always be branched on.
312  //
313  // TODO(user): Add support for BranchingFactor as well, this is typically
314  // more useful.
315  absl::Status SetBranchingPriority(SCIP_VAR* var, int priority);
316 
317  // Doubles with absolute value of at least this value are replaced by this
318  // value before giving them SCIP. SCIP considers values at least this large to
319  // be infinite. When querying gSCIP, if an absolute value exceeds ScipInf, it
320  // is replaced by std::numeric_limits<double>::infinity().
321  double ScipInf();
322  static constexpr double kDefaultScipInf = 1e20;
323 
324  // WARNING(rander): no synchronization is provided between InterruptSolve()
325  // and ~GScip(). These methods require mutual exclusion, the user is
326  // responsible for ensuring this invariant.
327  // TODO(user): should we add a lock here? Seems a little dangerous to block
328  // in a destructor.
329  bool InterruptSolve();
330 
331  // These should typically not be needed.
332  SCIP* scip() { return scip_; }
333 
334  absl::StatusOr<bool> DefaultBoolParamValue(const std::string& parameter_name);
335  absl::StatusOr<int> DefaultIntParamValue(const std::string& parameter_name);
336  absl::StatusOr<int64_t> DefaultLongParamValue(
337  const std::string& parameter_name);
338  absl::StatusOr<double> DefaultRealParamValue(
339  const std::string& parameter_name);
340  absl::StatusOr<char> DefaultCharParamValue(const std::string& parameter_name);
341  absl::StatusOr<std::string> DefaultStringParamValue(
342  const std::string& parameter_name);
343 
344  private:
345  explicit GScip(SCIP* scip);
346  // Releases SCIP memory.
347  absl::Status CleanUp();
348 
349  absl::Status SetParams(const GScipParameters& params,
350  const std::string& legacy_params);
351  absl::Status FreeTransform();
352  // Clamps d to [-ScipInf(), ScipInf()].
353  double ScipInfClamp(double d);
354  // Returns +/- inf if |d| >= ScipInf(), otherwise returns d.
355  double ScipInfUnclamp(double d);
356 
357  absl::Status MaybeKeepConstraintAlive(SCIP_CONS* constraint,
358  const GScipConstraintOptions& options);
359 
360  SCIP* scip_;
361  absl::flat_hash_set<SCIP_VAR*> variables_;
362  absl::flat_hash_set<SCIP_CONS*> constraints_;
363 };
364 
365 // Advanced features below
366 
367 // Models the constraint
368 // lb <= x * Q * x + a * x <= ub
370  // Models lb above.
371  double lower_bound = -std::numeric_limits<double>::infinity();
372 
373  // Models a * x above. linear_variables and linear_coefficients must have the
374  // same size.
375  std::vector<SCIP_Var*> linear_variables;
376  std::vector<double> linear_coefficients;
377 
378  // These three vectors must have the same size. Models x * Q * x as
379  // sum_i quadratic_coefficients[i] * quadratic_variables1[i]
380  // * quadratic_variables2[i]
381  //
382  // Duplicate quadratic terms (e.g. i=3 encodes 4*x1*x3 and i=4 encodes
383  // 8*x3*x1) are added (as if you added a single entry 12*x1*x3).
384  //
385  // TODO(user): investigate, the documentation seems to suggest that when
386  // linear_variables[i] == quadratic_variables1[i] == quadratic_variables2[i]
387  // there is some advantage.
388  std::vector<SCIP_Var*> quadratic_variables1;
389  std::vector<SCIP_Var*> quadratic_variables2;
390  std::vector<double> quadratic_coefficients;
391 
392  // Models ub above.
393  double upper_bound = std::numeric_limits<double>::infinity();
394 };
395 
396 // Models special ordered set constraints (SOS1 and SOS2 constraints). Each
397 // contains a list of variables that are implicitly ordered by the provided
398 // weights, which must be distinct.
399 // SOS1: At most one of the variables can be nonzero.
400 // SOS2: At most two of the variables can be nonzero, and they must be
401 // consecutive.
402 //
403 // The weights are optional, and if not provided, the ordering in "variables" is
404 // used.
405 struct GScipSOSData {
406  // The list of variables where all but one or two must be zero. Can be integer
407  // or continuous variables, typically their domain will contain zero. Cannot
408  // be empty in a valid SOS constraint.
409  std::vector<SCIP_VAR*> variables;
410 
411  // Optional, can be empty. Otherwise, must have size equal to variables, and
412  // values must be distinct. Determines an "ordering" over the variables
413  // (smallest weight to largest). Additionally, the numeric values of
414  // the weights are used to make branching decisions in a solver specific way,
415  // for details, see:
416  // * https://scip.zib.de/doc/html/cons__sos1_8c.php
417  // * https://scip.zib.de/doc/html/cons__sos2_8c.php.
418  std::vector<double> weights;
419 };
420 
421 // Models the constraint z = 1 => a * x <= b
422 // If negate_indicator, then instead: z = 0 => a * x <= b
424  // The z variable above.
425  SCIP_VAR* indicator_variable = nullptr;
426  bool negate_indicator = false;
427  // The x variable above.
428  std::vector<SCIP_Var*> variables;
429  // a above. Must have the same size as x.
430  std::vector<double> coefficients;
431  // b above.
432  double upper_bound = std::numeric_limits<double>::infinity();
433 };
434 
435 // Data for constraint of the form resultant = f(operators), e.g.:
436 // resultant = AND_i operators[i]
437 // For existing constraints (e.g. AND, OR) resultant and operators[i] should all
438 // be binary variables, this my change. See use in GScip for details.
440  SCIP_VAR* resultant = nullptr;
441  std::vector<SCIP_VAR*> operators;
442 };
443 
444 enum class GScipHintResult {
445  // Hint was not feasible.
446  kInfeasible,
447  // Hint was not good enough to keep.
448  kRejected,
449  // Hint was kept. Partial solutions are not checked for feasibility, they
450  // are always accepted.
451  kAccepted
452 };
453 
454 // Advanced use. Options to use when creating a variable.
456  // ///////////////////////////////////////////////////////////////////////////
457  // SCIP options. Descriptions are from the SCIP documentation, e.g.
458  // SCIPcreateVar:
459  // https://scip.zib.de/doc/html/group__PublicVariableMethods.php#ga7a37fe4dc702dadecc4186b9624e93fc
460  // ///////////////////////////////////////////////////////////////////////////
461 
462  // Should var's column be present in the initial root LP?
463  bool initial = true;
464 
465  // Is var's column removable from the LP (due to aging or cleanup)?
466  bool removable = false;
467 
468  // ///////////////////////////////////////////////////////////////////////////
469  // gSCIP options.
470  // ///////////////////////////////////////////////////////////////////////////
471 
472  // If keep_alive=true, the returned variable will not to be freed until after
473  // ~GScip() is called. Otherwise, the returned variable could be freed
474  // internally by SCIP at any point, and it is not safe to hold a reference to
475  // the returned variable.
476  //
477  // The primary reason to set keep_alive=false is if you are adding many
478  // variables in a callback (in branch and price), and you expect that most of
479  // them will be deleted.
480  bool keep_alive = true;
481 };
482 
483 // Advanced use. Options to use when creating a constraint.
485  // ///////////////////////////////////////////////////////////////////////////
486  // SCIP options. Descriptions are from the SCIP documentation, e.g.
487  // SCIPcreateConsLinear:
488  // https://scip.zib.de/doc/html/group__CONSHDLRS.php#gaea3b4db21fe214be5db047e08b46b50e
489  // ///////////////////////////////////////////////////////////////////////////
490 
491  // Should the LP relaxation of constraint be in the initial LP? False for lazy
492  // constraints (true in callbacks).
493  bool initial = true;
494  // Should the constraint be separated during LP processing?
495  bool separate = true;
496  // Should the constraint be enforced during node processing? True for model
497  // constraints, false for redundant constraints.
498  bool enforce = true;
499  // Should the constraint be checked for feasibility? True for model
500  // constraints, false for redundant constraints.
501  bool check = true;
502  // Should the constraint be propagated during node processing?
503  bool propagate = true;
504  // Is constraint only valid locally? Must be true for branching constraints.
505  bool local = false;
506  // Is constraint modifiable (subject to column generation)? In column
507  // generation applications, set to true if pricing adds coefficients to this
508  // constraint.
509  bool modifiable = false;
510  // Is constraint subject to aging? Set to true for own cuts which are
511  // separated as constraints
512  bool dynamic = false;
513  // Should the relaxation be removed from the LP due to aging or cleanup? Set
514  // to true for 'lazy constraints' and 'user cuts'.
515  bool removable = false;
516  // Should the constraint always be kept at the node where it was added, even
517  // if it may be moved to a more global node? Usually set to false. Set to true
518  // for constraints that represent node data.
519  bool sticking_at_node = false;
520 
521  // ///////////////////////////////////////////////////////////////////////////
522  // gSCIP options.
523  // ///////////////////////////////////////////////////////////////////////////
524 
525  // If keep_alive=true, the returned constraint will not to be freed until
526  // after ~GScip() is called. Otherwise, the returned constraint could be freed
527  // internally by SCIP at any point, and it is not safe to hold a reference to
528  // the returned constraint.
529  //
530  // The primary reason to set keep_alive=false is if you are adding many
531  // constraints in a callback, and you expect that most of them will be
532  // deleted.
533  bool keep_alive = true;
534 };
535 
536 } // namespace operations_research
537 
538 #endif // OR_TOOLS_GSCIP_GSCIP_H_
operations_research::GScip::InterruptSolve
bool InterruptSolve()
Definition: gscip.cc:242
operations_research::GScipLogicalConstraintData::resultant
SCIP_VAR * resultant
Definition: gscip.h:440
operations_research::GScipVarType::kContinuous
@ kContinuous
var
IntVar * var
Definition: expr_array.cc:1858
operations_research::GScipVarType
GScipVarType
Definition: gscip.h:103
operations_research::GScip::SetObjCoef
absl::Status SetObjCoef(SCIP_VAR *var, double obj_coef)
Definition: gscip.cc:558
operations_research::GScipSolution
absl::flat_hash_map< SCIP_VAR *, double > GScipSolution
Definition: gscip.h:69
operations_research::GScipResult::gscip_output
GScipOutput gscip_output
Definition: gscip.h:74
operations_research::GScip::AddAndConstraint
absl::StatusOr< SCIP_CONS * > AddAndConstraint(const GScipLogicalConstraintData &logical_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:397
operations_research::GScip::DefaultCharParamValue
absl::StatusOr< char > DefaultCharParamValue(const std::string &parameter_name)
Definition: gscip.cc:864
operations_research::GScipResult::primal_ray
absl::flat_hash_map< SCIP_VAR *, double > primal_ray
Definition: gscip.h:85
operations_research::GScip::SetLinearConstraintLb
absl::Status SetLinearConstraintLb(SCIP_CONS *constraint, double lb)
Definition: gscip.cc:659
operations_research::GScip::AddIndicatorConstraint
absl::StatusOr< SCIP_CONS * > AddIndicatorConstraint(const GScipIndicatorConstraint &indicator_constraint, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:363
operations_research::GScipIndicatorConstraint
Definition: gscip.h:423
operations_research::GScipVariableOptions::removable
bool removable
Definition: gscip.h:466
operations_research::GScip::DefaultBoolParamValue
absl::StatusOr< bool > DefaultBoolParamValue(const std::string &parameter_name)
Definition: gscip.cc:832
operations_research::GScipQuadraticRange::linear_variables
std::vector< SCIP_Var * > linear_variables
Definition: gscip.h:375
operations_research::GScipHintResult::kInfeasible
@ kInfeasible
operations_research::GScip::SetUb
absl::Status SetUb(SCIP_VAR *var, double ub)
Definition: gscip.cc:552
operations_research::GScipConstraintOptions
Definition: gscip.h:484
operations_research::GScipLinearRange
Definition: gscip.h:93
operations_research::GScipLinearRange::upper_bound
double upper_bound
Definition: gscip.h:97
operations_research::GScip::DefaultStringParamValue
absl::StatusOr< std::string > DefaultStringParamValue(const std::string &parameter_name)
Definition: gscip.cc:872
operations_research::GScip::SetMaximize
absl::Status SetMaximize(bool is_maximize)
Definition: gscip.cc:522
value
int64 value
Definition: demon_profiler.cc:43
operations_research::GScipVariableOptions::keep_alive
bool keep_alive
Definition: gscip.h:480
operations_research::GScipSOSData
Definition: gscip.h:405
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::GScip::SuggestHint
absl::StatusOr< GScipHintResult > SuggestHint(const GScipSolution &partial_solution)
Definition: gscip.cc:687
operations_research::GScip::ObjectiveIsMaximize
bool ObjectiveIsMaximize()
Definition: gscip.cc:535
operations_research::GScipBranchingPriority
absl::flat_hash_map< SCIP_VAR *, int > GScipBranchingPriority
Definition: gscip.h:114
operations_research::DefaultGScipVariableOptions
const GScipVariableOptions & DefaultGScipVariableOptions()
Definition: gscip.cc:155
operations_research::GScip::kDefaultScipInf
static constexpr double kDefaultScipInf
Definition: gscip.h:322
operations_research::GScip::DeleteConstraint
absl::Status DeleteConstraint(SCIP_CONS *constraint)
Definition: gscip.cc:671
operations_research::GScipConstraintOptions::enforce
bool enforce
Definition: gscip.h:498
operations_research::GScipVariableOptions
Definition: gscip.h:455
operations_research::GScipIndicatorConstraint::negate_indicator
bool negate_indicator
Definition: gscip.h:426
operations_research::DefaultGScipConstraintOptions
const GScipConstraintOptions & DefaultGScipConstraintOptions()
Definition: gscip.cc:160
operations_research::GScip::LinearConstraintLb
double LinearConstraintLb(SCIP_CONS *constraint)
Definition: gscip.cc:647
operations_research::GScipConstraintOptions::check
bool check
Definition: gscip.h:501
operations_research::GScipIndicatorConstraint::coefficients
std::vector< double > coefficients
Definition: gscip.h:430
operations_research::GScip::ScipInf
double ScipInf()
Definition: gscip.cc:230
operations_research::GScip::Solve
absl::StatusOr< GScipResult > Solve(const GScipParameters &params=GScipParameters(), const std::string &legacy_params="")
Definition: gscip.cc:724
operations_research::GScip::Ub
double Ub(SCIP_VAR *var)
Definition: gscip.cc:615
operations_research::GScip::~GScip
~GScip()
Definition: gscip.cc:266
operations_research::GScipQuadraticRange::lower_bound
double lower_bound
Definition: gscip.h:371
operations_research::GScipQuadraticRange::quadratic_variables2
std::vector< SCIP_Var * > quadratic_variables2
Definition: gscip.h:389
operations_research::GScip::AddSOS1Constraint
absl::StatusOr< SCIP_CONS * > AddSOS1Constraint(const GScipSOSData &sos_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:469
operations_research::GScip::DeleteVariable
absl::Status DeleteVariable(SCIP_VAR *var)
Definition: gscip.cc:570
operations_research::GScipConstraintOptions::keep_alive
bool keep_alive
Definition: gscip.h:533
operations_research::GScipLinearRange::variables
std::vector< SCIP_VAR * > variables
Definition: gscip.h:95
operations_research::GScipQuadraticRange
Definition: gscip.h:369
operations_research::GScip::AddOrConstraint
absl::StatusOr< SCIP_CONS * > AddOrConstraint(const GScipLogicalConstraintData &logical_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:422
operations_research::GScipHintResult
GScipHintResult
Definition: gscip.h:444
operations_research::GScip::DefaultRealParamValue
absl::StatusOr< double > DefaultRealParamValue(const std::string &parameter_name)
Definition: gscip.cc:856
operations_research::GScipLinearRange::coefficients
std::vector< double > coefficients
Definition: gscip.h:96
operations_research::GScip::SafeBulkDelete
absl::Status SafeBulkDelete(const absl::flat_hash_set< SCIP_VAR * > &vars)
Definition: gscip.cc:591
operations_research::GScip::IsConstraintLinear
bool IsConstraintLinear(SCIP_CONS *constraint)
Definition: gscip.cc:631
operations_research::GScip::SetVarType
absl::Status SetVarType(SCIP_VAR *var, GScipVarType var_type)
Definition: gscip.cc:563
operations_research::GScip::AddQuadraticConstraint
absl::StatusOr< SCIP_CONS * > AddQuadraticConstraint(const GScipQuadraticRange &range, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:329
operations_research::GScip::LinearConstraintCoefficients
absl::Span< const double > LinearConstraintCoefficients(SCIP_CONS *constraint)
Definition: gscip.cc:635
operations_research::GScip
Definition: gscip.h:120
operations_research::GScipLogicalConstraintData
Definition: gscip.h:439
operations_research::GScipQuadraticRange::linear_coefficients
std::vector< double > linear_coefficients
Definition: gscip.h:376
operations_research::GScipConstraintOptions::dynamic
bool dynamic
Definition: gscip.h:512
operations_research::GScipQuadraticRange::upper_bound
double upper_bound
Definition: gscip.h:393
operations_research::GScip::DefaultLongParamValue
absl::StatusOr< int64_t > DefaultLongParamValue(const std::string &parameter_name)
Definition: gscip.cc:848
operations_research::GScip::ObjCoef
double ObjCoef(SCIP_VAR *var)
Definition: gscip.cc:619
operations_research::GScip::SetObjectiveOffset
absl::Status SetObjectiveOffset(double offset)
Definition: gscip.cc:528
operations_research::GScip::ObjectiveOffset
double ObjectiveOffset()
Definition: gscip.cc:539
operations_research::GScipResult::objective_values
std::vector< double > objective_values
Definition: gscip.h:80
operations_research::GScipConstraintOptions::propagate
bool propagate
Definition: gscip.h:503
operations_research::GScip::SetBranchingPriority
absl::Status SetBranchingPriority(SCIP_VAR *var, int priority)
Definition: gscip.cc:541
operations_research::GScipQuadraticRange::quadratic_variables1
std::vector< SCIP_Var * > quadratic_variables1
Definition: gscip.h:388
operations_research::GScip::AddSOS2Constraint
absl::StatusOr< SCIP_CONS * > AddSOS2Constraint(const GScipSOSData &sos_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:496
operations_research::GScip::CanSafeBulkDelete
absl::Status CanSafeBulkDelete(const absl::flat_hash_set< SCIP_VAR * > &vars)
Definition: gscip.cc:580
operations_research::GScip::ScipVersion
static std::string ScipVersion()
Definition: gscip.cc:236
operations_research::GScip::DefaultIntParamValue
absl::StatusOr< int > DefaultIntParamValue(const std::string &parameter_name)
Definition: gscip.cc:840
operations_research::GScip::SetLb
absl::Status SetLb(SCIP_VAR *var, double lb)
Definition: gscip.cc:546
operations_research::GScip::variables
const absl::flat_hash_set< SCIP_VAR * > & variables()
Definition: gscip.h:182
operations_research::GScip::Create
static absl::StatusOr< std::unique_ptr< GScip > > Create(const std::string &problem_name)
Definition: gscip.cc:218
operations_research::GScipLogicalConstraintData::operators
std::vector< SCIP_VAR * > operators
Definition: gscip.h:441
operations_research::GScipSOSData::weights
std::vector< double > weights
Definition: gscip.h:418
operations_research::GScipIndicatorConstraint::indicator_variable
SCIP_VAR * indicator_variable
Definition: gscip.h:425
operations_research::GScipConstraintOptions::modifiable
bool modifiable
Definition: gscip.h:509
operations_research::GScipVariableOptions::initial
bool initial
Definition: gscip.h:463
operations_research::GScip::Name
absl::string_view Name(SCIP_VAR *var)
Definition: gscip.cc:625
operations_research::GScipQuadraticRange::quadratic_coefficients
std::vector< double > quadratic_coefficients
Definition: gscip.h:390
operations_research::GScipConstraintOptions::separate
bool separate
Definition: gscip.h:495
operations_research::GScip::constraints
const absl::flat_hash_set< SCIP_CONS * > & constraints()
Definition: gscip.h:187
operations_research::GScip::AddLinearConstraint
absl::StatusOr< SCIP_CONS * > AddLinearConstraint(const GScipLinearRange &range, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:303
operations_research::GScip::LinearConstraintUb
double LinearConstraintUb(SCIP_CONS *constraint)
Definition: gscip.cc:651
operations_research::GScipConstraintOptions::sticking_at_node
bool sticking_at_node
Definition: gscip.h:519
gscip.pb.h
operations_research::GScipSOSData::variables
std::vector< SCIP_VAR * > variables
Definition: gscip.h:409
operations_research::GScip::scip
SCIP * scip()
Definition: gscip.h:332
operations_research::GScipResult::solutions
std::vector< GScipSolution > solutions
Definition: gscip.h:78
operations_research::GScip::SetLinearConstraintUb
absl::Status SetLinearConstraintUb(SCIP_CONS *constraint, double ub)
Definition: gscip.cc:665
operations_research::GScip::VarType
GScipVarType VarType(SCIP_VAR *var)
Definition: gscip.cc:621
operations_research::GScip::ConstraintType
absl::string_view ConstraintType(SCIP_CONS *constraint)
Definition: gscip.cc:627
operations_research::GScip::AddVariable
absl::StatusOr< SCIP_VAR * > AddVariable(double lb, double ub, double obj_coef, GScipVarType var_type, const std::string &var_name="", const GScipVariableOptions &options=DefaultGScipVariableOptions())
Definition: gscip.cc:271
operations_research::GScipIndicatorConstraint::upper_bound
double upper_bound
Definition: gscip.h:432
operations_research::GScip::Lb
double Lb(SCIP_VAR *var)
Definition: gscip.cc:611
operations_research::GScip::SetLinearConstraintCoef
absl::Status SetLinearConstraintCoef(SCIP_CONS *constraint, SCIP_VAR *var, double value)
Definition: gscip.cc:678
operations_research::GScipConstraintOptions::removable
bool removable
Definition: gscip.h:515
operations_research::GScipLinearRange::lower_bound
double lower_bound
Definition: gscip.h:94
name
const std::string name
Definition: default_search.cc:808
operations_research::GScip::LinearConstraintVariables
absl::Span< SCIP_VAR *const > LinearConstraintVariables(SCIP_CONS *constraint)
Definition: gscip.cc:641
operations_research::GScipResult
Definition: gscip.h:73
operations_research::GScipConstraintOptions::initial
bool initial
Definition: gscip.h:493
operations_research::GScipIndicatorConstraint::variables
std::vector< SCIP_Var * > variables
Definition: gscip.h:428