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-2020 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 visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file struct_sol.h
17  * @ingroup INTERNALAPI
18  * @brief datastructures for storing primal CIP solutions
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 
25 #ifndef __SCIP_STRUCT_SOL_H__
26 #define __SCIP_STRUCT_SOL_H__
27 
28 
29 #include "scip/def.h"
30 #include "scip/type_misc.h"
31 #include "scip/type_sol.h"
32 #include "scip/type_heur.h"
33 #include "scip/type_relax.h"
34 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** maximum violations of problem constraints */
41 struct SCIP_Viol
42 {
43  SCIP_Real absviolbounds; /**< maximum absolute violation of variable bounds */
44  SCIP_Real relviolbounds; /**< maximum relative violation of variable bounds */
45  SCIP_Real absviollprows; /**< maximum absolute violation of LP rows */
46  SCIP_Real relviollprows; /**< maximum relative violation of LP rows */
47  SCIP_Real absviolintegrality; /**< maximum absolute violation integrality */
48  SCIP_Real absviolcons; /**< maximum absolute violation of constraints */
49  SCIP_Real relviolcons; /**< maximum relative violation of constraints */
50 };
51 
52 /** primal CIP solution
53  *
54  * For reasons of efficiency, a working solution only stores values that have been accessed at least once,
55  * or that have been changed from the value in the solution's source.
56  * The user has to call SCIPsolUnlink() in order to retrieve all non-cached elements from the solution's source
57  * and to store the values in the solution's own array. This changes the solution's origin to SCIP_SOLORIGIN_ZERO.
58  * A linked solution with origin SCIP_SOLORIGIN_LPSOL or SCIP_SOLORIGIN_PSEUDOSOL becomes invalid after the
59  * next node is focused (i.e. the LP and pseudo solutions changed) and cannot be accessed anymore.
60  *
61  * Solutions with origin ORIGINAL contain the values for original variables. The stored objective value also
62  * corresponds to the original problem.
63  */
64 struct SCIP_Sol
65 {
66  SCIP_Real obj; /**< objective value of solution */
67  SCIP_Real time; /**< clock time, when the solution was discovered */
68  SCIP_Longint nodenum; /**< last node number of current run, where this solution was modified */
69  SCIP_REALARRAY* vals; /**< solution values for variables */
70  SCIP_BOOLARRAY* valid; /**< is value in vals array valid? otherwise it has to be retrieved from
71  * origin */
72  union
73  {
74  SCIP_HEUR* heur; /**< heuristic that found the solution, if solution is of heuristic type */
75  SCIP_RELAX* relax; /**< relaxation handler that found the solution, if solution has relax type */
76  } creator;
77  SCIP_VIOL viol; /**< maximum violations of problem constraints */
78  int runnum; /**< branch and bound run number in which the solution was found */
79  int depth; /**< depth at which the solution was found */
80  int primalindex; /**< index of solution in array of existing solutions of primal data */
81  int index; /**< consecutively numbered unique index of all created solutions */
82  SCIP_SOLORIGIN solorigin; /**< origin of solution: where to retrieve uncached elements */
83  SCIP_Bool hasinfval; /**< does the solution (potentially) contain an infinite value? Note: this
84  * could also be implemented as a counter for the number of infinite
85  * values, to avoid redundant checks when resetting inf. solution values
86  */
87  SCIP_SOLTYPE type; /**< type of solution: heuristic or (LP) relaxation solution, or unspecified origin */
88 #ifndef NDEBUG
89  SCIP_Longint lpcount; /**< number of LPs solved when this solution was created, needed for debug checks
90  * concerning solutions linked to the LP solution
91  */
92 #endif
93 };
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif
type definitions for miscellaneous datastructures
SCIP_Real absviolbounds
Definition: struct_sol.h:43
int depth
Definition: struct_sol.h:79
SCIP_Longint nodenum
Definition: struct_sol.h:68
SCIP_SOLTYPE type
Definition: struct_sol.h:87
SCIP_HEUR * heur
Definition: struct_sol.h:74
SCIP_Real relviolcons
Definition: struct_sol.h:49
int runnum
Definition: struct_sol.h:78
type definitions for primal heuristics
SCIP_Real relviollprows
Definition: struct_sol.h:46
SCIP_Real absviollprows
Definition: struct_sol.h:45
SCIP_Longint lpcount
Definition: struct_sol.h:89
int primalindex
Definition: struct_sol.h:80
type definitions for relaxators
#define SCIP_Bool
Definition: def.h:70
SCIP_VIOL viol
Definition: struct_sol.h:77
type definitions for storing primal CIP solutions
SCIP_SOLORIGIN solorigin
Definition: struct_sol.h:82
SCIP_Real time
Definition: struct_sol.h:67
#define SCIP_Real
Definition: def.h:163
enum SCIP_SolType SCIP_SOLTYPE
Definition: type_sol.h:62
enum SCIP_SolOrigin SCIP_SOLORIGIN
Definition: type_sol.h:46
SCIP_REALARRAY * vals
Definition: struct_sol.h:69
#define SCIP_Longint
Definition: def.h:148
SCIP_Real relviolbounds
Definition: struct_sol.h:44
SCIP_BOOLARRAY * valid
Definition: struct_sol.h:70
SCIP_RELAX * relax
Definition: struct_sol.h:75
SCIP_Real absviolintegrality
Definition: struct_sol.h:47
common defines and data types used in all packages of SCIP
SCIP_Real absviolcons
Definition: struct_sol.h:48
SCIP_Bool hasinfval
Definition: struct_sol.h:83
SCIP_Real obj
Definition: struct_sol.h:66
int index
Definition: struct_sol.h:81