00001 /* 00002 Copyright (c) 2005, Quentin Lequy and Romain Gaucher 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or 00006 without modification, are permitted provided that the following 00007 conditions are met: 00008 00009 * Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 * Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in the 00014 documentation and/or other materials provided with the distribution. 00015 00016 * Neither the name of Quentin Lequy or Romain Gaucher nor the names 00017 of its contributors may be used to endorse or promote products 00018 derived from this software without specific prior written permission. 00019 00020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00024 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00025 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00026 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00027 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 #ifndef __SOLVER_H 00032 #define __SOLVER_H 00033 00034 #include "System.h" 00035 #include "Utils.h" 00036 #include "Solution.h" 00037 00038 #include <vector> 00039 #include <string> 00040 00041 namespace Modelib { 00042 00046 class Solver 00047 { 00048 protected: 00049 std::vector<std::string> options; 00050 std::string nomSolver; 00051 00052 std::string typeRetour; // Affichage des informations 00053 std::string typeOperation; // Maximisation ou minimisation 00054 00055 // Quelques informations sur le problemes 00056 bool isSolved; 00057 bool isOptimal; 00058 bool isMIP; 00059 00060 public: 00062 Solver() {} 00063 00064 virtual ~Solver(); 00065 00066 virtual float Solve(Solution&, const std::string& nameFile) = 0; 00067 00071 inline void AddOption(const std::string& opt) { 00072 options.push_back(opt); 00073 } 00074 00076 void RemoveOption(const std::string& opt); 00077 00078 inline bool Solved () const {return isSolved;} 00079 inline bool Optimal() const {return isOptimal;} 00080 00085 inline void Infos(std::string& op, std::string& info) 00086 { 00087 op = typeOperation; 00088 info = typeRetour; 00089 } 00090 00092 inline void SetMIP(bool b) {isMIP = b;} 00093 00094 }; 00095 00096 } 00097 00098 #endif