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