ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
WeightedIntervals.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------ File WeightedIntervals.h ------------------------*/
3/*--------------------------------------------------------------------------*/
33/*--------------------------------------------------------------------------*/
34/*----------------------------- DEFINITIONS --------------------------------*/
35/*--------------------------------------------------------------------------*/
36
37#ifndef __ADS_WeightedIntervals
38 #define __ADS_WeightedIntervals
39/* self-identification: #endif constant */
40
41/*--------------------------------------------------------------------------*/
42/*------------------------------ INCLUDES ----------------------------------*/
43/*--------------------------------------------------------------------------*/
44
45#include "ADS/Contract.h"
46
47#include <algorithm>
48#include <cstddef>
49#include <numeric>
50#include <utility>
51#include <vector>
52
53/*--------------------------------------------------------------------------*/
54/*--------------------------- NAMESPACE ------------------------------------*/
55/*--------------------------------------------------------------------------*/
56
57namespace ADS
58{
59
61template< class W >
63{
64 long long a ,
65 b;
66 W w;
67 };
68
100template< class W >
101std::pair< std::vector< std::size_t > , W >
102maxinterval( const std::vector< WeightedInterval< W > > & I );
103
104/*--------------------------------------------------------------------------*/
105
106} // end( namespace ADS )
107
108/*--------------------------------------------------------------------------*/
109/*-------------------------- IMPLEMENTATION --------------------------------*/
110/*--------------------------------------------------------------------------*/
111
112#include "ADS/optimization/impl/WeightedIntervals.tpp"
113
114/*--------------------------------------------------------------------------*/
115
116#endif /* WeightedIntervals.h included */
117
118/*--------------------------------------------------------------------------*/
119/*---------------------- End File WeightedIntervals.h ----------------------*/
120/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::pair< std::vector< std::size_t >, W > maxinterval(const std::vector< WeightedInterval< W > > &I)
the places of the intervals of a largest independent set, in increasing order, and its weight
Definition ADT.h:96
an interval of weight
Definition WeightedIntervals.h:63
W w
the weight
Definition WeightedIntervals.h:66
long long a
the left end, included
Definition WeightedIntervals.h:64
long long b
the right end, excluded
Definition WeightedIntervals.h:65