DART  6.7.3
MultiObjectiveProblem.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, 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_MULTIOBJECTIVEPROBLEM_HPP_
34 #define DART_OPTIMIZER_MULTIOBJECTIVEPROBLEM_HPP_
35 
36 #include <cstddef>
37 #include <vector>
38 
39 #include <Eigen/Dense>
40 
42 
43 namespace dart {
44 namespace optimizer {
45 
47 {
48 public:
50  explicit MultiObjectiveProblem(std::size_t dim, std::size_t integerDim = 0u);
51 
53  virtual ~MultiObjectiveProblem() = default;
54 
56 
74  virtual void setSolutionDimension(
75  std::size_t dim, std::size_t integerDim = 0u);
76 
78  virtual std::size_t getSolutionDimension() const;
79 
81  std::size_t getDoubleDimension() const;
82 
84  virtual void setIntegerDimension(std::size_t dim);
85 
87  virtual std::size_t getIntegerDimension() const;
88 
90  void setLowerBounds(const Eigen::VectorXd& lb);
91 
93  const Eigen::VectorXd& getLowerBounds() const;
94 
96  void setUpperBounds(const Eigen::VectorXd& ub);
97 
99  const Eigen::VectorXd& getUpperBounds() const;
100 
102 
104 
106  virtual std::size_t getObjectiveDimension() const = 0;
107 
109 
111 
113  virtual std::size_t getEqConstraintDimension() const;
114 
116 
118 
120  virtual std::size_t getIneqConstraintDimension() const;
121 
123 
125 
127  virtual Eigen::VectorXd evaluateObjectives(
128  const Eigen::VectorXd& x) const = 0;
129 
131  virtual Eigen::VectorXd evaluateEqConstraints(const Eigen::VectorXd& x) const;
132 
134  virtual Eigen::VectorXd evaluateIneqConstraints(
135  const Eigen::VectorXd& x) const;
136 
138  std::size_t getFitnessDimension() const;
139 
142  Eigen::VectorXd evaluateFitness(const Eigen::VectorXd& x) const;
143 
145 
147  virtual std::ostream& print(std::ostream& os) const;
148 
149 protected:
151  std::size_t mDimension;
152 
155  std::size_t mIntegerDimension;
156 
158  Eigen::VectorXd mLowerBounds;
159 
161  Eigen::VectorXd mUpperBounds;
162 };
163 
164 } // namespace optimizer
165 } // namespace dart
166 
167 #endif // DART_OPTIMIZER_MULTIOBJECTIVEPROBLEM_HPP_
Definition: MultiObjectiveProblem.hpp:47
virtual Eigen::VectorXd evaluateEqConstraints(const Eigen::VectorXd &x) const
Evaluates equality constraints.
Definition: MultiObjectiveProblem.cpp:144
const Eigen::VectorXd & getUpperBounds() const
Returns upper bounds for optimization parameters.
Definition: MultiObjectiveProblem.cpp:126
virtual Eigen::VectorXd evaluateObjectives(const Eigen::VectorXd &x) const =0
Evaluates objectives.
void setLowerBounds(const Eigen::VectorXd &lb)
Sets lower bounds for optimization parameters.
Definition: MultiObjectiveProblem.cpp:106
std::size_t getDoubleDimension() const
Returns dimension of the floating-point part of the solution.
Definition: MultiObjectiveProblem.cpp:88
virtual ~MultiObjectiveProblem()=default
Destructor.
MultiObjectiveProblem(std::size_t dim, std::size_t integerDim=0u)
Constructor.
Definition: MultiObjectiveProblem.cpp:58
virtual std::ostream & print(std::ostream &os) const
Prints information of this class to a stream.
Definition: MultiObjectiveProblem.cpp:186
virtual std::size_t getEqConstraintDimension() const
Returns the total dimension of equality constraints.
Definition: MultiObjectiveProblem.cpp:132
virtual std::size_t getObjectiveDimension() const =0
Returns the total dimension of objective functions.
void setUpperBounds(const Eigen::VectorXd &ub)
Sets upper bounds for optimization parameters.
Definition: MultiObjectiveProblem.cpp:119
virtual std::size_t getIntegerDimension() const
Returns dimension of the integers in the decision vector.
Definition: MultiObjectiveProblem.cpp:100
virtual std::size_t getIneqConstraintDimension() const
Returns the total dimension of inequality constraints.
Definition: MultiObjectiveProblem.cpp:138
virtual void setIntegerDimension(std::size_t dim)
Sets dimension of the integers in the decision vector.
Definition: MultiObjectiveProblem.cpp:94
Eigen::VectorXd mUpperBounds
Upper bounds for optimization parameters.
Definition: MultiObjectiveProblem.hpp:161
std::size_t mDimension
Dimension of the decision vector (or optimization parameters)
Definition: MultiObjectiveProblem.hpp:151
virtual Eigen::VectorXd evaluateIneqConstraints(const Eigen::VectorXd &x) const
Evaluates inequality constraints.
Definition: MultiObjectiveProblem.cpp:151
std::size_t mIntegerDimension
Dimension of integer in the decision vector.
Definition: MultiObjectiveProblem.hpp:155
std::size_t getFitnessDimension() const
Return dimension of fitness.
Definition: MultiObjectiveProblem.cpp:158
Eigen::VectorXd mLowerBounds
Lower bounds for optimization parameters.
Definition: MultiObjectiveProblem.hpp:158
Eigen::VectorXd evaluateFitness(const Eigen::VectorXd &x) const
Evaluates fitness, which is [objectives, equality constraints, inequality constraints].
Definition: MultiObjectiveProblem.cpp:168
const Eigen::VectorXd & getLowerBounds() const
Returns lower bounds for optimization parameters.
Definition: MultiObjectiveProblem.cpp:113
virtual void setSolutionDimension(std::size_t dim, std::size_t integerDim=0u)
Sets the dimension of the solution.
Definition: MultiObjectiveProblem.cpp:65
virtual std::size_t getSolutionDimension() const
Returns dimension of the solution.
Definition: MultiObjectiveProblem.cpp:82
Definition: BulletCollisionDetector.cpp:63