Loading...
Searching...
No Matches
SteepestDescent.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13#include "EonLogger.h"
14
15#include "Eigen.h"
16#include "HelperFunctions.h"
17#include "Matter.h"
18#include "ObjectiveFunction.h"
19#include "Optimizer.h"
20#include "Parameters.h"
21
22namespace eonc {
23
24class SteepestDescent final : public Optimizer {
25public:
26 SteepestDescent(std::shared_ptr<ObjectiveFunction> a_objf,
27 const Parameters &a_params)
28 : Optimizer(a_objf, OptType::SD, a_params),
29 iteration{0} {}
30 ~SteepestDescent() = default;
31
32 int step(double a_maxMove) override;
33 int run(size_t a_maxIterations, double a_maxMove) override;
34
35private:
36 eonc::log::FileScoped m_log{"sd", "_sd.log"};
37 Eigen::VectorXd getStep(const Eigen::VectorXd &a_f);
38 size_t iteration{0};
39 Eigen::VectorXd m_rPrev;
40 Eigen::VectorXd m_fPrev;
41};
42
43} // namespace eonc
44
The optimizer class is used to serve as an abstract class for all optimizers, as well as to call an o...
Optimizer(std::shared_ptr< ObjectiveFunction > a_objf, const OptimizerConfig &a_config)
Definition Optimizer.h:71
Eigen::VectorXd getStep(const Eigen::VectorXd &a_f)
~SteepestDescent()=default
SteepestDescent(std::shared_ptr< ObjectiveFunction > a_objf, const Parameters &a_params)
int run(size_t a_maxIterations, double a_maxMove) override
int step(double a_maxMove) override
Eigen::VectorXd m_fPrev
eonc::log::FileScoped m_log
Eigen::VectorXd m_rPrev
RAII resource manager for the ARTn C library with global synchronization.
RAII helper for file-based logging in a class.
Definition EonLogger.h:208