Debian Codegraph @

SYMPHONY/Applications/USER/src/Master/user_main.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
16 #define CALL_FUNCTION(f) \
17 if ((termcode = f) < 0){ \
18 printf("Error detected: termcode = %i\n", termcode); \
19 printf("Exiting...\n\n"); \
20 exit(termcode); \
21 }
22
23 /*===========================================================================*\
24 This file contains the main() for the master process.
25
26 Note that, if you want to use the OSI SYMPHONY interface, you should set the
27 USE_OSI_INTERFACE flag and define the COINROOT path in the SYMPHONY
28 Makefile. Otherwise, the C callable library functions will be used by
29 default. See below for the usage.
30 \*===========================================================================*/
31
32 #if defined(USE_OSI_INTERFACE)
33
34 #include "OsiSymSolverInterface.hpp"
35
36 int main(int argc, char **argv)
37 {
38 OsiSymSolverInterface si;
39
40 /* Parse the command line */
41 si.parseCommandLine(argc, argv);
42
43 /* Read in the problem */
44 si.loadProblem();
45
46 /* Find a priori problem bounds */
47 si.findInitialBounds();
48
49 /* Solve the problem */
50 si.branchAndBound();
51
52 return(0);
53 }
54
55 #else
56
57 #include "symphony.h"
58 #include "sym_master.h"
59 #include <stdlib.h>
60
61 int main(int argc, char **argv)
62 {
63
64 int termcode;
65 sym_environment *env = sym_open_environment();
66
67 sym_version();
68
69 if (!env){
70 printf("Error initializing environement\n");
71 exit(0);
72 }
73
74 CALL_FUNCTION( sym_parse_command_line(env, argc, argv) );
75
76 CALL_FUNCTION( sym_load_problem(env) );
77
78 CALL_FUNCTION( sym_find_initial_bounds(env) );
79
80 CALL_FUNCTION( sym_solve(env) );
81
82 CALL_FUNCTION( sym_close_environment(env) );
83
84 return(0);
85 }
86
87 #endif