Scippy

SCIP

Solving Constraint Integer Programs

benders.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-2019 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 scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file MinIISC/src/benders.h
17  * @brief run Benders algorithm
18  * @author Marc Pfetsch
19  *
20  * Run Benders algorithm using an oracle for solving the subproblems and solving the master problem to optimality.
21  */
22 
23 #ifndef __BENDERS_H__
24 #define __BENDERS_H__
25 
26 #include <scip/scip.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /** Benders subproblem oracle solving status */
34 {
35  BENDERS_STATUS_UNKNOWN = 0, /**< the solving status is not yet known */
36  BENDERS_STATUS_ADDEDCUT = 1, /**< a Benders cut has been added */
37  BENDERS_STATUS_SUCESS = 2, /**< the solution is optimal, no further Benders cut has to be generated */
38  BENDERS_STATUS_TIMELIMIT = 3, /**< the time limit has been reached */
39  BENDERS_STATUS_USERINTERRUPT = 4, /**< the user has interrupted the solution of the subproblem */
40  BENDERS_STATUS_ERROR = 5 /**< an error occured during the solution of the subproblem */
41 };
43 
44 typedef struct BENDERS_Data BENDERS_DATA; /**< user defined data to pass to the oracle */
45 
46 /** user callback method for a Benders subproblem oracle
47  * input:
48  * - masterscip: SCIP pointer of Benders master problem
49  * - nmastervars: number of variables in master problem
50  * - mastervars: variables in master problem
51  * - mastersolution: solution of Benders master problem
52  * - data: user data for oracle
53  * - timelimit: time limit for subproblem
54  * - ntotalcuts: total number of cuts
55  * output:
56  * - ncuts: number of cuts added
57  * - status: status
58  *
59  * The oracle should take the given solution and possibly add a Benders Cut to the master problem.
60  */
61 #define BENDERS_CUTORACLE(x) SCIP_RETCODE x (SCIP* masterscip, int nmastervars, SCIP_VAR** mastervars, SCIP_Real* mastersolution, BENDERS_DATA* data, SCIP_Real timelimit, SCIP_Longint ntotalcuts, int* ncuts, BENDERS_STATUS* status)
62 
63 
64 
65 /** run Benders algorithm using an oracle for the subproblems */
67  SCIP* masterscip, /**< master SCIP instance */
68  BENDERS_CUTORACLE((*Oracle)), /**< oracle for the Benders subproblem */
69  BENDERS_DATA* data, /**< user data for oracle */
70  SCIP_Real timelimit, /**< time limit read from arguments */
71  SCIP_Real memlimit, /**< memory limit read from arguments */
72  int dispfreq, /**< display frequency */
73  SCIP_Bool usereopt, /**< use reoptimization */
74  SCIP_Bool solvemasterapprox, /**< Solve master problem approximately? */
75  SCIP_Longint masterstallnodes, /**< stall nodes for master problem if solvemasterapprox is true */
76  SCIP_Real mastergaplimit, /**< gap limit for master problem if solvemasterapprox is true */
77  SCIP_VERBLEVEL verblevel, /**< verbosity level for output */
78  SCIP_STATUS* status /**< status of optimization */
79  );
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif
#define BENDERS_CUTORACLE(x)
Definition: benders.h:61
SCIP_RETCODE runBenders(SCIP *masterscip, BENDERS_CUTORACLE((*Oracle)), BENDERS_DATA *data, SCIP_Real timelimit, SCIP_Real memlimit, int dispfreq, SCIP_Bool usereopt, SCIP_Bool solvemasterapprox, SCIP_Longint masterstallnodes, SCIP_Real mastergaplimit, SCIP_VERBLEVEL verblevel, SCIP_STATUS *status)
Definition: benders.c:198
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
enum SCIP_VerbLevel SCIP_VERBLEVEL
Definition: type_message.h:48
BENDERS_Status
Definition: benders.h:33
#define SCIP_Bool
Definition: def.h:70
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:58
enum BENDERS_Status BENDERS_STATUS
Definition: benders.h:42
#define SCIP_Real
Definition: def.h:164
#define SCIP_Longint
Definition: def.h:149
SCIP callable library.