Scippy

SCIP

Solving Constraint Integer Programs

struct_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-2014 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file struct_sol.h
17  * @brief datastructures for storing primal CIP solutions
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 
24 #ifndef __SCIP_STRUCT_SOL_H__
25 #define __SCIP_STRUCT_SOL_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_misc.h"
30 #include "scip/type_sol.h"
31 #include "scip/type_heur.h"
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /** primal CIP solution
39  *
40  * For reasons of efficiency, a working solution only stores values that have been accessed at least once,
41  * or that have been changed from the value in the solution's source.
42  * The user has to call SCIPsolUnlink() in order to retrieve all non-cached elements from the solution's source
43  * and to store the values in the solution's own array. This changes the solution's origin to SCIP_SOLORIGIN_ZERO.
44  * A linked solution with origin SCIP_SOLORIGIN_LPSOL or SCIP_SOLORIGIN_PSEUDOSOL becomes invalid after the
45  * next node is focused (i.e. the LP and pseudo solutions changed) and cannot be accessed anymore.
46  *
47  * Solutions with origin ORIGINAL contain the values for original variables. The stored objective value also
48  * corresponds to the original problem.
49  */
50 struct SCIP_Sol
51 {
52  SCIP_Real obj; /**< objective value of solution */
53  SCIP_Real time; /**< clock time, when the solution was discovered */
54  SCIP_Longint nodenum; /**< last node number of current run, where this solution was modified */
55  SCIP_REALARRAY* vals; /**< solution values for variables */
56  SCIP_BOOLARRAY* valid; /**< is value in vals array valid? otherwise it has to be retrieved from
57  * origin */
58  SCIP_HEUR* heur; /**< heuristic that found the solution (or NULL if it's an LP solution) */
59  int runnum; /**< branch and bound run number in which the solution was found */
60  int depth; /**< depth at which the solution was found */
61  int primalindex; /**< index of solution in array of existing solutions of primal data */
62  int index; /**< consecutively numbered unique index of all created solutions */
63  SCIP_SOLORIGIN solorigin; /**< origin of solution: where to retrieve uncached elements */
64  SCIP_Bool hasinfval; /**< does the solution (potentially) contain an infinite value? Note: this
65  * could also be implemented as a counter for the number of infinite
66  * values, to avoid redundant checks when resetting inf. solution values
67  */
68 };
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif
75