Scippy

SCIP

Solving Constraint Integer Programs

heur_subnlp.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-2017 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 heur_subnlp.h
17  * @ingroup PRIMALHEURISTICS
18  * @brief NLP local search primal heuristic using sub-SCIPs
19  * @author Stefan Vigerske
20  *
21  * This heuristic applies a NLP local search to a nonlinear CIP after fixing all discrete variables.
22  * That is, the CIP is copied, all discrete variables are fixed, presolving is applied,
23  * and if the resulting CIP has a nonlinear relaxation, then it is tried to solve this relaxation
24  * by an NLP solver.
25  * The heuristic only runs if continuous nonlinearities are present (@ref SCIPhasNLPContinuousNonlinearity()).
26  *
27  * Fixing values for discrete values are either taken from a solution of the LP relaxation which
28  * satisfies all integrality constraints, or are provided by SCIPupdateStartpointHeurSubNlp().
29  *
30  * This heuristic is orthogonal to the undercover heuristic (@ref heur_undercover.h), which fixes
31  * variables in a nonlinear CIP in a way that a (possibly mixed-integer) linear subproblem is obtained.
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef HEUR_SUBNLP_H_
37 #define HEUR_SUBNLP_H_
38 
39 #include "scip/scip.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /** creates the NLP local search primal heuristic and includes it in SCIP
46  *
47  * @ingroup PrimalHeuristicIncludes
48  */
49 extern
51  SCIP* scip /**< SCIP data structure */
52  );
53 
54 /**@addtogroup PRIMALHEURISTICS
55  *
56  * @{
57  */
58 
59 /** updates the starting point for the NLP heuristic
60  *
61  * Is called, for example, by a constraint handler that handles nonlinear constraints when a check on feasibility of a solution fails.
62  */
63 extern
65  SCIP* scip, /**< SCIP data structure */
66  SCIP_HEUR* heur, /**< subNLP heuristic */
67  SCIP_SOL* solcand, /**< solution candidate */
68  SCIP_Real violation /**< constraint violation of solution candidate */
69  );
70 
71 /** main procedure of the subNLP heuristic */
72 extern
74  SCIP* scip, /**< original SCIP data structure */
75  SCIP_HEUR* heur, /**< heuristic data structure */
76  SCIP_RESULT* result, /**< pointer to store result of: solution found, no solution found, or fixing is infeasible (cutoff) */
77  SCIP_SOL* refpoint, /**< point to take fixation of discrete variables from, and startpoint for NLP solver; if NULL, then LP solution is used */
78  SCIP_Longint itercontingent, /**< iteration limit for NLP solver */
79  SCIP_Real timelimit, /**< time limit for NLP solver */
80  SCIP_Real minimprove, /**< desired minimal relative improvement in objective function value */
81  SCIP_Longint* iterused, /**< buffer to store number of iterations used by NLP solver, or NULL if not of interest */
82  SCIP_SOL* resultsol /**< a solution where to store found solution values, if any, or NULL if to try adding to SCIP */
83  );
84 
85 /** for a given solution, resolves the corresponding subNLP and updates solution values for continuous variables, if NLP solution is feasible in original problem */
86 extern
88  SCIP* scip, /**< original SCIP data structure */
89  SCIP_HEUR* heur, /**< heuristic data structure */
90  SCIP_SOL* sol, /**< solution for which to solve NLP, and where to store resolved solution values */
91  SCIP_Bool* success, /**< buffer where to store whether a feasible solution was found */
92  SCIP_Longint itercontingent, /**< iteration limit for NLP solver, or -1 for default of NLP heuristic */
93  SCIP_Real timelimit /**< time limit for NLP solver */
94  );
95 
96 /** adds all known linear constraint to the NLP, if initialized and not done already
97  * This function is temporary and will hopefully become obsolete in the near future.
98  */
99 extern
101  SCIP* scip, /**< original SCIP data structure */
102  SCIP_HEUR* heur, /**< heuristic data structure */
103  SCIP_Bool addcombconss, /**< whether to add combinatorial linear constraints, i.e., linear constraints that involve only discrete variables */
104  SCIP_Bool addcontconss /**< whether to add continuous linear constraints, i.e., linear constraints that involve not only discrete variables */
105  );
106 
107 /** gets sub-SCIP used by NLP heuristic, or NULL if none */
108 extern
110  SCIP* scip, /**< original SCIP data structure */
111  SCIP_HEUR* heur /**< heuristic data structure */
112  );
113 
114 /** gets mapping of SCIP variables to sub-SCIP variables */
115 extern
117  SCIP* scip, /**< original SCIP data structure */
118  SCIP_HEUR* heur /**< heuristic data structure */
119  );
120 
121 /** gets mapping of sub-SCIP variables to SCIP variables */
122 extern
124  SCIP* scip, /**< original SCIP data structure */
125  SCIP_HEUR* heur /**< heuristic data structure */
126  );
127 
128 /** gets startpoint candidate to be used in next call to NLP heuristic, or NULL if none */
129 extern
131  SCIP* scip, /**< original SCIP data structure */
132  SCIP_HEUR* heur /**< heuristic data structure */
133  );
134 
135 /* @} */
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /*HEUR_SUBNLP_H_*/
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_VAR ** SCIPgetVarMappingScip2SubScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
Definition: heur_subnlp.c:2489
SCIP_RETCODE SCIPincludeHeurSubNlp(SCIP *scip)
Definition: heur_subnlp.c:2290
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_SOL * SCIPgetStartCandidateHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
Definition: heur_subnlp.c:2523
SCIP_RETCODE SCIPaddLinearConsToNlpHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
Definition: heur_subnlp.c:2383
#define SCIP_Bool
Definition: def.h:61
SCIP_RETCODE SCIPresolveSolHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol, SCIP_Bool *success, SCIP_Longint itercontingent, SCIP_Real timelimit)
Definition: heur_subnlp.c:1864
SCIP_RETCODE SCIPapplyHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_SOL *refpoint, SCIP_Longint itercontingent, SCIP_Real timelimit, SCIP_Real minimprove, SCIP_Longint *iterused, SCIP_SOL *resultsol)
Definition: heur_subnlp.c:1669
SCIP_VAR ** SCIPgetVarMappingSubScip2ScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
Definition: heur_subnlp.c:2506
#define SCIP_Real
Definition: def.h:135
#define SCIP_Longint
Definition: def.h:120
SCIP_RETCODE SCIPupdateStartpointHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *solcand, SCIP_Real violation)
Definition: heur_subnlp.c:2417
SCIP * SCIPgetSubScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
Definition: heur_subnlp.c:2472
SCIP callable library.