DART 6.10.1
Loading...
Searching...
No Matches
GenericMultiObjectiveProblem.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2021, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_OPTIMIZER_GENERICMULTIOBJECTIVEPROBLEM_HPP_
34#define DART_OPTIMIZER_GENERICMULTIOBJECTIVEPROBLEM_HPP_
35
36#include <cstddef>
37#include <vector>
38
39#include <Eigen/Dense>
40
43
44namespace dart {
45namespace optimizer {
46
48{
49public:
52 std::size_t dim, std::size_t integerDim = 0u);
53
55 ~GenericMultiObjectiveProblem() override = default;
56
58
59 // Documentation inherited.
60 std::size_t getObjectiveDimension() const override;
61
63 void setObjectiveFunctions(const std::vector<FunctionPtr>& objectives);
64
66 void addObjectiveFunction(FunctionPtr objective);
67
69 std::size_t getNumObjectiveFunctions() const;
70
72 const std::vector<FunctionPtr>& getObjectiveFunctions() const;
73
76
79
81
83
84 // Documentation inherited.
85 std::size_t getEqConstraintDimension() const override;
86
89
91 std::size_t getNumEqualityConstraintFunctions() const;
92
94 FunctionPtr getEqConstraintFunction(std::size_t index) const;
95
98
101
103
105
106 // Documentation inherited.
107 std::size_t getIneqConstraintDimension() const override;
108
112
114 std::size_t getNumIneqConstraintFunctions() const;
115
118
121
124
126
128
130 Eigen::VectorXd evaluateObjectives(const Eigen::VectorXd& x) const override;
131
133 Eigen::VectorXd evaluateEqConstraints(
134 const Eigen::VectorXd& x) const override;
135
137 Eigen::VectorXd evaluateIneqConstraints(
138 const Eigen::VectorXd& x) const override;
139
141 std::size_t getFitnessDimension() const;
142
145 Eigen::VectorXd evaluateFitness(const Eigen::VectorXd& x) const;
146
148
149protected:
151 std::vector<FunctionPtr> mObjectiveFunctions;
152
154 std::vector<FunctionPtr> mEqConstraintFunctions;
155
157 std::vector<FunctionPtr> mIneqConstraintFunctions;
158
159private:
162
165
168};
169
170} // namespace optimizer
171} // namespace dart
172
173#endif // DART_OPTIMIZER_GENERICMULTIOBJECTIVEPROBLEM_HPP_
std::size_t index
Definition SkelParser.cpp:1672
Definition GenericMultiObjectiveProblem.hpp:48
void removeAllIneqConstraintFunctions()
Removes all inequality constraints.
Definition GenericMultiObjectiveProblem.cpp:213
std::size_t getIneqConstraintDimension() const override
Returns the total dimension of inequality constraints.
Definition GenericMultiObjectiveProblem.cpp:207
void removeAllObjectiveFunctions()
Removes all objective functions.
Definition GenericMultiObjectiveProblem.cpp:187
FunctionPtr getEqConstraintFunction(std::size_t index) const
Returns equality constraint.
Definition GenericMultiObjectiveProblem.cpp:134
void removeAllEqConstraintFunctions()
Removes all equality constraints.
Definition GenericMultiObjectiveProblem.cpp:200
void removeEqConstraintFunction(FunctionPtr eqConst)
Removes equality constraint.
Definition GenericMultiObjectiveProblem.cpp:161
std::size_t mIneqConstraintDimension
Cache for inequality constraint dimension.
Definition GenericMultiObjectiveProblem.hpp:167
void addObjectiveFunction(FunctionPtr objective)
Adds a minimum objective function.
Definition GenericMultiObjectiveProblem.cpp:102
const std::vector< FunctionPtr > & getObjectiveFunctions() const
Returns objective functions.
Definition GenericMultiObjectiveProblem.cpp:111
std::size_t getNumEqualityConstraintFunctions() const
Returns number of equality constraints.
Definition GenericMultiObjectiveProblem.cpp:81
std::size_t getEqConstraintDimension() const override
Returns the total dimension of equality constraints.
Definition GenericMultiObjectiveProblem.cpp:194
Eigen::VectorXd evaluateFitness(const Eigen::VectorXd &x) const
Evaluates fitness, which is [objectives, equality constraints, inequality constraints].
Definition GenericMultiObjectiveProblem.cpp:274
std::size_t getObjectiveDimension() const override
Returns the total dimension of objective functions.
Definition GenericMultiObjectiveProblem.cpp:69
Eigen::VectorXd evaluateObjectives(const Eigen::VectorXd &x) const override
Evaluates objectives.
Definition GenericMultiObjectiveProblem.cpp:241
std::size_t getNumIneqConstraintFunctions() const
Returns number of inequality constraints.
Definition GenericMultiObjectiveProblem.cpp:88
void addEqConstraintFunction(FunctionPtr eqConst)
Adds equality constraint.
Definition GenericMultiObjectiveProblem.cpp:117
std::size_t mEqConstraintDimension
Cache for equality constraint dimension.
Definition GenericMultiObjectiveProblem.hpp:164
void removeObjectiveFunction(FunctionPtr function)
Removes an objective function.
Definition GenericMultiObjectiveProblem.cpp:151
void setObjectiveFunctions(const std::vector< FunctionPtr > &objectives)
Sets objective functions to be minimized.
Definition GenericMultiObjectiveProblem.cpp:94
std::vector< FunctionPtr > mObjectiveFunctions
Objective functions.
Definition GenericMultiObjectiveProblem.hpp:151
std::vector< FunctionPtr > mEqConstraintFunctions
Equality constraint functions.
Definition GenericMultiObjectiveProblem.hpp:154
std::size_t mObjectiveDimension
Cache for objective dimension.
Definition GenericMultiObjectiveProblem.hpp:161
Eigen::VectorXd evaluateEqConstraints(const Eigen::VectorXd &x) const override
Evaluates equality constraints.
Definition GenericMultiObjectiveProblem.cpp:248
std::size_t getFitnessDimension() const
Return dimension of fitness.
Definition GenericMultiObjectiveProblem.cpp:264
Eigen::VectorXd evaluateIneqConstraints(const Eigen::VectorXd &x) const override
Evaluates inequality constraints.
Definition GenericMultiObjectiveProblem.cpp:256
std::size_t getNumObjectiveFunctions() const
Returns the number objective functions.
Definition GenericMultiObjectiveProblem.cpp:75
void addIneqConstraintFunction(FunctionPtr ineqConst)
Adds inequality constraint.
Definition GenericMultiObjectiveProblem.cpp:125
std::vector< FunctionPtr > mIneqConstraintFunctions
Inequality constraint functions.
Definition GenericMultiObjectiveProblem.hpp:157
~GenericMultiObjectiveProblem() override=default
Destructor.
void removeIneqConstraintFunction(FunctionPtr ineqConst)
Removes inequality constraint.
Definition GenericMultiObjectiveProblem.cpp:174
FunctionPtr getIneqConstraintFunction(std::size_t index) const
Returns inequality constraint.
Definition GenericMultiObjectiveProblem.cpp:142
Definition MultiObjectiveProblem.hpp:47
std::shared_ptr< Function > FunctionPtr
Definition Function.hpp:84
Definition BulletCollisionDetector.cpp:65