00001 /************************************************************************* 00002 * 00003 * The Contents of this file are made available subject to 00004 * the terms of GNU Lesser General Public License Version 2.1. 00005 * 00006 * 00007 * GNU Lesser General Public License Version 2.1 00008 * ============================================= 00009 * Copyright 2005 by Kohei Yoshida. 00010 * 1039 Kingsway Dr., Apex, NC 27502, USA 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License version 2.1, as published by the Free Software Foundation. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00024 * MA 02111-1307 USA 00025 * 00026 ************************************************************************/ 00027 00028 #ifndef _NUMERIC_OPRES_NLP_NLPMODEL_HXX_ 00029 #define _NUMERIC_OPRES_NLP_NLPMODEL_HXX_ 00030 00031 #include "numeric/type.hxx" 00032 #include <memory> 00033 #include <string> 00034 #include <vector> 00035 00036 namespace scsolver { namespace numeric { 00037 class BaseFuncObj; 00038 }} 00039 00040 namespace scsolver { namespace numeric { namespace nlp { 00041 00042 class ModelImpl; 00043 class BaseAlgorithm; 00044 00048 struct Constraint 00049 { 00050 BaseFuncObj* FuncObj; 00051 EqualityType Equality; 00052 double RightValue; 00053 00054 explicit Constraint(BaseFuncObj* pFunc, EqualityType eq, double rightValue); 00055 private: 00056 Constraint(); 00057 }; 00058 00059 // ============================================================================ 00060 00061 class Model 00062 { 00063 public: 00064 Model(); 00065 Model( const Model& ); 00066 ~Model() throw(); 00067 00071 void print() const; 00072 00078 void setPrecision(unsigned long n); 00079 00085 unsigned long getPrecision() const; 00086 00092 void setGoal(scsolver::numeric::GoalType goal); 00093 00099 scsolver::numeric::GoalType getGoal() const; 00100 00107 void setVerbose(bool b); 00108 00114 bool getVerbose() const; 00115 00125 void setFuncObject(BaseFuncObj* pFuncObj); 00126 00132 BaseFuncObj* getFuncObject() const; 00133 00140 void pushVar( double var ); 00141 00147 void getVars( ::std::vector<double>& vars ) const; 00148 00161 double getVarBound( size_t index, BoundType bound ) const; 00162 00173 void setVarBound( size_t index, BoundType bound, double value ); 00174 00185 bool isVarBounded( size_t index, BoundType bound ) const; 00186 00187 void pushConstraint(BaseFuncObj* pFunc, EqualityType eq, double rightValue); 00188 00189 const ::std::vector<Constraint>& getAllConstraints() const; 00190 00191 private: 00192 ::std::auto_ptr<ModelImpl> m_pImpl; 00193 }; 00194 00195 00196 }}} 00197 00198 00199 #endif
1.5.3