| 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_lp_u.h" |
| 19 |
|
| 20 |
/*===========================================================================*/ |
| 21 |
|
| 22 |
/*===========================================================================*\ |
| 23 |
* This file contains the user-written functions for the LP process related |
| 24 |
* to branching. |
| 25 |
\*===========================================================================*/ |
| 26 |
|
| 27 |
/*===========================================================================*\ |
| 28 |
* This function determines whether to branch. You can essentially |
| 29 |
* leave this up to SYMPHONY unless there is some compelling reason not to. |
| 30 |
\*===========================================================================*/ |
| 31 |
|
| 32 |
int user_shall_we_branch(void *user, double lpetol, int cutnum, |
| 33 |
int slacks_in_matrix_num, cut_data **slacks_im_matrix, |
| 34 |
int slack_cut_num, cut_data **slack_cuts, int varnum, |
| 35 |
var_desc **vars, double *x, char *status, |
| 36 |
int *cand_num, branch_obj ***candidates, |
| 37 |
int *action) |
| 38 |
{ |
| 39 |
return(USER_DEFAULT); |
| 40 |
} |
| 41 |
|
| 42 |
/*===========================================================================*/ |
| 43 |
|
| 44 |
/*===========================================================================*\ |
| 45 |
* Here, we select the branching candidates. This can essentially be |
| 46 |
* left to SYMPHONY too using one of the built-in functions, but here, I |
| 47 |
* demonstrate how to branch on cuts, which must be done by the user. |
| 48 |
\*===========================================================================*/ |
| 49 |
|
| 50 |
int user_select_candidates(void *user, double lpetol, int cutnum, |
| 51 |
int slacks_in_matrix_num, |
| 52 |
cut_data **slacks_in_matrix, int slack_cut_num, |
| 53 |
cut_data **slack_cuts, int varnum, var_desc **vars, |
| 54 |
double *x, char *status, int *cand_num, |
| 55 |
branch_obj ***candidates, int *action, |
| 56 |
int bc_level) |
| 57 |
|
| 58 |
{ |
| 59 |
return(USER_DEFAULT); |
| 60 |
} |
| 61 |
|
| 62 |
/*===========================================================================*/ |
| 63 |
|
| 64 |
int user_compare_candidates(void *user, branch_obj *can1, branch_obj *can2, |
| 65 |
double ub, double granularity, |
| 66 |
int *which_is_better) |
| 67 |
{ |
| 68 |
return(USER_DEFAULT); |
| 69 |
} |
| 70 |
|
| 71 |
/*===========================================================================*/ |
| 72 |
|
| 73 |
/*===========================================================================*\ |
| 74 |
* You can let SYMPHONY choose which child to retain. The default is |
| 75 |
* to keep the one with the lower objective function value. |
| 76 |
\*===========================================================================*/ |
| 77 |
|
| 78 |
int user_select_child(void *user, double ub, branch_obj *can, char *action) |
| 79 |
{ |
| 80 |
return(USER_DEFAULT); |
| 81 |
} |
| 82 |
|
| 83 |
/*===========================================================================*/ |
| 84 |
|
| 85 |
/*===========================================================================*\ |
| 86 |
* Here, you can print out a more identifiable description of the |
| 87 |
* branching object than just "variable 51". |
| 88 |
\*===========================================================================*/ |
| 89 |
|
| 90 |
int user_print_branch_stat(void *user, branch_obj *can, cut_data *cut, |
| 91 |
int n, var_desc **vars, char *action) |
| 92 |
{ |
| 93 |
return(USER_DEFAULT); |
| 94 |
} |