AdkZhangMeritFunctionCheck.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 2001, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** Reliability module developed by:                                   **
00020 **   Terje Haukaas (haukaas@ce.berkeley.edu)                          **
00021 **   Armen Der Kiureghian (adk@ce.berkeley.edu)                       **
00022 **                                                                    **
00023 ** ****************************************************************** */
00024                                                                         
00025 // $Revision: 1.2 $
00026 // $Date: 2003/10/27 23:45:43 $
00027 // $Source: /usr/local/cvs/OpenSees/SRC/reliability/analysis/meritFunction/AdkZhangMeritFunctionCheck.cpp,v $
00028 
00029 
00030 //
00031 // Written by Terje Haukaas (haukaas@ce.berkeley.edu)
00032 //
00033 
00034 #include <AdkZhangMeritFunctionCheck.h>
00035 #include <MeritFunctionCheck.h>
00036 #include <math.h>
00037 #include <Vector.h>
00038 
00039 
00040 AdkZhangMeritFunctionCheck::AdkZhangMeritFunctionCheck(double pmulti, double padd, double pa)
00041 :MeritFunctionCheck()
00042 {
00043         multi = pmulti;
00044         add = padd;
00045         a = pa;
00046 }
00047 
00048 AdkZhangMeritFunctionCheck::~AdkZhangMeritFunctionCheck()
00049 {
00050 }
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 int
00059 AdkZhangMeritFunctionCheck::check(Vector u_old, 
00060                                                                   double g_old, 
00061                                                                   Vector grad_G_old, 
00062                                                                   double stepSize,
00063                                                                   Vector stepDirection,
00064                                                                   double g_new)
00065 {
00066 
00067         // Update penalty parameter 'c' (should remain constant along the search direction)
00068         this->updateMeritParameters(u_old,g_old,grad_G_old);
00069 
00070         
00071         // New point in standard normal space
00072         Vector u_new = u_old + stepSize*stepDirection;
00073 
00074 
00075         // Compute value of merit functions
00076         Vector dummy(1);
00077         double merit_old = this->getMeritFunctionValue(u_old,g_old,dummy);
00078         double merit_new = this->getMeritFunctionValue(u_new,g_new,dummy);
00079 
00080         
00081         // Gradient of the merit function
00082         double signumG;
00083         if (g_old != 0.0) {
00084                 signumG = g_old/fabs(g_old);
00085         }
00086         else {
00087                 signumG = 1.0;
00088         }
00089         Vector gradM_old = u_old + c * signumG * grad_G_old;
00090 
00091 
00092         // Do the check
00093         if (  (merit_new-merit_old)  <=  a*stepSize*(gradM_old^stepDirection)  ) {
00094                 return 0;  // ok
00095         }
00096         else {
00097                 return -1; // not ok
00098         }
00099         
00100 }
00101 
00102 
00103 
00104 
00105 
00106 int
00107 AdkZhangMeritFunctionCheck::updateMeritParameters(Vector u, 
00108                                                                                                   double g,
00109                                                                                                   Vector grad_G)
00110 {
00111         // Update penalty factor 'c'
00112         c = (u.Norm() / grad_G.Norm()) * multi + add;
00113 
00114         return 0;
00115 }
00116 
00117 
00118 double
00119 AdkZhangMeritFunctionCheck::getMeritFunctionValue(Vector u, 
00120                                                                                                   double g,
00121                                                                                                   Vector grad_G)
00122 {
00123         // Note that it is correct to keep 'c' constant
00124 
00125         // Compute merit function
00126         double merit = 0.5 * (u ^ u) + c * fabs(g);
00127 
00128 
00129         // Return the result
00130         return merit;
00131 }

Generated on Mon Oct 23 15:05:25 2006 for OpenSees by doxygen 1.5.0