OR-Tools  8.2
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
67namespace operations_research {
68
69using 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.
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.
104
105// Some advanced features, defined at the end of the header file.
106struct GScipQuadraticRange;
107struct GScipSOSData;
108struct GScipIndicatorConstraint;
109struct GScipLogicalConstraintData;
110struct GScipVariableOptions;
111const GScipVariableOptions& DefaultGScipVariableOptions();
112struct GScipConstraintOptions;
113const GScipConstraintOptions& DefaultGScipConstraintOptions();
114using GScipBranchingPriority = absl::flat_hash_map<SCIP_VAR*, int>;
115enum 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.
120class 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.
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
444enum class GScipHintResult {
445 // Hint was not feasible.
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.
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_
double LinearConstraintUb(SCIP_CONS *constraint)
Definition: gscip.cc:660
absl::Status SetObjectiveOffset(double offset)
Definition: gscip.cc:537
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:280
absl::Status DeleteVariable(SCIP_VAR *var)
Definition: gscip.cc:579
absl::StatusOr< SCIP_CONS * > AddOrConstraint(const GScipLogicalConstraintData &logical_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:431
absl::StatusOr< double > DefaultRealParamValue(const std::string &parameter_name)
Definition: gscip.cc:865
absl::Status CanSafeBulkDelete(const absl::flat_hash_set< SCIP_VAR * > &vars)
Definition: gscip.cc:589
absl::StatusOr< SCIP_CONS * > AddAndConstraint(const GScipLogicalConstraintData &logical_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:406
absl::StatusOr< SCIP_CONS * > AddLinearConstraint(const GScipLinearRange &range, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:312
bool IsConstraintLinear(SCIP_CONS *constraint)
Definition: gscip.cc:640
absl::string_view ConstraintType(SCIP_CONS *constraint)
Definition: gscip.cc:636
absl::StatusOr< int64_t > DefaultLongParamValue(const std::string &parameter_name)
Definition: gscip.cc:857
absl::StatusOr< int > DefaultIntParamValue(const std::string &parameter_name)
Definition: gscip.cc:849
absl::Status DeleteConstraint(SCIP_CONS *constraint)
Definition: gscip.cc:680
absl::Status SetLinearConstraintUb(SCIP_CONS *constraint, double ub)
Definition: gscip.cc:674
absl::Status SafeBulkDelete(const absl::flat_hash_set< SCIP_VAR * > &vars)
Definition: gscip.cc:600
absl::StatusOr< GScipResult > Solve(const GScipParameters &params=GScipParameters(), const std::string &legacy_params="")
Definition: gscip.cc:733
const absl::flat_hash_set< SCIP_VAR * > & variables()
Definition: gscip.h:182
static absl::StatusOr< std::unique_ptr< GScip > > Create(const std::string &problem_name)
Definition: gscip.cc:227
double Ub(SCIP_VAR *var)
Definition: gscip.cc:624
double ObjCoef(SCIP_VAR *var)
Definition: gscip.cc:628
absl::Status SetMaximize(bool is_maximize)
Definition: gscip.cc:531
absl::StatusOr< std::string > DefaultStringParamValue(const std::string &parameter_name)
Definition: gscip.cc:881
absl::StatusOr< bool > DefaultBoolParamValue(const std::string &parameter_name)
Definition: gscip.cc:841
absl::StatusOr< SCIP_CONS * > AddIndicatorConstraint(const GScipIndicatorConstraint &indicator_constraint, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:372
double Lb(SCIP_VAR *var)
Definition: gscip.cc:620
absl::Status SetLb(SCIP_VAR *var, double lb)
Definition: gscip.cc:555
absl::Span< SCIP_VAR *const > LinearConstraintVariables(SCIP_CONS *constraint)
Definition: gscip.cc:650
double LinearConstraintLb(SCIP_CONS *constraint)
Definition: gscip.cc:656
absl::Status SetLinearConstraintCoef(SCIP_CONS *constraint, SCIP_VAR *var, double value)
Definition: gscip.cc:687
absl::Status SetLinearConstraintLb(SCIP_CONS *constraint, double lb)
Definition: gscip.cc:668
absl::StatusOr< GScipHintResult > SuggestHint(const GScipSolution &partial_solution)
Definition: gscip.cc:696
GScipVarType VarType(SCIP_VAR *var)
Definition: gscip.cc:630
absl::Status SetVarType(SCIP_VAR *var, GScipVarType var_type)
Definition: gscip.cc:572
absl::Status SetBranchingPriority(SCIP_VAR *var, int priority)
Definition: gscip.cc:550
absl::StatusOr< char > DefaultCharParamValue(const std::string &parameter_name)
Definition: gscip.cc:873
absl::Span< const double > LinearConstraintCoefficients(SCIP_CONS *constraint)
Definition: gscip.cc:644
absl::Status SetUb(SCIP_VAR *var, double ub)
Definition: gscip.cc:561
absl::Status SetObjCoef(SCIP_VAR *var, double obj_coef)
Definition: gscip.cc:567
absl::StatusOr< SCIP_CONS * > AddSOS2Constraint(const GScipSOSData &sos_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:505
static std::string ScipVersion()
Definition: gscip.cc:245
absl::StatusOr< SCIP_CONS * > AddQuadraticConstraint(const GScipQuadraticRange &range, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:338
const absl::flat_hash_set< SCIP_CONS * > & constraints()
Definition: gscip.h:187
static constexpr double kDefaultScipInf
Definition: gscip.h:322
absl::string_view Name(SCIP_VAR *var)
Definition: gscip.cc:634
absl::StatusOr< SCIP_CONS * > AddSOS1Constraint(const GScipSOSData &sos_data, const std::string &name="", const GScipConstraintOptions &options=DefaultGScipConstraintOptions())
Definition: gscip.cc:478
const std::string name
int64 value
IntVar * var
Definition: expr_array.cc:1858
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
const GScipConstraintOptions & DefaultGScipConstraintOptions()
Definition: gscip.cc:160
const GScipVariableOptions & DefaultGScipVariableOptions()
Definition: gscip.cc:155
absl::flat_hash_map< SCIP_VAR *, int > GScipBranchingPriority
Definition: gscip.h:114
absl::flat_hash_map< SCIP_VAR *, double > GScipSolution
Definition: gscip.h:69
std::vector< SCIP_Var * > variables
Definition: gscip.h:428
std::vector< SCIP_VAR * > variables
Definition: gscip.h:95
std::vector< double > coefficients
Definition: gscip.h:96
std::vector< SCIP_VAR * > operators
Definition: gscip.h:441
std::vector< SCIP_Var * > quadratic_variables1
Definition: gscip.h:388
std::vector< SCIP_Var * > quadratic_variables2
Definition: gscip.h:389
std::vector< SCIP_Var * > linear_variables
Definition: gscip.h:375
std::vector< double > linear_coefficients
Definition: gscip.h:376
std::vector< double > quadratic_coefficients
Definition: gscip.h:390
absl::flat_hash_map< SCIP_VAR *, double > primal_ray
Definition: gscip.h:85
std::vector< double > objective_values
Definition: gscip.h:80
std::vector< GScipSolution > solutions
Definition: gscip.h:78
std::vector< SCIP_VAR * > variables
Definition: gscip.h:409
std::vector< double > weights
Definition: gscip.h:418