Interface for Pareto optimality

Class for calculation the Pareto optimal elements from a set of multi-valued objects.

Copyright (c) 2013, Pieter Eendebak pieter.eendebak@gmail.com All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Defines

myprintf
template<class ValueType, class IndexType>
struct pareto_element
#include <pareto.h>

helper class for the Pareto class to hold elements

Public Types

typedef std::vector<ValueType> pValue

Public Functions

inline bool dominates(pValue v)

return true of the argument element dominates this value

inline bool isdominated(pValue v)

return true of the argument element is dominated by this value

inline bool equal(pValue v)

return true of the argument element is equal to this element

Public Members

pValue value
std::vector<IndexType> indices
template<class ValueType, class IndexType>
class Pareto
#include <pareto.h>

Class to the calculate Pareto optimal elements.

The class is templated by the type of values to be compared and an index type. The index type is used to index the elements.

For elements added to the Pareto structure larger is better.

Public Types

typedef std::vector<ValueType> pValue

type for values of Pareto elements

typedef pareto_element<ValueType, IndexType> pElement

a pareto element consists of a pair (value, index)

Public Functions

inline Pareto()

Create an empty Pareto class.

inline ~Pareto()
inline int number() const

return the total number of Pareto optimal values

inline int numberindices() const

return the total number Pareto optimal objects

inline std::string __repr__() const
inline void show(int verbose = 1)

show the current set of Pareto optimal elements

inline std::deque<IndexType> allindicesdeque() const

return all indices of the Pareto optimal elements as a std::deque

inline std::vector<IndexType> allindices() const

return all indices of the Pareto optimal elements

inline std::vector<pValue> allvalues() const

return the values of all Pareto optimal elements

inline bool addvalue(const pValue value, const IndexType idx)

add a new element

Public Members

int verbose

Verbosity level.

std::deque<pareto_element<ValueType, IndexType>> elements

contains a list of all Pareto optimal elements

Public Static Functions

static inline void showvalue(const pValue p)

show a Pareto element