BWAPI
|
00001 // Copyright (c) 1997-2007 ETH Zurich (Switzerland). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under 00005 // the terms of the Q Public License version 1.0. 00006 // See the file LICENSE.QPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // $URL: svn+ssh://gaertner@scm.gforge.inria.fr/svn/cgal/trunk/QP_solver/include/CGAL/QP_options.h $ 00015 // $Id: QP_options.h 38125 2007-04-14 15:39:55Z gaertner $ 00016 // 00017 // 00018 // Author(s) : Bernd Gaertner <gaertner@inf.ethz.ch> 00019 00020 #ifndef CGAL_QP_OPTIONS_H 00021 #define CGAL_QP_OPTIONS_H 00022 // this file defines a class for passing options to the linear and 00023 // quadratic programming solvers 00024 00025 #include<string> 00026 #include<CGAL/QP_solver/basic.h> 00027 00028 CGAL_BEGIN_NAMESPACE 00029 00030 enum Quadratic_program_pricing_strategy 00031 { 00032 QP_CHOOSE_DEFAULT, 00033 QP_DANTZIG, 00034 QP_FILTERED_DANTZIG, 00035 QP_PARTIAL_DANTZIG, 00036 QP_PARTIAL_FILTERED_DANTZIG, 00037 QP_BLAND 00038 }; 00039 00040 class Quadratic_program_options 00041 { 00042 public: 00043 // default constructor 00044 // ------------------- 00045 Quadratic_program_options () 00046 : verbosity_ (0), pricing_strategy_ (QP_CHOOSE_DEFAULT), 00047 validation_flag_ (false) 00048 {} 00049 00050 // set/get verbosity 00051 // ----------------- 00052 int get_verbosity () const 00053 { 00054 return verbosity_; 00055 } 00056 void set_verbosity (int verbosity) 00057 { 00058 CGAL_qpe_assertion ( 0 <= verbosity && verbosity <= 5); 00059 verbosity_ = verbosity; 00060 } 00061 00062 // set/get pricing strategy 00063 // ------------------------ 00064 Quadratic_program_pricing_strategy get_pricing_strategy() const 00065 { 00066 return pricing_strategy_; 00067 } 00068 00069 void set_pricing_strategy 00070 (Quadratic_program_pricing_strategy pricing_strategy) 00071 { 00072 pricing_strategy_ = pricing_strategy; 00073 } 00074 00075 // set/get validation flag 00076 // ----------------------- 00077 bool get_auto_validation() const 00078 { 00079 return validation_flag_; 00080 } 00081 00082 void set_auto_validation (bool validate) 00083 { 00084 validation_flag_ = validate; 00085 } 00086 00087 private: 00088 // verbosity 00089 // --------- 00090 // 0: silent 00091 // 1: short iteration summary (recommened for the user) 00092 // >= 2: output of internal details (not recommend for the user) 00093 int verbosity_; 00094 00095 // pricing_strategy 00096 // ---------------- 00097 Quadratic_program_pricing_strategy pricing_strategy_; 00098 00099 // validation 00100 // ---------- 00101 bool validation_flag_; 00102 }; 00103 00104 // output 00105 // ------ 00106 std::ostream& operator<< (std::ostream& o, 00107 const Quadratic_program_options& options) 00108 { 00109 o << " Verbosity: " << options.get_verbosity() << "\n"; 00110 o << " Pricing strategy: "; 00111 switch (options.get_pricing_strategy()) { 00112 case QP_CHOOSE_DEFAULT: 00113 o << "QP_CHOOSE_DEFAULT"; 00114 break; 00115 case QP_DANTZIG: 00116 o << "QP_DANTZIG"; 00117 break; 00118 case QP_FILTERED_DANTZIG: 00119 o << "QP_FILTERED_DANTZIG"; 00120 break; 00121 case QP_PARTIAL_DANTZIG: 00122 o << "QP_PARTIAL_FILTERED_DANTZIG"; 00123 break; 00124 case QP_PARTIAL_FILTERED_DANTZIG: 00125 o << "QP_PARTIAL_FILTERED_DANTZIG"; 00126 break; 00127 case QP_BLAND: 00128 o << "QP_BLAND"; 00129 } 00130 o << "\n"; 00131 o << " Auto-validation: " << options.get_auto_validation() << std::endl; 00132 return o; 00133 } 00134 00135 CGAL_END_NAMESPACE 00136 00137 #endif // CGAL_QP_OPTIONS_H