/*===========================================================================*/ /* */ /* This file is part of the SYMPHONY Branch, Cut, and Price Library. */ /* */ /* SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and */ /* Laci Ladanyi (ladanyi@us.ibm.com). */ /* */ /* (c) Copyright 2000-2007 Ted Ralphs. All Rights Reserved. */ /* */ /* This software is licensed under the Eclipse Public License. Please see */ /* accompanying file for terms. */ /* */ /*===========================================================================*/ /*===========================================================================*/ #define CALL_FUNCTION(f) \ if ((termcode = f) < 0){ \ printf("Error detected: termcode = %i\n", termcode); \ printf("Exiting...\n\n"); \ exit(termcode); \ } /*===========================================================================*\ This file contains the main() for the master process. Note that, if you want to use the OSI SYMPHONY interface, you should set the USE_OSI_INTERFACE flag and define the COINROOT path in the SYMPHONY Makefile. Otherwise, the C callable library functions will be used by default. See below for the usage. \*===========================================================================*/ #if defined(USE_OSI_INTERFACE) #include "OsiSymSolverInterface.hpp" int main(int argc, char **argv) { OsiSymSolverInterface si; /* Parse the command line */ si.parseCommandLine(argc, argv); /* Read in the problem */ si.loadProblem(); /* Find a priori problem bounds */ si.findInitialBounds(); /* Solve the problem */ si.branchAndBound(); return(0); } #else #include "symphony.h" #include "sym_master.h" #include int main(int argc, char **argv) { int termcode; sym_environment *env = sym_open_environment(); sym_version(); if (!env){ printf("Error initializing environement\n"); exit(0); } CALL_FUNCTION( sym_parse_command_line(env, argc, argv) ); CALL_FUNCTION( sym_load_problem(env) ); CALL_FUNCTION( sym_find_initial_bounds(env) ); CALL_FUNCTION( sym_solve(env) ); CALL_FUNCTION( sym_close_environment(env) ); return(0); } #endif