Scippy

SCIP

Solving Constraint Integer Programs

sol.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file sol.h
26 * @ingroup INTERNALAPI
27 * @brief internal methods for storing primal CIP solutions
28 * @author Tobias Achterberg
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_SOL_H__
34#define __SCIP_SOL_H__
35
36
37#include <stdio.h>
38
39#include "scip/def.h"
41#include "scip/type_retcode.h"
42#include "scip/type_set.h"
43#include "scip/type_stat.h"
44#include "scip/type_lp.h"
45#include "scip/type_lpexact.h"
46#include "scip/type_nlp.h"
47#include "scip/type_var.h"
48#include "scip/type_prob.h"
49#include "scip/type_sol.h"
50#include "scip/type_primal.h"
51#include "scip/type_tree.h"
52#include "scip/type_heur.h"
53#include "scip/pub_sol.h"
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59/** creates primal CIP solution, initialized to zero */
61 SCIP_SOL** sol, /**< pointer to primal CIP solution */
62 BMS_BLKMEM* blkmem, /**< block memory */
63 SCIP_SET* set, /**< global SCIP settings */
64 SCIP_STAT* stat, /**< problem statistics data */
65 SCIP_PRIMAL* primal, /**< primal data */
66 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
67 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
68 );
69
70/** creates primal CIP solution with exact rational values, initialized to zero */
72 SCIP_SOL** sol, /**< pointer to primal CIP solution */
73 BMS_BLKMEM* blkmem, /**< block memory */
74 SCIP_SET* set, /**< global SCIP settings */
75 SCIP_STAT* stat, /**< problem statistics data */
76 SCIP_PRIMAL* primal, /**< primal data */
77 SCIP_TREE* tree, /**< branch and bound tree */
78 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
79 );
80
81/** creates primal CIP solution in original problem space, initialized to the offset in the original problem */
83 SCIP_SOL** sol, /**< pointer to primal CIP solution */
84 BMS_BLKMEM* blkmem, /**< block memory */
85 SCIP_SET* set, /**< global SCIP settings */
86 SCIP_STAT* stat, /**< problem statistics data */
87 SCIP_PROB* origprob, /**< original problem data */
88 SCIP_PRIMAL* primal, /**< primal data */
89 SCIP_TREE* tree, /**< branch and bound tree */
90 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
91 );
92
93/** creates exact primal CIP solution in original problem space, initialized to the offset in the original problem */
95 SCIP_SOL** sol, /**< pointer to primal CIP solution */
96 BMS_BLKMEM* blkmem, /**< block memory */
97 SCIP_SET* set, /**< global SCIP settings */
98 SCIP_STAT* stat, /**< problem statistics data */
99 SCIP_PROB* origprob, /**< original problem data */
100 SCIP_PRIMAL* primal, /**< primal data */
101 SCIP_TREE* tree, /**< branch and bound tree */
102 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
103 );
104
105/** creates a copy of a primal CIP solution */
107 SCIP_SOL** sol, /**< pointer to store the copy of the primal CIP solution */
108 BMS_BLKMEM* blkmem, /**< block memory */
109 SCIP_SET* set, /**< global SCIP settings */
110 SCIP_STAT* stat, /**< problem statistics data */
111 SCIP_PRIMAL* primal, /**< primal data */
112 SCIP_SOL* sourcesol /**< primal CIP solution to copy */
113 );
114
115/** transformes given original solution to the transformed space; a corresponding transformed solution has to be given
116 * which is copied into the existing solution and freed afterwards
117 */
119 SCIP_SOL* sol, /**< primal CIP solution to change, living in original space */
120 SCIP_SOL** transsol, /**< pointer to corresponding transformed primal CIP solution */
121 BMS_BLKMEM* blkmem, /**< block memory */
122 SCIP_SET* set, /**< global SCIP settings */
123 SCIP_PRIMAL* primal /**< primal data */
124 );
125
126/** adjusts solution values of implied integral variables in handed solution, solution objective value is not
127 * deteriorated by this method
128 */
130 SCIP_SOL* sol, /**< primal CIP solution */
131 SCIP_SET* set, /**< global SCIP settings */
132 SCIP_STAT* stat, /**< problem statistics data */
133 SCIP_PROB* prob, /**< either original or transformed problem, depending on sol origin */
134 SCIP_TREE* tree, /**< branch and bound tree */
135 SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
136 );
137
138/** creates primal CIP solution, initialized to the current LP solution */
140 SCIP_SOL** sol, /**< pointer to primal CIP solution */
141 BMS_BLKMEM* blkmem, /**< block memory */
142 SCIP_SET* set, /**< global SCIP settings */
143 SCIP_STAT* stat, /**< problem statistics data */
144 SCIP_PROB* prob, /**< transformed problem data */
145 SCIP_PRIMAL* primal, /**< primal data */
146 SCIP_TREE* tree, /**< branch and bound tree */
147 SCIP_LP* lp, /**< current LP data */
148 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
149 );
150
151/** creates primal CIP solution with exact rational values, initialized to the current LP solution */
153 SCIP_SOL** sol, /**< pointer to primal CIP solution */
154 BMS_BLKMEM* blkmem, /**< block memory */
155 SCIP_SET* set, /**< global SCIP settings */
156 SCIP_STAT* stat, /**< problem statistics data */
157 SCIP_PRIMAL* primal, /**< primal data */
158 SCIP_TREE* tree, /**< branch and bound tree */
159 SCIP_LPEXACT* lp, /**< current LP data */
160 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
161 );
162
163/** creates primal CIP solution, initialized to the current NLP solution */
165 SCIP_SOL** sol, /**< pointer to primal CIP solution */
166 BMS_BLKMEM* blkmem, /**< block memory */
167 SCIP_SET* set, /**< global SCIP settings */
168 SCIP_STAT* stat, /**< problem statistics data */
169 SCIP_PRIMAL* primal, /**< primal data */
170 SCIP_TREE* tree, /**< branch and bound tree */
171 SCIP_NLP* nlp, /**< current NLP data */
172 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
173 );
174
175/** creates primal CIP solution, initialized to the current relaxation solution */
177 SCIP_SOL** sol, /**< pointer to primal CIP solution */
178 BMS_BLKMEM* blkmem, /**< block memory */
179 SCIP_SET* set, /**< global SCIP settings */
180 SCIP_STAT* stat, /**< problem statistics data */
181 SCIP_PRIMAL* primal, /**< primal data */
182 SCIP_TREE* tree, /**< branch and bound tree */
183 SCIP_RELAXATION* relaxation, /**< global relaxation data */
184 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
185 );
186
187/** creates primal CIP solution, initialized to the current pseudo solution */
189 SCIP_SOL** sol, /**< pointer to primal CIP solution */
190 BMS_BLKMEM* blkmem, /**< block memory */
191 SCIP_SET* set, /**< global SCIP settings */
192 SCIP_STAT* stat, /**< problem statistics data */
193 SCIP_PROB* prob, /**< transformed problem data */
194 SCIP_PRIMAL* primal, /**< primal data */
195 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
196 SCIP_LP* lp, /**< current LP data */
197 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
198 );
199
200/** creates primal CIP solution, initialized to the current exact pseudo solution */
202 SCIP_SOL** sol, /**< pointer to primal CIP solution */
203 BMS_BLKMEM* blkmem, /**< block memory */
204 SCIP_SET* set, /**< global SCIP settings */
205 SCIP_STAT* stat, /**< problem statistics data */
206 SCIP_PRIMAL* primal, /**< primal data */
207 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
208 SCIP_LPEXACT* lp, /**< current LP data */
209 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
210 );
211
212/** creates primal CIP solution, initialized to the current solution */
214 SCIP_SOL** sol, /**< pointer to primal CIP solution */
215 BMS_BLKMEM* blkmem, /**< block memory */
216 SCIP_SET* set, /**< global SCIP settings */
217 SCIP_STAT* stat, /**< problem statistics data */
218 SCIP_PROB* prob, /**< transformed problem data */
219 SCIP_PRIMAL* primal, /**< primal data */
220 SCIP_TREE* tree, /**< branch and bound tree */
221 SCIP_LP* lp, /**< current LP data */
222 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
223 );
224
225/** creates primal CIP solution with exact rational values, initialized to the current solution */
227 SCIP_SOL** sol, /**< pointer to primal CIP solution */
228 BMS_BLKMEM* blkmem, /**< block memory */
229 SCIP_SET* set, /**< global SCIP settings */
230 SCIP_STAT* stat, /**< problem statistics data */
231 SCIP_PRIMAL* primal, /**< primal data */
232 SCIP_TREE* tree, /**< branch and bound tree */
233 SCIP_LPEXACT* lp, /**< current LP data */
234 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
235 );
236
237/** creates partial primal CIP solution, initialized to unknown values */
239 SCIP_SOL** sol, /**< pointer to primal CIP solution */
240 BMS_BLKMEM* blkmem, /**< block memory */
241 SCIP_SET* set, /**< global SCIP settings */
242 SCIP_STAT* stat, /**< problem statistics data */
243 SCIP_PRIMAL* primal, /**< primal data */
244 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
245 );
246
247/** creates primal CIP solution, initialized to unknown values */
249 SCIP_SOL** sol, /**< pointer to primal CIP solution */
250 BMS_BLKMEM* blkmem, /**< block memory */
251 SCIP_SET* set, /**< global SCIP settings */
252 SCIP_STAT* stat, /**< problem statistics data */
253 SCIP_PRIMAL* primal, /**< primal data */
254 SCIP_TREE* tree, /**< branch and bound tree */
255 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
256 );
257
258/** frees primal CIP solution */
260 SCIP_SOL** sol, /**< pointer to primal CIP solution */
261 BMS_BLKMEM* blkmem, /**< block memory */
262 SCIP_PRIMAL* primal /**< primal data */
263 );
264
265/** copies current LP solution into CIP solution by linking */
267 SCIP_SOL* sol, /**< primal CIP solution */
268 SCIP_SET* set, /**< global SCIP settings */
269 SCIP_STAT* stat, /**< problem statistics data */
270 SCIP_PROB* prob, /**< transformed problem data */
271 SCIP_TREE* tree, /**< branch and bound tree */
272 SCIP_LP* lp /**< current LP data */
273 );
274
275/** copies current exact LP solution into CIP solution by linking */
277 SCIP_SOL* sol, /**< primal CIP solution */
278 SCIP_SET* set, /**< global SCIP settings */
279 SCIP_LPEXACT* lp /**< current LP data */
280 );
281
282/** copies current NLP solution into CIP solution by linking */
284 SCIP_SOL* sol, /**< primal CIP solution */
285 SCIP_STAT* stat, /**< problem statistics data */
286 SCIP_TREE* tree, /**< branch and bound tree */
287 SCIP_NLP* nlp /**< current NLP data */
288 );
289
290/** copies current relaxation solution into CIP solution by linking */
292 SCIP_SOL* sol, /**< primal CIP solution */
293 SCIP_SET* set, /**< global SCIP settings */
294 SCIP_STAT* stat, /**< problem statistics data */
295 SCIP_TREE* tree, /**< branch and bound tree */
296 SCIP_RELAXATION* relaxation /**< global relaxation data */
297 );
298
299/** copies current pseudo solution into CIP solution by linking */
301 SCIP_SOL* sol, /**< primal CIP solution */
302 SCIP_SET* set, /**< global SCIP settings */
303 SCIP_STAT* stat, /**< problem statistics data */
304 SCIP_PROB* prob, /**< transformed problem data */
305 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
306 SCIP_LP* lp /**< current LP data */
307 );
308
309/** copies current pseudo solution into CIP solution by linking */
311 SCIP_SOL* sol, /**< primal CIP solution */
312 SCIP_SET* set, /**< global SCIP settings */
313 SCIP_LPEXACT* lp /**< current LP data */
314 );
315
316/** copies current solution (LP or pseudo solution) into CIP solution by linking */
318 SCIP_SOL* sol, /**< primal CIP solution */
319 SCIP_SET* set, /**< global SCIP settings */
320 SCIP_STAT* stat, /**< problem statistics data */
321 SCIP_PROB* prob, /**< transformed problem data */
322 SCIP_TREE* tree, /**< branch and bound tree */
323 SCIP_LP* lp /**< current LP data */
324 );
325
326/** clears primal CIP solution */
328 SCIP_SOL* sol, /**< primal CIP solution */
329 SCIP_STAT* stat, /**< problem statistics data */
330 SCIP_TREE* tree /**< branch and bound tree */
331 );
332
333/** declares all entries in the primal CIP solution to be unknown */
335 SCIP_SOL* sol, /**< primal CIP solution */
336 SCIP_STAT* stat, /**< problem statistics data */
337 SCIP_TREE* tree /**< branch and bound tree */
338 );
339
340/** stores solution values of variables in solution's own array */
342 SCIP_SOL* sol, /**< primal CIP solution */
343 SCIP_SET* set, /**< global SCIP settings */
344 SCIP_PROB* prob /**< transformed problem data */
345 );
346
347/** stores solution values of variables in solution's own array */
349 SCIP_SOL* sol, /**< primal CIP solution */
350 SCIP_SET* set, /**< global SCIP settings */
351 SCIP_PROB* prob /**< transformed problem data */
352 );
353
354/** sets value of variable in primal CIP solution */
356 SCIP_SOL* sol, /**< primal CIP solution */
357 SCIP_SET* set, /**< global SCIP settings */
358 SCIP_STAT* stat, /**< problem statistics data */
359 SCIP_TREE* tree, /**< branch and bound tree */
360 SCIP_VAR* var, /**< variable to add to solution */
361 SCIP_Real val /**< solution value of variable */
362 );
363
364/** sets value of variable in primal CIP solution */
366 SCIP_SOL* sol, /**< primal CIP solution */
367 SCIP_SET* set, /**< global SCIP settings */
368 SCIP_STAT* stat, /**< problem statistics data */
369 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
370 SCIP_VAR* var, /**< variable to add to solution */
371 SCIP_RATIONAL* val /**< solution value of variable */
372 );
373
374/** increases value of variable in primal CIP solution */
376 SCIP_SOL* sol, /**< primal CIP solution */
377 SCIP_SET* set, /**< global SCIP settings */
378 SCIP_STAT* stat, /**< problem statistics data */
379 SCIP_TREE* tree, /**< branch and bound tree */
380 SCIP_VAR* var, /**< variable to increase solution value for */
381 SCIP_Real incval /**< increment for solution value of variable */
382 );
383
384/** returns value of variable in primal CIP solution */
386 SCIP_SOL* sol, /**< primal CIP solution */
387 SCIP_SET* set, /**< global SCIP settings */
388 SCIP_STAT* stat, /**< problem statistics data */
389 SCIP_VAR* var /**< variable to get value for */
390 );
391
392/** returns value of variable in primal CIP solution */
394 SCIP_RATIONAL* res,
395 SCIP_SOL* sol, /**< primal CIP solution */
396 SCIP_SET* set, /**< global SCIP settings */
397 SCIP_STAT* stat, /**< problem statistics data */
398 SCIP_VAR* var /**< variable to get value for */
399 );
400
401/** returns value of variable in primal ray represented by primal CIP solution */
403 SCIP_SOL* sol, /**< primal CIP solution, representing a primal ray */
404 SCIP_SET* set, /**< global SCIP settings */
405 SCIP_STAT* stat, /**< problem statistics data */
406 SCIP_VAR* var /**< variable to get value for */
407 );
408
409
410/** gets objective value of primal CIP solution in transformed problem */
412 SCIP_SOL* sol, /**< primal CIP solution */
413 SCIP_SET* set, /**< global SCIP settings */
414 SCIP_PROB* transprob, /**< tranformed problem data */
415 SCIP_PROB* origprob /**< original problem data */
416 );
417
418/** gets objective value of primal CIP solution in transformed problem */
420 SCIP_SOL* sol, /**< primal CIP solution */
421 SCIP_SET* set, /**< global SCIP settings */
422 SCIP_PROB* transprob, /**< tranformed problem data */
423 SCIP_PROB* origprob, /**< original problem data */
424 SCIP_RATIONAL* objval /**< store the result here */
425 );
426
427/** updates primal solutions after a change in a variable's objective value */
429 SCIP_SOL* sol, /**< primal CIP solution */
430 SCIP_VAR* var, /**< problem variable */
431 SCIP_Real oldobj, /**< old objective value */
432 SCIP_Real newobj /**< new objective value */
433 );
434
435/* mark the given solution as partial solution */
437 SCIP_SOL* sol, /**< primal CIP solution */
438 SCIP_SET* set, /**< global SCIP settings */
439 SCIP_STAT* stat, /**< problem statistics */
440 SCIP_VAR** vars, /**< problem variables */
441 int nvars /**< number of problem variables */
442 );
443
444/** checks solution for feasibility in original problem without adding it to the solution store
445 *
446 * We first check the variable bounds. Then we loop over all constraint handlers and constraints, checking each in the
447 * order of their check priority.
448 */
450 SCIP_SOL* sol, /**< primal CIP solution */
451 SCIP_SET* set, /**< global SCIP settings */
452 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
453 BMS_BLKMEM* blkmem, /**< block memory */
454 SCIP_STAT* stat, /**< problem statistics */
455 SCIP_PROB* prob, /**< transformed problem data */
456 SCIP_PRIMAL* primal, /**< primal data */
457 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
458 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
459 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
460 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
461 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
462 SCIP_Bool checkmodifiable, /**< have modifiable constraint to be checked? */
463 SCIP_Bool* feasible /**< stores whether given solution is feasible */
464 );
465
466/** checks primal CIP solution for feasibility
467 *
468 * @note The difference between SCIPsolCheck() and SCIPcheckSolOrig() is that modifiable constraints are handled
469 * differently. There might be some variables which do not have an original counter part (e.g. in
470 * branch-and-price). Therefore, modifiable constraints can not be double-checked in the original space.
471 */
473 SCIP_SOL* sol, /**< primal CIP solution */
474 SCIP_SET* set, /**< global SCIP settings */
475 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
476 BMS_BLKMEM* blkmem, /**< block memory */
477 SCIP_STAT* stat, /**< problem statistics */
478 SCIP_PROB* prob, /**< transformed problem data */
479 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
480 SCIP_Bool completely, /**< Should all violations be checked? */
481 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
482 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
483 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
484 SCIP_Bool* feasible /**< stores whether solution is feasible */
485 );
486
487/** try to round given solution */
489 SCIP_SOL* sol, /**< primal solution */
490 SCIP_SET* set, /**< global SCIP settings */
491 SCIP_STAT* stat, /**< problem statistics data */
492 SCIP_PROB* prob, /**< transformed problem data */
493 SCIP_TREE* tree, /**< branch and bound tree */
494 SCIP_Bool* success /**< pointer to store whether rounding was successful */
495 );
496
497/** copies the real values to the exact arrays of the solution */
499 SCIP_SOL* sol, /**< primal solution */
500 BMS_BLKMEM* blkmem, /**< block memory */
501 SCIP_SET* set, /**< global SCIP settings */
502 SCIP_STAT* stat, /**< problem statistics data */
503 SCIP_PROB* prob /**< transformed problem data */
504 );
505
506/** approximates and copies the exact values to the real arrays of the solution and frees the exact data */
508 SCIP_SOL* sol, /**< primal solution */
509 BMS_BLKMEM* blkmem, /**< block memory */
510 SCIP_SET* set, /**< global SCIP settings */
511 SCIP_STAT* stat, /**< problem statistics data */
512 SCIP_PROB* prob /**< transformed problem data */
513 );
514
515/** updates the solution value sums in variables by adding the value in the given solution */
517 SCIP_SOL* sol, /**< primal CIP solution */
518 SCIP_SET* set, /**< global SCIP settings */
519 SCIP_STAT* stat, /**< problem statistics data */
520 SCIP_PROB* prob, /**< transformed problem data */
521 SCIP_Real weight /**< weight of solution in weighted average */
522 );
523
524/** retransforms solution to original problem space */
526 SCIP_SOL* sol, /**< primal CIP solution */
527 SCIP_SET* set, /**< global SCIP settings */
528 SCIP_STAT* stat, /**< problem statistics data */
529 SCIP_PROB* origprob, /**< original problem */
530 SCIP_PROB* transprob, /**< transformed problem */
531 SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */
532 );
533
534/** retransforms exact part of solution to original problem space */
536 SCIP_SOL* sol, /**< primal CIP solution */
537 SCIP_SET* set, /**< global SCIP settings */
538 SCIP_STAT* stat, /**< problem statistics data */
539 SCIP_PROB* origprob, /**< original problem */
540 SCIP_PROB* transprob, /**< transformed problem */
541 SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */
542 );
543
544/** recomputes the objective value of an original solution, e.g., when transferring solutions
545 * from the solution pool (objective coefficients might have changed in the meantime)
546 */
548 SCIP_SOL* sol, /**< primal CIP solution */
549 SCIP_SET* set, /**< global SCIP settings */
550 SCIP_STAT* stat, /**< problem statistics data */
551 SCIP_PROB* origprob /**< original problem */
552 );
553
554/** recomputes the objective value of an exact solution, e.g., when initialized from a real solution */
556 SCIP_SOL* sol, /**< primal CIP solution */
557 SCIP_SET* set, /**< global SCIP settings */
558 SCIP_STAT* stat, /**< problem statistics data */
559 SCIP_PROB* prob /**< scip problem */
560 );
561
562/** returns whether the given solutions in transformed space are equal */
564 SCIP_SOL* sol1, /**< first primal CIP solution */
565 SCIP_SOL* sol2, /**< second primal CIP solution */
566 SCIP_SET* set, /**< global SCIP settings */
567 SCIP_STAT* stat, /**< problem statistics data */
568 SCIP_PROB* origprob, /**< original problem */
569 SCIP_PROB* transprob /**< transformed problem after presolve */
570 );
571
572/** outputs non-zero elements of solution to file stream */
574 SCIP_SOL* sol, /**< primal CIP solution */
575 SCIP_SET* set, /**< global SCIP settings */
576 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
577 SCIP_STAT* stat, /**< problem statistics data */
578 SCIP_PROB* prob, /**< problem data (original or transformed) */
579 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
580 FILE* file, /**< output file (or NULL for standard output) */
581 SCIP_Bool mipstart, /**< should only discrete variables be printed? */
582 SCIP_Bool printzeros /**< should variables set to zero be printed? */
583 );
584
585/** outputs non-zero elements of solution to file stream */
587 SCIP_SOL* sol, /**< primal CIP solution */
588 SCIP_SET* set, /**< global SCIP settings */
589 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
590 SCIP_STAT* stat, /**< problem statistics data */
591 SCIP_PROB* prob, /**< problem data (original or transformed) */
592 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
593 FILE* file, /**< output file (or NULL for standard output) */
594 SCIP_Bool mipstart, /**< should only discrete variables be printed? */
595 SCIP_Bool printzeros /**< should variables set to zero be printed? */
596 );
597
598/** outputs non-zero elements of solution representing a ray to file stream */
600 SCIP_SOL* sol, /**< primal CIP solution */
601 SCIP_SET* set, /**< global SCIP settings */
602 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
603 SCIP_STAT* stat, /**< problem statistics data */
604 SCIP_PROB* prob, /**< problem data (original or transformed) */
605 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
606 FILE* file, /**< output file (or NULL for standard output) */
607 SCIP_Bool printzeros /**< should variables set to zero be printed? */
608 );
609
610/** set new origin type for a solution */
612 SCIP_SOL* sol, /**< primal CIP solution */
613 SCIP_SOLORIGIN origin /**< new origin type of the solution */
614 );
615
616/** reset violations of a solution */
618 SCIP_SOL* sol /**< primal CIP solution */
619 );
620
621/** update integrality violation of a solution */
623 SCIP_SOL* sol, /**< primal CIP solution */
624 SCIP_Real absviolintegrality /**< absolute violation of integrality */
625 );
626
627/** update bound violation of a solution */
629 SCIP_SOL* sol, /**< primal CIP solution */
630 SCIP_Real absviolbounds, /**< absolute violation of bounds */
631 SCIP_Real relviolbounds /**< relative violation of bounds */
632 );
633
634/** update LP row violation of a solution */
636 SCIP_SOL* sol, /**< primal CIP solution */
637 SCIP_Real absviollprows, /**< absolute violation of LP rows */
638 SCIP_Real relviollprows /**< relative violation of LP rows */
639 );
640
641/** update constraint violation of a solution */
643 SCIP_SOL* sol, /**< primal CIP solution */
644 SCIP_Real absviolcons, /**< absolute violation of constraint */
645 SCIP_Real relviolcons /**< relative violation of constraint */
646 );
647
648/** update violation of a constraint that is represented in the LP */
650 SCIP_SOL* sol, /**< primal CIP solution */
651 SCIP_Real absviol, /**< absolute violation of constraint */
652 SCIP_Real relviol /**< relative violation of constraint */
653 );
654
655/** gets objective value of primal CIP solution which lives in the original problem space */
657 SCIP_SOL* sol /**< primal CIP solution */
658 );
659
660/** overwrite FP solution with exact values */
662 SCIP_SOL* sol, /**< exact primal CIP solution */
663 SCIP_SET* set, /**< global SCIP settings */
664 SCIP_STAT* stat, /**< problem statistics data */
665 SCIP_PROB* origprob, /**< problem data */
666 SCIP_PROB* transprob, /**< problem data */
667 SCIP_TREE* tree /**< branch and bound tree, or NULL */
668 );
669
670/** creates a copy of a primal CIP solution */
672 SCIP_VALSEXACT** valsexact, /**< pointer to store the copy of the primal CIP solution */
673 BMS_BLKMEM* blkmem, /**< block memory */
674 SCIP_VALSEXACT* sourcevals /**< primal CIP solution to copy */
675 );
676
677/* In debug mode, the following methods are implemented as function calls to ensure
678 * type validity.
679 */
680
681/** adds value to the objective value of a given original primal CIP solution */
683 SCIP_SOL* sol, /**< primal CIP solution */
684 SCIP_Real addval /**< offset value to add */
685 );
686
687/** gets current position of solution in array of existing solutions of primal data */
689 SCIP_SOL* sol /**< primal CIP solution */
690 );
691
692/** sets current position of solution in array of existing solutions of primal data */
694 SCIP_SOL* sol, /**< primal CIP solution */
695 int primalindex /**< new primal index of solution */
696 );
697
698#ifdef NDEBUG
699
700/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
701 * speed up the algorithms.
702 */
703
704#define SCIPsolOrigAddObjval(sol, addval) ((sol)->obj += (addval))
705#define SCIPsolGetPrimalIndex(sol) ((sol)->primalindex)
706#define SCIPsolSetPrimalIndex(sol,idx) { (sol)->primalindex = idx; }
707
708#endif
709
710#ifdef __cplusplus
711}
712#endif
713
714#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:156
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
public methods for primal CIP solutions
void SCIPsolUpdateVarObj(SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
Definition: sol.c:2293
SCIP_RETCODE SCIPsolCreateRelaxSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_RELAXATION *relaxation, SCIP_HEUR *heur)
Definition: sol.c:914
void SCIPsolUpdateConsViolation(SCIP_SOL *sol, SCIP_Real absviolcons, SCIP_Real relviolcons)
Definition: sol.c:3941
SCIP_RETCODE SCIPsolMakeReal(SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
Definition: sol.c:2906
SCIP_RETCODE SCIPsolLinkPseudoSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:1318
void SCIPsolSetPrimalIndex(SCIP_SOL *sol, int primalindex)
Definition: sol.c:4279
SCIP_RETCODE SCIPsolCreatePartial(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_HEUR *heur)
Definition: sol.c:1039
SCIP_RETCODE SCIPsolCreateUnknown(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:1079
void SCIPsolUpdateBoundViolation(SCIP_SOL *sol, SCIP_Real absviolbounds, SCIP_Real relviolbounds)
Definition: sol.c:3915
void SCIPsolGetValExact(SCIP_RATIONAL *res, SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:2039
int SCIPsolGetPrimalIndex(SCIP_SOL *sol)
Definition: sol.c:4269
SCIP_RETCODE SCIPsolCreateNLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp, SCIP_HEUR *heur)
Definition: sol.c:893
SCIP_RETCODE SCIPsolMakeExact(SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
Definition: sol.c:2870
SCIP_RETCODE SCIPsolLinkCurrentSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:1368
SCIP_RETCODE SCIPsolCheck(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
Definition: sol.c:2669
SCIP_RETCODE SCIPsolMarkPartial(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR **vars, int nvars)
Definition: sol.c:2312
void SCIPsolRecomputeInternObjExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
Definition: sol.c:3256
SCIP_RETCODE SCIPsolCreateOriginal(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:514
SCIP_RETCODE SCIPsolSetValExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_RATIONAL *val)
Definition: sol.c:1711
SCIP_RETCODE SCIPsolAdjustImplicitSolVals(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool uselprows)
Definition: sol.c:712
SCIP_RETCODE SCIPsolFree(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_PRIMAL *primal)
Definition: sol.c:1133
SCIP_RETCODE SCIPsolRetransformExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
Definition: sol.c:3103
void SCIPsolRecomputeObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob)
Definition: sol.c:3221
SCIP_RETCODE SCIPsolOverwriteFPSolWithExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree)
Definition: sol.c:4037
void SCIPsolUpdateIntegralityViolation(SCIP_SOL *sol, SCIP_Real absviolintegrality)
Definition: sol.c:3904
void SCIPsolUpdateLPRowViolation(SCIP_SOL *sol, SCIP_Real absviollprows, SCIP_Real relviollprows)
Definition: sol.c:3928
SCIP_RETCODE SCIPsolLinkLPSolExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_LPEXACT *lp)
Definition: sol.c:1214
SCIP_RETCODE SCIPsolIncVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real incval)
Definition: sol.c:1832
SCIP_RETCODE SCIPsolLinkNLPSol(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_NLP *nlp)
Definition: sol.c:1237
SCIP_RETCODE SCIPsolPrintExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool mipstart, SCIP_Bool printzeros)
Definition: sol.c:3577
SCIP_RETCODE SCIPsolRetransform(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
Definition: sol.c:2970
SCIP_RETCODE SCIPsolCreatePseudoSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
Definition: sol.c:965
SCIP_RETCODE SCIPsolCreateCurrentSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:985
SCIP_RETCODE SCIPsolRound(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool *success)
Definition: sol.c:2797
SCIP_RETCODE SCIPsolTransform(SCIP_SOL *sol, SCIP_SOL **transsol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal)
Definition: sol.c:658
SCIP_RETCODE SCIPsolSetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real val)
Definition: sol.c:1490
SCIP_RETCODE SCIPvalsExactCopy(SCIP_VALSEXACT **valsexact, BMS_BLKMEM *blkmem, SCIP_VALSEXACT *sourcevals)
Definition: sol.c:497
SCIP_RETCODE SCIPsolCreatePseudoSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:940
SCIP_RETCODE SCIPsolClear(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
Definition: sol.c:1394
SCIP_RETCODE SCIPsolCreateLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
Definition: sol.c:846
SCIP_RETCODE SCIPsolSetUnknown(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
Definition: sol.c:1414
SCIP_RETCODE SCIPsolLinkRelaxSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_RELAXATION *relaxation)
Definition: sol.c:1288
SCIP_RETCODE SCIPsolCreateOriginalExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:555
SCIP_Real SCIPsolGetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:1908
SCIP_RETCODE SCIPsolLinkPseudoSolExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_LPEXACT *lp)
Definition: sol.c:1347
SCIP_RETCODE SCIPsolCreateExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:470
SCIP_RETCODE SCIPsolCreateCurrentSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
Definition: sol.c:1012
SCIP_RETCODE SCIPsolUnlink(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *prob)
Definition: sol.c:1431
void SCIPsolGetObjExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_RATIONAL *objval)
Definition: sol.c:2274
SCIP_Real SCIPsolGetRayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
Definition: sol.c:2188
SCIP_RETCODE SCIPsolPrintRay(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool printzeros)
Definition: sol.c:3766
void SCIPsolResetViolations(SCIP_SOL *sol)
Definition: sol.c:3888
void SCIPsolSetOrigin(SCIP_SOL *sol, SCIP_SOLORIGIN origin)
Definition: sol.c:3874
SCIP_RETCODE SCIPsolLinkLPSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
Definition: sol.c:1156
SCIP_Bool SCIPsolsAreEqual(SCIP_SOL *sol1, SCIP_SOL *sol2, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob)
Definition: sol.c:3370
SCIP_RATIONAL * SCIPsolGetOrigObjExact(SCIP_SOL *sol)
Definition: sol.c:4181
SCIP_Real SCIPsolGetObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
Definition: sol.c:2257
SCIP_RETCODE SCIPsolPrint(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool mipstart, SCIP_Bool printzeros)
Definition: sol.c:3441
void SCIPsolUpdateVarsum(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real weight)
Definition: sol.c:2942
SCIP_RETCODE SCIPsolCopy(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_SOL *sourcesol)
Definition: sol.c:583
SCIP_RETCODE SCIPsolCheckOrig(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool checkmodifiable, SCIP_Bool *feasible)
Definition: sol.c:2502
SCIP_RETCODE SCIPsolCreate(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
Definition: sol.c:428
SCIP_RETCODE SCIPsolCreateLPSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
Definition: sol.c:871
void SCIPsolUpdateLPConsViolation(SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
Definition: sol.c:3954
SCIP_RETCODE SCIPsolUnlinkExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *prob)
Definition: sol.c:1460
void SCIPsolOrigAddObjval(SCIP_SOL *sol, SCIP_Real addval)
Definition: sol.c:4193
Definition: heur_padm.c:135
type definitions for primal heuristics
type definitions for LP management
type definitions for exact LP management
type definitions for NLP management
type definitions for collecting primal CIP solutions and primal informations
type definitions for storing and manipulating the main problem
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for global SCIP settings
type definitions for storing primal CIP solutions
enum SCIP_SolOrigin SCIP_SOLORIGIN
Definition: type_sol.h:55
type definitions for problem statistics
type definitions for branch and bound tree
type definitions for problem variables