source: colin/trunk/colin/GradientDescent.h @ 5786

Revision 5786, 1.9 KB checked in by wehart, 5 years ago (diff)

Update of source to include Acro copyright statement

Line 
1/*  _________________________________________________________________________
2 *
3 *  Acro: A Common Repository for Optimizers
4 *  Copyright (c) 2008 Sandia Corporation.
5 *  This software is distributed under the BSD License.
6 *  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7 *  the U.S. Government retains certain rights in this software.
8 *  For more information, see the README.txt file in the top Acro directory.
9 *  _________________________________________________________________________
10 */
11
12/**
13 * \file GradientDescent.h
14 *
15 * Defines the colin::GradientDescent class.
16 */
17
18#ifndef colin_GradientDescent_h
19#define colin_GradientDescent_h
20
21#include <acro_config.h>
22#include <utilib/BasicArray.h>
23#include <colin/ColinOptSolver.h>
24
25namespace colin
26{
27
28/** A simple derivative-based local search method. */
29class GradientDescent
30   : public colin::ColinOptSolver<utilib::BasicArray<double>, UNLP1_problem >
31{
32public:
33
34   ///
35   GradientDescent();
36
37   ///
38   void optimize();
39
40protected:
41
42   ///
43   std::string define_solver_type() const;
44
45   ///
46   void initialize_best_point()
47   {
48      if ( (initial_point.size() > 0) &&
49           (initial_point.size() != problem->num_real_vars()))
50         EXCEPTION_MNGR(std::runtime_error,
51                        "GradientDescent::initialize_best_point(): "
52                        "user-provided best point has " <<
53                        initial_point.size() <<
54                        " real variables, but the problem has " <<
55                        problem->num_real_vars() << std::endl );
56
57      initial_point.resize(problem->num_real_vars());
58   }
59
60   ///
61   bool check_convergence();
62
63   ///
64   double init_step_length;
65
66   ///
67   utilib::BasicArray<real> grad;
68
69   ///
70   std::vector<real> rlower;
71
72   ///
73   std::vector<real> rupper;
74
75   ///
76   bool bc_flag;
77
78private:
79
80   ///
81   void reset_GradientDescent();
82
83};
84
85}
86
87#endif
Note: See TracBrowser for help on using the repository browser.