Debian Codegraph @

SYMPHONY/Applications/USER/src/CutGen/user_cg.c

raw
1 /*===========================================================================*/
2 /* */
3 /* This file is part of the SYMPHONY Branch, Cut, and Price Library. */
4 /* */
5 /* SYMPHONY was jointly developed by Ted Ralphs ([email protected]) and */
6 /* Laci Ladanyi ([email protected]). */
7 /* */
8 /* (c) Copyright 2000-2007 Ted Ralphs. All Rights Reserved. */
9 /* */
10 /* This software is licensed under the Eclipse Public License. Please see */
11 /* accompanying file for terms. */
12 /* */
13 /*===========================================================================*/
14
15 /* SYMPHONY include files */
16 #include "sym_constants.h"
17 #include "sym_macros.h"
18 #include "sym_cg_u.h"
19
20 /* User include files */
21 #include "user.h"
22
23 /*===========================================================================*/
24
25 /*===========================================================================*\
26 * This file contains user-written functions used by the cut generator
27 * process.
28 \*===========================================================================*/
29
30 /*===========================================================================*\
31 * Here is where the user must receive all of the data sent from
32 * user_send_cg_data() and set up data structures. Note that this function is
33 * only called if one of COMPILE_IN_CG, COMPILE_IN_LP, or COMPILE_IN_TM is
34 * FALSE. For sequential computation, nothing is needed here.
35 \*===========================================================================*/
36
37 int user_receive_cg_data(void **user, int dg_id)
38 {
39 return(USER_DEFAULT);
40 }
41
42 /*===========================================================================*/
43
44 /*===========================================================================*\
45 * If the user wants to fill in a customized routine for sending and receiving
46 * the LP solution, it can be done here. For most cases, the default routines
47 * are fine.
48 \*===========================================================================*/
49
50 int user_receive_lp_solution_cg(void *user)
51 {
52 return(USER_DEFAULT);
53 }
54
55 /*===========================================================================*/
56
57 /*===========================================================================*\
58 * Find cuts violated by a particular LP solution. This can be a fairly
59 * involved function but the bottom line is that an LP solution comes in
60 * and cuts go out. Remember, use the function cg_send_cut() to send cuts out
61 * when they are found.
62 \*===========================================================================*/
63
64 int user_find_cuts(void *user, int varnum, int iter_num, int level,
65 int index, double objval, int *indices, double *values,
66 double ub, double etol, int *num_cuts, int *alloc_cuts,
67 cut_data ***cuts)
68 {
69 user_problem *prob = (user_problem *) user;
70
71 /* Fill in cut generation here if desired */
72
73 return(USER_DEFAULT);
74 }
75
76 /*===========================================================================*/
77
78 /*===========================================================================*\
79 * Free the user data structure. If the default setup is used with sequential
80 * computation, nothing needs to be filled in here.
81 \*===========================================================================*/
82
83 int user_free_cg(void **user)
84 {
85 return(USER_DEFAULT);
86 }
87
88 /*===========================================================================*/
89
90 /*===========================================================================*\
91 * This is an undocumented (for now) debugging feature which can allow the user
92 * to identify the cut which cuts off a particular known feasible solution.
93 \*===========================================================================*/
94
95 #ifdef CHECK_CUT_VALIDITY
96 int user_check_validity_of_cut(void *user, cut_data *new_cut)
97 {
98 return(USER_DEFAULT);
99 }
100 #endif