Skip to content

Commit 95b37a1

Browse files
authored
Merge pull request #365 from SimonRohou/codac2_dev
[py] simplification: replacing wrapper objects with factory constructors
2 parents 0fd3585 + 857f549 commit 95b37a1

64 files changed

Lines changed: 1709 additions & 1185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
sudo apt-get -y install doxygen graphviz
5353

5454
# Doxygen might need to be upgraded
55-
git clone --depth 1 -b Release_1_13_0 https://github.com/doxygen/doxygen.git ; cd doxygen ; mkdir build ; cd build ; cmake .. ; sudo cmake --build . -j 4 --config Release --target install ; cd ../..
55+
git clone --depth 1 -b Release_1_16_1 https://github.com/doxygen/doxygen.git ; cd doxygen ; mkdir build ; cd build ; cmake .. ; sudo cmake --build . -j 4 --config Release --target install ; cd ../..
5656

5757
# For Python wrapping
5858
#pip install wheel

doc/manual/development/info_dev.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you simply want to use the latest Codac release in Python, you can download t
4949
cd $HOME
5050
git clone https://github.com/doxygen/doxygen
5151
cd doxygen
52-
git checkout Release_1_13_0 # 1.13.0, or any newer release
52+
git checkout Release_1_16_1 # 1.16.1, or any newer release
5353
mkdir build ; cd build
5454
cmake -DCMAKE_INSTALL_PREFIX=$HOME/doxygen/build_install ..
5555
make ; make install

doc/manual/manual/contractors/analytic/ctcinverse.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,17 @@ Note that since Codac's design is based on C++ template programming, the most ge
297297
| +-------------------------+---------------------------+-------------------------------------+
298298
| | :math:`\mathbb{R}` |ms| | :math:`\mathbb{R}^n` |ms| | :math:`\mathbb{R}^{r\times c}` |ms| |
299299
+--------------------+--------------------------------+-------------------------+---------------------------+-------------------------------------+
300-
| Input(s) :math:`X` | :math:`\mathbb{R}` | |noa| | |noa| | |noa| |
300+
| Input(s) :math:`X` | :math:`\mathbb{R}` | |okk| | |okk| | |noa| |
301301
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
302302
| | :math:`\mathbb{R}^n` | |okk| | |okk| | |noa| |
303303
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
304-
| | :math:`\mathbb{R}^{r\times c}` | |noa| | |noa| | |noa| |
304+
| | :math:`\mathbb{R}^{r\times c}` | |okk| | |okk| | |noa| |
305305
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
306-
| | any mixed types | |noa| | |noa| | |noa| |
306+
| | any mixed types | |okk| | |okk| | |noa| |
307307
+--------------------+--------------------------------+-------------------------+---------------------------+-------------------------------------+
308308

309+
NB: *any mixed types* does not include matrix types yet.
310+
309311
.. group-tab:: C++
310312

311313
.. table:: Possible usages of ``CtcInverse``
@@ -335,15 +337,17 @@ Note that since Codac's design is based on C++ template programming, the most ge
335337
| +-------------------------+---------------------------+-------------------------------------+
336338
| | :math:`\mathbb{R}` |ms| | :math:`\mathbb{R}^n` |ms| | :math:`\mathbb{R}^{r\times c}` |ms| |
337339
+--------------------+--------------------------------+-------------------------+---------------------------+-------------------------------------+
338-
| Input(s) :math:`X` | :math:`\mathbb{R}` | |noa| | |noa| | |noa| |
340+
| Input(s) :math:`X` | :math:`\mathbb{R}` | |okk| | |okk| | |noa| |
339341
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
340342
| | :math:`\mathbb{R}^n` | |okk| | |okk| | |noa| |
341343
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
342-
| | :math:`\mathbb{R}^{r\times c}` | |noa| | |noa| | |noa| |
344+
| | :math:`\mathbb{R}^{r\times c}` | |okk| | |okk| | |noa| |
343345
| +--------------------------------+-------------------------+---------------------------+-------------------------------------+
344-
| | any mixed types | |noa| | |noa| | |noa| |
346+
| | any mixed types | |okk| | |okk| | |noa| |
345347
+--------------------+--------------------------------+-------------------------+---------------------------+-------------------------------------+
346348

349+
NB: *any mixed types* does not include matrix types yet.
350+
347351

348352
Not-in constraints: ``CtcInverseNotIn``
349353
---------------------------------------

doc/manual/manual/contractors/analytic/src.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
c = CtcInverseNotIn(f, Interval(0,1));
5353

5454
y = IntervalVector({{0.5,3},{-1,1}});
55-
c.contract(y); % [[1,3],[-1,1]]
55+
y = c.contract(y); % [[1,3],[-1,1]]
5656
% Only the first component is constrained by the not-in condition
5757
% [ctcinv-6-end]
5858

doc/manual/manual/contractors/analytic/src.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def tests_CtcInverse_manual(test):
9292
c = CtcInverseNotIn(f, [0,1])
9393

9494
y = IntervalVector([[0.5,3],[-1,1]])
95-
c.contract(y) # [[1,3],[-1,1]]
95+
y = c.contract(y) # [[1,3],[-1,1]]
9696
# Only the first component is constrained by the not-in condition
9797
# [ctcinv-6-end]
9898

doc/manual/manual/contractors/dynamic/ctclohner.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This contractor is supposed to yield better results than the Picard contractor,
3131

3232
var = VectorVar(n) # n is the dimension of the system
3333
ctc_lohner = CtcLohner(AnalyticFunction([var], [expr1, expr2, ..., exprn]))
34-
ctc_lohner.contract(x)
34+
x = ctc_lohner.contract(x)
3535

3636
.. code-tab:: c++
3737

@@ -80,8 +80,8 @@ The Lohner contractor is used for obtaining a two-dimensional tube, considering
8080
ctc_lohner = CtcLohner(f)
8181

8282
# Contracting the tubes
83-
ctc_lohner.contract(a)
84-
ctc_lohner.contract(b)
83+
a = ctc_lohner.contract(a)
84+
b = ctc_lohner.contract(b)
8585

8686
# Graphics
8787
fig1 = Figure2D("Lohner_1",GraphicOutput.VIBES|GraphicOutput.IPE)

doc/manual/manual/contractors/set/src.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def tests_CtcInter_manual(test):
2626

2727
# [ctcinter-2-beg]
2828
x = IntervalVector([[-oo,oo],[-oo,oo]])
29-
c3.contract(x)
29+
x = c3.contract(x)
3030
# x = [ [-10, 2] ; [0, 2] ]
3131
# [ctcinter-2-end]
3232

doc/manual/tuto/cp_robotics/lesson_c_dynamic_localization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ State estimation with constraint programming
267267
:dedent: 0
268268

269269
**C.8.** **Fixpoint resolution.** Finally, the propagation loops need to be updated to incorporate the dynamic constraints.
270-
Note that the contractors :math:`\mathcal{C}_\mathbf{f}` and :math:`\mathcal{C}_{\mathrm{deriv}}` apply to the whole tubes :math:`[\mathbf{x}](\cdot)` and :math:`[\mathbf{v}](\cdot)`. Furthermore, the class ``CtcInverse`` can contract tubes using the ``.contract_tube(..)`` method, exactly as we would do for boxes. Finally, a *restriction* on a tube (*i.e.* setting a value to a slice) can be done using the ``.set(y,t)`` method, for setting the interval vector value ``y`` at time ``t``.
270+
Note that the contractors :math:`\mathcal{C}_\mathbf{f}` and :math:`\mathcal{C}_{\mathrm{deriv}}` apply to the whole tubes :math:`[\mathbf{x}](\cdot)` and :math:`[\mathbf{v}](\cdot)`. Furthermore, the class ``CtcInverse`` can contract tubes using the ``.contract(..)`` method, exactly as we would do for boxes. Finally, a *restriction* on a tube (*i.e.* setting a value to a slice) can be done using the ``.set(y,t)`` method, for setting the interval vector value ``y`` at time ``t``.
271271

272272
.. container:: toggle, toggle-hidden
273273

doc/manual/tuto/cp_robotics/src/lesson_C.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int main()
191191
x.set(xi,yi[0]); // restriction on the tube x at time ti=yi[0]
192192
}
193193

194-
ctc_f.contract_tube(x,v);
194+
ctc_f.contract(x,v);
195195
ctc_deriv.contract(x,v);
196196

197197
}, x);

doc/manual/tuto/cp_robotics/src/lesson_C.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,13 @@
178178
x.set(xi,yi(1));
179179
end
180180

181-
res_ctc_f = ctc_f.contract_tube(x,v);
181+
res_ctc_f = ctc_f.contract(x,v);
182182
x = res_ctc_f{1};
183183
v = res_ctc_f{2};
184184

185-
ctc_deriv.contract(x,v);
185+
res_ctc_deriv = ctc_deriv.contract(x,v);
186+
x = res_ctc_deriv{1};
187+
v = res_ctc_deriv{2};
186188

187189
end
188190

0 commit comments

Comments
 (0)