GradientProjectionSearchDirection.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.1 $
00026 // $Date: 2003/03/04 00:39:03 $
00027 // $Source: /usr/local/cvs/OpenSees/SRC/reliability/analysis/direction/GradientProjectionSearchDirection.cpp,v $
00028 
00029 
00030 //
00031 // Written by Terje Haukaas (haukaas@ce.berkeley.edu)
00032 //
00033 
00034 #include <GradientProjectionSearchDirection.h>
00035 #include <SearchDirection.h>
00036 #include <StepSizeRule.h>
00037 #include <ProbabilityTransformation.h>
00038 #include <GFunEvaluator.h>
00039 #include <RootFinding.h>
00040 #include <Vector.h>
00041 #include <Matrix.h>
00042 
00043 
00044 GradientProjectionSearchDirection::GradientProjectionSearchDirection(
00045                                                                                 StepSizeRule *passedStepSizeRule,
00046                                                                                 ProbabilityTransformation *passedProbabilityTransformation,
00047                                                                                 GFunEvaluator *passedGFunEvaluator,
00048                                                                                 RootFinding *passedRootFindingAlgorithm)
00049 :SearchDirection()
00050 {
00051         theStepSizeRule = passedStepSizeRule;
00052         theProbabilityTransformation = passedProbabilityTransformation;
00053         theGFunEvaluator = passedGFunEvaluator;
00054         theRootFindingAlgorithm = passedRootFindingAlgorithm;
00055 }
00056 
00057 GradientProjectionSearchDirection::~GradientProjectionSearchDirection()
00058 {
00059 }
00060 
00061 
00062 
00063 
00064 Vector
00065 GradientProjectionSearchDirection::getSearchDirection()
00066 {
00067         return searchDirection;
00068 }
00069 
00070 
00071 
00072 int
00073 GradientProjectionSearchDirection::computeSearchDirection(int stepNumber, 
00074                                                                                                                   Vector u, 
00075                                                                                                                   double passed_g, 
00076                                                                                                                   Vector gradG)
00077 {
00078 
00079 
00080         // Initial declarations
00081         int i,j;
00082         Vector u_new;
00083         double initialStepSize;
00084         Vector Direction;
00085 
00086 
00087         // Problem size 
00088         int nrv = u.Size();
00089 
00090         
00091         // Unit matrix
00092         Matrix I(nrv,nrv);
00093         for (i=0; i<nrv; i++) {
00094                 for (j=0; j<nrv; j++) {
00095                         if (i==j) {
00096                                 I(i,j) = 1.0;
00097                         }
00098                         else {
00099                                 I(i,j) = 0.0;
00100                         }
00101                 }
00102         }
00103 
00104 
00105         // Matrix of "outer" product of gradient vector
00106         Matrix dGdG(nrv,nrv);
00107         for (i=0; i<nrv; i++) {
00108                 for (j=0; j<nrv; j++) {
00109                         dGdG(i,j) = gradG(i)*gradG(j);
00110                 }
00111         }
00112 
00113         // Get initial step size from the step size algorithm
00114         initialStepSize = theStepSizeRule->getInitialStepSize();
00115 
00116 
00117         // As long as it is not the first step; do the usual thing
00118         // (shouldn't happen if the user restarts the search...)
00119         if (stepNumber != 1) {
00120 
00121                 // Compute the initial search direction vector
00122                 Vector direction = (-1)* (I - (1.0/(gradG^gradG))*dGdG ) * u;
00123 
00124                 // Initial step 
00125                 u_new = u + initialStepSize*direction;
00126 
00127                 // Set the direction of the Newton search
00128                 Direction = gradG;
00129         }
00130         // If it's the first step; do the Newton thing from the
00131         // start point in the direction of the iHLRF search direction. 
00132         else {
00133 
00134                 u_new = u;
00135 
00136                 // Compute the alpha-vector
00137                 Vector alpha = gradG * ( (-1) / gradG.Norm() );
00138 
00139                 // Compute the direction vector
00140                 double alpha_times_u = alpha ^ u ;
00141                 Vector direction = alpha * ( passed_g / gradG.Norm() + alpha_times_u ) - u;
00142 
00143                 // Set the direction of the Newton search
00144                 Direction = (-1)*direction;
00145         }
00146 
00147 
00148         // Do the search to bring the trial point 'u_new' onto the lsf surface
00149         double tangent = gradG.Norm();
00150         Vector u_newest = theRootFindingAlgorithm->findLimitStateSurface(2,passed_g, Direction, u_new);
00151 
00152 
00153         // Return the final search direction
00154         // (remember to scale it so that u_new = u_old + lambda*d really brings us to u_new
00155         searchDirection = (1.0/initialStepSize)*(u_newest-u);
00156 
00157         return 0;
00158 
00159 }
00160 
00161 
00162 
00163 

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