]> SALOME platform Git repositories - modules/adao.git/blob - test/test6902/Verification_des_Checking_Algorithms.py
Salome HOME
Test extension for checking algorithms
[modules/adao.git] / test / test6902 / Verification_des_Checking_Algorithms.py
1 #-*-coding:iso-8859-1-*-
2 #
3 # Copyright (C) 2008-2017 EDF R&D
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22
23 import adaoBuilder
24
25 # ==============================================================================
26 def test1():
27     for algo in ("AdjointTest", "FunctionTest", "GradientTest", "LinearityTest", "TangentTest"):
28         print
29         msg = "Algorithme en test : %s"%algo
30         print msg+"\n"+"-"*len(msg)
31         #
32         adaopy = adaoBuilder.New()
33         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"EpsilonMinimumExponent":-10,"NumberOfRepetition":2, "SetSeed":1000})
34         adaopy.setCheckingPoint      (Vector = [0,1,2])
35         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
36         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
37         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
38         adaopy.setObservationOperator(Matrix = "1 0 0;0 2 0;0 0 3")
39         adaopy.execute()
40         del adaopy
41     #
42     for algo in ("ObserverTest", ):
43         print
44         msg = "Algorithme en test : %s"%algo
45         print msg+"\n"+"-"*len(msg)
46         #
47         adaopy = adaoBuilder.New()
48         adaopy.setAlgorithmParameters(Algorithm=algo)
49         adaopy.setCheckingPoint      (Vector = [0,1,2])
50         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
51         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
52         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
53         adaopy.setObservationOperator(Matrix = "1 0 0;0 2 0;0 0 3")
54         adaopy.setObserver("Analysis",Template="ValuePrinter")
55         adaopy.execute()
56         del adaopy
57     #
58     for algo in ("SamplingTest", ):
59         print
60         msg = "Algorithme en test : %s"%algo
61         print msg+"\n"+"-"*len(msg)
62         #
63         adaopy = adaoBuilder.New()
64         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={
65             "StoreSupplementaryCalculations":["CostFunctionJ","CurrentState",],
66             "SampleAsMinMaxStepHyperCube":[[-1.,1.,1.],[0,2,1],[1,3,1]],
67             })
68         adaopy.setCheckingPoint      (Vector = [0,1,2])
69         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
70         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
71         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
72         adaopy.setObservationOperator(Matrix = "1 0 0;0 2 0;0 0 3")
73         adaopy.setObserver           ("CurrentState",Template="ValuePrinter")
74         adaopy.execute()
75         del adaopy
76
77 # ==============================================================================
78 if __name__ == "__main__":
79     print '\n AUTODIAGNOSTIC \n'
80     test1()