Shark machine learning library
About Shark
News!
Contribute
Credits and copyright
Downloads
Getting Started
Installation
Using the docs
Documentation
Tutorials
Quick references
Class list
Global functions
FAQ
Showroom
include
shark
Algorithms
AbstractMultiObjectiveOptimizer.h
Go to the documentation of this file.
1
/*!
2
*
3
*
4
* \brief AbstractMultiObjectiveOptimizer
5
*
6
*
7
*
8
* \author T.Voss, T. Glasmachers, O.Krause
9
* \date 2010-2011
10
*
11
*
12
* \par Copyright 1995-2015 Shark Development Team
13
*
14
* <BR><HR>
15
* This file is part of Shark.
16
* <http://image.diku.dk/shark/>
17
*
18
* Shark is free software: you can redistribute it and/or modify
19
* it under the terms of the GNU Lesser General Public License as published
20
* by the Free Software Foundation, either version 3 of the License, or
21
* (at your option) any later version.
22
*
23
* Shark is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
* GNU Lesser General Public License for more details.
27
*
28
* You should have received a copy of the GNU Lesser General Public License
29
* along with Shark. If not, see <http://www.gnu.org/licenses/>.
30
*
31
*/
32
#ifndef SHARK_OBJECTIVEFUNCTIONS_ABSTRACTMULTIOBJECTIVEOPTIMIZER_H
33
#define SHARK_OBJECTIVEFUNCTIONS_ABSTRACTMULTIOBJECTIVEOPTIMIZER_H
34
35
#include <
shark/Algorithms/AbstractOptimizer.h
>
36
#include <
shark/Core/ResultSets.h
>
37
38
namespace
shark
{
39
40
/**
41
* \brief base class for abstract multi-objective optimizers for arbitrary search spaces.
42
*
43
* Models an abstract multi-objective optimizer for arbitrary search spaces. The objective space
44
* is assumed to be \f$ \mathbb{R}^m\f$.
45
*
46
* \tparam PointType The type of the points that make up the searchspace.
47
*/
48
template
<
typename
Po
int
TypeT>
49
class
AbstractMultiObjectiveOptimizer
:
50
public
AbstractOptimizer
<
51
PointTypeT,
52
RealVector,
53
std::vector< ResultSet< PointTypeT, RealVector > >
54
> {
55
private
:
56
typedef
AbstractOptimizer
<
57
PointTypeT,
58
RealVector,
59
std::vector< ResultSet< PointTypeT, RealVector > >
60
>
super
;
61
public
:
62
typedef
typename
super::SearchPointType
SearchPointType
;
63
typedef
typename
super::SolutionType
SolutionType
;
64
typedef
typename
super::ObjectiveFunctionType
ObjectiveFunctionType
;
65
66
/**
67
* \brief Virtual empty d'tor.
68
*/
69
virtual
~AbstractMultiObjectiveOptimizer
() {}
70
71
/**
72
* \brief Initializes the optimizer for the supplied objective function.
73
*
74
* Tries to sample an initial starting point. If the function does not
75
* implement this feature, an exception is thrown. Otherwise, the call is dispatched
76
* to the pure-virtual function.
77
*
78
* \param function The function to be initialized for.
79
* \throws Exception if the function does not feature the proposal of starting points.
80
*/
81
virtual
void
init
(ObjectiveFunctionType &
function
) {
82
if
(!(
function
.
features
() &
ObjectiveFunctionType::CAN_PROPOSE_STARTING_POINT
))
83
throw
SHARKEXCEPTION
(
"Objective function does not propose a starting point"
);
84
std::vector<RealVector> startingPoints(1);
85
startingPoints[0] =
function
.proposeStartingPoint();
86
init
(
function
,startingPoints);
87
}
88
89
/**
90
* \brief Optimizer-specific init-function. Needs to be implemented by subclasses.
91
* \param [in] function The function to initialize the optimizer for.
92
* \param [in] startingPoints An initial population of points
93
*/
94
virtual
void
init
(
95
ObjectiveFunctionType&
function
,
96
std::vector<SearchPointType>
const
& startingPoints
97
) = 0;
98
99
/**
100
* \brief Accesses the current approximation of the Pareto-set and -front, respectively.
101
* \returns The current set of candidate solutions.
102
*/
103
const
SolutionType &
solution
()
const
{
104
return
m_best
;
105
}
106
107
protected
:
108
SolutionType
m_best
;
///< The current Pareto-set/-front.
109
};
110
111
}
112
#endif