codac 1.5.6
Loading...
Searching...
No Matches
codac2_CtcProj.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <map>
13#include "codac2_Ctc.h"
14#include "codac2_Collection.h"
17#include "codac2_ProjBase.h"
18
19namespace codac2
20{
21 class CtcProj : public Ctc<CtcProj,IntervalVector>, protected ProjBase
22 {
23 public:
24
25 template<typename C>
26 requires IsCtcBaseOrPtr<C,IntervalVector>
27 CtcProj(const C& c, const std::vector<Index>& proj_indices, double default_eps = 0.01)
28 : CtcProj(c, proj_indices, IntervalVector(size_of(c)-proj_indices.size()), default_eps)
29 { }
30
31 template<typename C>
32 requires IsCtcBaseOrPtr<C,IntervalVector>
33 CtcProj(const C& c, const std::vector<Index>& proj_indices, const IntervalVector& y, double default_eps = 0.01)
34 : Ctc<CtcProj,IntervalVector>(proj_indices.size()), ProjBase(proj_indices,y,default_eps), _ctc(c)
35 {
36 assert_release(_y.size() == size_of(c)-(Index)_xi.size());
37 assert_release(*min_element(_xi.begin(),_xi.end()) >= 0);
38 assert_release(*max_element(_xi.begin(),_xi.end()) < size_of(c));
39 assert_release(size_of(c) >= (Index)_xi.size() && "cannot compute a projection of a set into a superset");
40 assert_release(default_eps > 0.);
41 }
42
43 void contract(IntervalVector& x) const;
44 void contract(IntervalVector& x, double eps) const;
45
46 protected:
47
48 const Collection<CtcBase<IntervalVector>> _ctc;
49 };
50}