Loading...
Searching...
No Matches
Optimizer.cpp
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#include "eon/Optimizer.h"
13#include "eon/BaseStructures.h"
15#include "eon/FIRE.h"
16#include "eon/LBFGS.h"
17#include "eon/Quickmin.h"
18#include "eon/SteepestDescent.h"
19
21std::unique_ptr<Optimizer> mkOptim(std::shared_ptr<ObjectiveFunction> a_objf,
22 OptType a_otype,
23 const Parameters &a_params) {
24 switch (a_otype) {
25 case OptType::FIRE: {
26 return std::make_unique<FIRE>(a_objf, a_params);
27 }
28 case OptType::QM: {
29 return std::make_unique<Quickmin>(a_objf, a_params);
30 }
31 case OptType::CG: {
32 return std::make_unique<ConjugateGradients>(a_objf, a_params);
33 }
34 case OptType::LBFGS: {
35 return std::make_unique<LBFGS>(a_objf, a_params);
36 }
37 case OptType::SD: {
38 return std::make_unique<SteepestDescent>(a_objf, a_params);
39 }
40 case OptType::None: {
41 throw std::runtime_error("[Optimizer] Cannot create None");
42 }
43 case OptType::Unknown: {
44 throw std::runtime_error("[Optimizer] Cannot create Unknown");
45 }
46 default: {
47 throw std::runtime_error("Unsupported optimization type");
48 }
49 }
50}
51} // namespace eonc::helpers::create
Direct optimization for energy minimization.
The optimizer class is used to serve as an abstract class for all optimizers, as well as to call an o...
std::unique_ptr< Optimizer > mkOptim(std::shared_ptr< ObjectiveFunction > a_objf, OptType a_otype, const Parameters &a_params)
Definition Optimizer.cpp:21