| 1 |
/*===========================================================================*/ |
| 2 |
/* */ |
| 3 |
/* This file is part of a demonstration application for use with the */ |
| 4 |
/* SYMPHONY Branch, Cut, and Price Library. This application is a solver for */ |
| 5 |
/* the Set Partitioning Problem. */ |
| 6 |
/* */ |
| 7 |
/* (c) Copyright 2005-2007 Marta Eso and Ted Ralphs. All Rights Reserved. */ |
| 8 |
/* */ |
| 9 |
/* This application was originally developed by Marta Eso and was modified */ |
| 10 |
/* Ted Ralphs ([email protected]) */ |
| 11 |
/* */ |
| 12 |
/* This software is licensed under the Eclipse Public License. Please see */ |
| 13 |
/* accompanying file for terms. */ |
| 14 |
/* */ |
| 15 |
/*===========================================================================*/ |
| 16 |
|
| 17 |
/* system include files */ |
| 18 |
#include <stdio.h> |
| 19 |
|
| 20 |
/* SYMPHONY include files */ |
| 21 |
#include "sym_constants.h" |
| 22 |
#include "sym_cp_u.h" |
| 23 |
|
| 24 |
/* SPP include files */ |
| 25 |
#include "spp.h" |
| 26 |
|
| 27 |
/*===========================================================================*/ |
| 28 |
|
| 29 |
/*===========================================================================*\ |
| 30 |
* This file contains the user-written functions of the cut pool process. |
| 31 |
\*===========================================================================*/ |
| 32 |
|
| 33 |
/*===========================================================================*\ |
| 34 |
* Here is where the user must receive all of the data sent from |
| 35 |
* user_send_cp_data() and set up data structures. Note that this function is |
| 36 |
* only called if one of COMPILE_IN_CP, COMPILE_IN_LP, or COMPILE_IN_TM is |
| 37 |
* FALSE. For sequential computation, nothing is needed here. |
| 38 |
\*===========================================================================*/ |
| 39 |
|
| 40 |
int user_receive_cp_data(void **user) |
| 41 |
{ |
| 42 |
return(USER_DEFAULT); |
| 43 |
} |
| 44 |
|
| 45 |
/*===========================================================================*/ |
| 46 |
|
| 47 |
/*===========================================================================*\ |
| 48 |
* If the user wants to fill in a customized routine for sending and receiving |
| 49 |
* the LP solution, it can be done here. For most cases, the default routines |
| 50 |
* are fine. |
| 51 |
\*===========================================================================*/ |
| 52 |
|
| 53 |
int user_receive_lp_solution_cp(void *user) |
| 54 |
{ |
| 55 |
return(USER_DEFAULT); |
| 56 |
} |
| 57 |
|
| 58 |
/*===========================================================================*/ |
| 59 |
|
| 60 |
/*===========================================================================*\ |
| 61 |
* When a new solution arrives to the cut pool, this function is invoked |
| 62 |
* so that the user can prepare for checking many cuts (probably set up |
| 63 |
* some data structures that make ckecking more efficient). |
| 64 |
\*===========================================================================*/ |
| 65 |
|
| 66 |
int user_prepare_to_check_cuts(void *user, int varnum, int *indices, |
| 67 |
double *values) |
| 68 |
{ |
| 69 |
return(USER_DEFAULT); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
/*===========================================================================*/ |
| 74 |
|
| 75 |
/*===========================================================================*\ |
| 76 |
* Check to see whether a particular cut is violated by the current LP sol. |
| 77 |
\*===========================================================================*/ |
| 78 |
|
| 79 |
int user_check_cut(void *user, double etol, int number, int *indices, |
| 80 |
double *values, cut_data *cut, int *is_violated, |
| 81 |
double *quality) |
| 82 |
{ |
| 83 |
return(USER_DEFAULT); |
| 84 |
} |
| 85 |
|
| 86 |
/*===========================================================================*/ |
| 87 |
|
| 88 |
/*===========================================================================*\ |
| 89 |
* This function is invoked when all cuts that needed to be checked for |
| 90 |
* the current solution have been checked already. (Disassemble the |
| 91 |
* data structures built up in 'user_prepare_to_check_cuts'. |
| 92 |
\*===========================================================================*/ |
| 93 |
|
| 94 |
int user_finished_checking_cuts(void *user) |
| 95 |
{ |
| 96 |
return(USER_DEFAULT); |
| 97 |
} |
| 98 |
|
| 99 |
/*===========================================================================*/ |
| 100 |
|
| 101 |
/*===========================================================================*\ |
| 102 |
* Here, we free up the data structures. If the default setup is used with |
| 103 |
* sequential computation, nothing needs to be filled in here. |
| 104 |
\*===========================================================================*/ |
| 105 |
|
| 106 |
int user_free_cp(void **user) |
| 107 |
{ |
| 108 |
return(USER_DEFAULT); |
| 109 |
} |
| 110 |
|
| 111 |
/*===========================================================================*/ |
| 112 |
|