1 // ******************** FlopCpp ********************************************** 2 // File: flopc.hpp 3 // $Id$ 4 // Author: Tim Helge Hultberg (thh@mat.ua.pt) 5 // Copyright (C) 2003 Tim Helge Hultberg 6 // All Rights Reserved. 7 // **************************************************************************** 8 9 #ifndef _flopc_hpp_ 10 #define _flopc_hpp_ 11 12 #include "MP_variable.hpp" 13 #include "MP_set.hpp" 14 #include "MP_index.hpp" 15 #include "MP_constant.hpp" 16 #include "MP_data.hpp" 17 #include "MP_constraint.hpp" 18 #include "MP_expression.hpp" 19 #include "MP_boolean.hpp" 20 #include "MP_model.hpp" 21 22 /** @defgroup PublicInterface Public interface 23 @brief Classes in this group are for normal modeling purposes. 24 They are intended for consumption outside the library. 25 */ 26 /** @defgroup INTERNAL_USE Internal (private) interface. 27 @brief Classes in this group are used for internal purposes. 28 They are not intended for consumption outside the library. 29 */ 30 /** @brief All flopc++ code is contained within the flopc namespace. 31 32 Flopc++ is an open source algebraic modelling language implemented as 33 a C++ class library. It uses the common COIN-OR OsiSolverInterface 34 abstract interface to allow for easy integration with many of today's top 35 Math Programming solvers. 36 <ul> The main 3 components are listed below. Much of the rest of 37 the code is to facilitate the operator overloading makes this such 38 a powerful modeling environment. 39 @li Linear Variables MP_variable 40 @li Linear Set MP_set 41 @li Linear Index MP_index 42 @li Linear Constraints MP_constraint 43 </ul> 44 <br> 45 @note The classes in @group PublicInterface are intended for consumption 46 outside the library. 47 48 */ 49 namespace flopc { 50 51 /** @brief Global function for performing a Functor on each member of a 52 MP_domain 53 @ingroup PublicInterface 54 */ forall(const MP_domain & d,const Functor & f)55 inline void forall(const MP_domain& d, const Functor& f) { 56 d.Forall(&f); 57 } 58 59 /** @brief Global function for performing a Functor without having a set 60 to operate on. 61 @ingroup PublicInterface 62 @todo This turns into a no-op? 63 */ forall(const Functor & f)64 inline void forall(const Functor& f) { 65 forall(MP_domain::getEmpty(), f); 66 } 67 68 /** @brief Global function which copies members of MP_domain d into 69 another (possibly non-empty) MP_domain 70 @ingroup PublicInterface 71 */ operator <<=(const MP_domain & s,const MP_domain & d)72 inline void operator<<=(const MP_domain& s, const MP_domain& d) { 73 d.Forall( s->makeInsertFunctor()); 74 } 75 76 /** @brief This is one of the main entry points for execution 77 @ingroup PublicInterface 78 This calls the OsiSolverInterface to execute the solver with the 79 objective of MINIMIZING the argment MP_expression. 80 @li Assumes that the OsiSolverInterface is already set 81 @li Assumes a model is already loaded (and is the default model) 82 */ minimize(const MP_expression & obj)83 inline void minimize(const MP_expression &obj) { 84 MP_model::getDefaultModel().minimize(obj); 85 } 86 87 /** @brief This is one of the main entry points for execution 88 @ingroup PublicInterface 89 This calls the OsiSolverInterface to execute the solver with the 90 objective of MINIMIZING THE MAXIMUM of the MP_expression evaluation 91 of the MP_set 92 @todo true? 93 @li Assumes that the OsiSolverInterface is already set 94 @li Assumes a model is already loaded (and is the default model) 95 */ minimize_max(MP_set & d,const MP_expression & obj)96 inline void minimize_max(MP_set& d, const MP_expression &obj) { 97 MP_model::getDefaultModel().minimize_max(d,obj); 98 } 99 100 /** @brief This is one of the main entry points for execution 101 @ingroup PublicInterface 102 This calls the OsiSolverInterface to execute the solver with the 103 objective of MAXIMIZING of the MP_expression 104 @li Assumes that the OsiSolverInterface is already set 105 @li Assumes a model is already loaded (and is the default model) 106 */ maximize(const MP_expression & obj)107 inline void maximize(const MP_expression &obj) { 108 MP_model::getDefaultModel().maximize(obj); 109 } 110 111 } // End of namespace flopc 112 #endif 113