ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
HouseProblems.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*-------------------------- File HouseProblems.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
48
/*--------------------------------------------------------------------------*/
49
/*----------------------------- DEFINITIONS --------------------------------*/
50
/*--------------------------------------------------------------------------*/
51
52
#ifndef __ADS_HouseProblems
53
#define __ADS_HouseProblems
54
/* self-identification: #endif constant */
55
56
/*--------------------------------------------------------------------------*/
57
/*------------------------------ INCLUDES ----------------------------------*/
58
/*--------------------------------------------------------------------------*/
59
60
#include "
ADS/Contract.h
"
61
62
#include <algorithm>
63
#include <cstddef>
64
#include <utility>
65
#include <vector>
66
67
/*--------------------------------------------------------------------------*/
68
/*--------------------------- NAMESPACE ------------------------------------*/
69
/*--------------------------------------------------------------------------*/
70
71
namespace
ADS
72
{
73
92
template
<
class
T >
93
T
maxNonAdjacentSum
(
const
std::vector< T > & A );
94
116
template
<
class
T >
117
std::pair< T , std::vector< std::size_t > >
118
nonAdjacentSelection
(
const
std::vector< T > & A );
119
149
template
<
class
T >
150
std::pair< T , std::vector< std::size_t > >
151
paintHouses
(
const
std::vector< std::vector< T > > & cost );
152
153
/*--------------------------------------------------------------------------*/
154
155
}
// end( namespace ADS )
156
157
/*--------------------------------------------------------------------------*/
158
/*-------------------------- IMPLEMENTATION --------------------------------*/
159
/*--------------------------------------------------------------------------*/
160
161
#include "ADS/optimization/impl/HouseProblems.tpp"
162
163
/*--------------------------------------------------------------------------*/
164
165
#endif
/* HouseProblems.h included */
166
167
/*--------------------------------------------------------------------------*/
168
/*------------------------ End File HouseProblems.h ------------------------*/
169
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::maxNonAdjacentSum
T maxNonAdjacentSum(const std::vector< T > &A)
the largest sum of items of no two of them adjacent, 0 for none
ADS::nonAdjacentSelection
std::pair< T, std::vector< std::size_t > > nonAdjacentSelection(const std::vector< T > &A)
the sum of maxNonAdjacentSum() and the places of its items, increasing; an item is taken only if it m...
ADS::paintHouses
std::pair< T, std::vector< std::size_t > > paintHouses(const std::vector< std::vector< T > > &cost)
the least cost of a painting of the houses, adjacent houses of different colors, for the house of t...
ADS
Definition
ADT.h:96
ADS
optimization
HouseProblems.h
Generated by
1.17.0