codac 2.0.0
Loading...
Searching...
No Matches
codac2_SepQInter.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <type_traits>
13#include "codac2_Sep.h"
14#include "codac2_Collection.h"
15#include "codac2_SepWrapper.h"
16
17namespace codac2
18{
19 class SepQInter : public Sep<SepQInter>
20 {
21 public:
22
23 // q is the maximum number of constraints that may be violated.
24 SepQInter(unsigned int q, const Collection<SepBase>& c)
25 : Sep<SepQInter>([&c]() {
26 assert_release(!c.empty());
27 Index n = size_of(c.front());
28 for(const auto& s : c) {
29 (void)s;
30 assert_release(size_of(s) == n && "all separators must be of same size");
31 }
32 return n;
33 }()), _q(q), _seps(c)
34 {
35 assert_release(q <= c.size());
36 }
37
38 // q is the maximum number of constraints that may be violated.
39 explicit SepQInter(unsigned int q, Index n, const Collection<SepBase>& sep = {})
40 : Sep<SepQInter>(n), _q(q), _seps(sep)
41 {
42 std::cout << "SepQInter::SepQInter(unsigned int q, Index n, ..) is deprecated." << std::endl;
43 std::cout << "Use SepQInter::SepQInter(unsigned int q, ..) instead." << std::endl;
44 assert_release(n > 0);
45 }
46
47 template<typename S>
48 requires (IsSepBaseOrPtr<S> && !std::is_same_v<SepQInter,S>)
49 SepQInter(unsigned int q, const S& s)
50 : SepQInter(q, Collection<SepBase>({s}))
51 { }
52
53 template<typename... S>
54 requires (IsSepBaseOrPtr<S> && ...)
55 SepQInter(unsigned int q, const S&... s)
56 : SepQInter(q, Collection<SepBase>({s...}))
57 { }
58
59 size_t nb() const;
60
61 BoxPair separate(const IntervalVector& x) const;
62
63 protected:
64
65 size_t _q;
66 Collection<SepBase> _seps;
67 };
68}
Definition codac2_OctaSym.h:21
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25