PenaltyFunction.h

00001 #ifndef _PenaltyFunction_h
00002 #define _PenaltyFunction_h
00003 
00004 
00005 // SYSTEM INCLUDES
00006 //
00007 
00008 // PROJECT INCLUDES
00009 //
00010 
00011 // LOCAL INCLUDES
00012 //
00013 #include "Constraint.h"
00014 #include "DoubleParameter.h"
00015 #include "FunctionBase.h"
00016 #include "FunctionDecorator.h"
00017 
00018 // FORWARD REFERENCES
00019 //
00020 class ProblemWithPenalty;
00021 
00024 typedef unsigned    FunctionIdType;
00025 
00026 
00035 class PenaltyFunction
00036     : public FunctionBase, public FunctionDecorator
00037 {
00038     //TODO: Usunąć
00039 //    friend class ProblemWithPenalty;
00040 
00041 public:
00042 // LIFECYCLE
00043 //
00044 
00045     enum OutOfBoundsReactionType
00046     {
00047         EXCEPTION = 0,  
00048         MAX_VALUE   
00049     };
00050 
00053     PenaltyFunction(void);
00054 
00060     PenaltyFunction(CountedPtr<const FunctionBase> cpFunction);
00061 
00062 
00065     ~PenaltyFunction(void);
00066 
00067 
00068 // OPERATORS
00069 
00070 // OPERATIONS
00071 
00077     void                ModifyPenalty();
00078 
00084     void                ResetPenalty();
00085 
00086 // ACCESS
00087 
00094     void                AddConstraint(const Constraint& constraint);
00095 
00098     const Constraint::Container&    Constraints() const;
00099 
00100     // TODO: a może jednak zadeklarować ProblemWithPenaltyPanel jako friend?
00105     Constraint::Container&          rConstraints();
00106 
00107     virtual unsigned                EvaluationCount() const;
00108 
00109     virtual void                    SetProblem(const ProblemBase* pProblem) const;
00110 
00113     wxString                        ConstraintsToString() const;
00114 
00127     OutOfBoundsReactionType&        rOutOfBoundsReaction();
00128 
00129     double                          PenaltyParam() const;
00130 
00131     double&                         rPenaltyParam() const;
00132 
00133     OutOfBoundsReactionType         OutOfBoundsReaction() const;
00134 
00135     virtual VariableNames           PresentVariables() const;
00136 
00137     static FunctionIdType           ClassId();
00138 
00141     virtual FunctionIdType          Id() const = 0;
00142 
00143 // INQUIRY
00144 
00153     virtual bool    IsValid(const ColumnVector& point) const = 0;
00154 
00155     virtual bool    IsValidStartingPoint(const ColumnVector& point) const = 0;
00156 
00157     virtual bool    ContainsUnknown(const VariableNames& variables) const;
00158 
00159     virtual int     FunctionId() const = 0;
00160 
00161 protected:
00162     PenaltyFunction(const PenaltyFunction& from);
00163 
00166     DoubleParameter         mInitialPenaltyParam;
00169     DoubleParameter         mPenaltyParamMultiplier;
00172     DoubleParameter         mTolerance;
00175     OutOfBoundsReactionType mOutOfBoundsReaction;
00176 
00177     Constraint::Container   mConstraints;   
00178 
00179     static FunctionIdType   GenerateId();
00180 
00181 private:
00182 
00183     mutable double          mPenaltyParam;  
00184 
00185 };
00186 
00187 // INLINE METHODS
00188 //
00189 
00190 // EXTERNAL REFERENCES
00191 //
00192 
00193 #endif  // _PenaltyFunction_h_

Wygenerowano Fri Sep 29 21:04:48 2006 dla EduOptim2 programem  doxygen 1.4.6