From: Jean-Philippe ARGAUD Date: Thu, 17 Nov 2016 19:32:49 +0000 (+0100) Subject: Report validation of ADAO Case using Eficas and documentation improvement X-Git-Tag: V8_2_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cfd0064c663b81d07e085dc486c0446e5d4ec219;p=modules%2Fadao.git Report validation of ADAO Case using Eficas and documentation improvement --- diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am index 8186fd0..db66f84 100644 --- a/doc/en/Makefile.am +++ b/doc/en/Makefile.am @@ -49,6 +49,7 @@ EXTRA_DIST = conf.py advanced.rst examples.rst index.rst intro.rst theory.rs images/eficas_close.png \ images/eficas_open.png \ images/eficas_saveas.png \ + images/eficas_valid.png \ images/yacs_containerlog.png install-data-local: diff --git a/doc/en/images/eficas_valid.png b/doc/en/images/eficas_valid.png new file mode 100644 index 0000000..9790884 Binary files /dev/null and b/doc/en/images/eficas_valid.png differ diff --git a/doc/en/ref_algorithm_DerivativeFreeOptimization.rst b/doc/en/ref_algorithm_DerivativeFreeOptimization.rst index 39ce347..1ca7a91 100644 --- a/doc/en/ref_algorithm_DerivativeFreeOptimization.rst +++ b/doc/en/ref_algorithm_DerivativeFreeOptimization.rst @@ -35,9 +35,9 @@ Calculation algorithm "*DerivativeFreeOptimization*" Description +++++++++++ -This algorithm realizes an estimation of the state of a dynamic system by -minimization of a cost function :math:`J` without gradient. It is a method that -doesn't use the derivatives of the cost function. It fall in the same category +This algorithm realizes an estimation of the state of a system by minimization +of a cost function :math:`J` without gradient. It is a method that doesn't use +the derivatives of the cost function. It fall for example in the same category then the :ref:`section_ref_algorithm_ParticleSwarmOptimization`. This is an optimization method allowing for global minimum search of a general @@ -110,9 +110,13 @@ The options of the algorithm are the following: Minimizer This key allows to choose the optimization minimizer. The default choice is "POWELL", and the possible ones are "POWELL" (modified Powell unconstrained - minimizer, see [Powell]_), "SIMPLEX" (nonlinear constrained minimizer), "CG" - (simplex of Nelder-Mead unconstrained minimizer, see [Nelder]_). It is - recommended to stay with the default. + minimizer, see [Powell]_), "SIMPLEX" (simplex or Nelder-Mead unconstrained + minimizer, see [Nelder]_). It is recommended to stay with the default. + Remark: the default "POWELL" method perform a dual outer/inner loops + optimization, leading then to less control on the cost function evaluation + number because it is the outer loop limit than is controled. If precise + control on this cost function evaluation number is required, choose the + "SIMPLEX" one. Example : ``{"Minimizer":"POWELL"}`` diff --git a/doc/fr/Makefile.am b/doc/fr/Makefile.am index 32823d5..700e4c2 100644 --- a/doc/fr/Makefile.am +++ b/doc/fr/Makefile.am @@ -49,6 +49,7 @@ EXTRA_DIST = conf.py advanced.rst examples.rst index.rst intro.rst theory.rs images/eficas_close.png \ images/eficas_open.png \ images/eficas_saveas.png \ + images/eficas_valid.png \ images/yacs_containerlog.png install-data-local: diff --git a/doc/fr/images/eficas_valid.png b/doc/fr/images/eficas_valid.png new file mode 100644 index 0000000..9790884 Binary files /dev/null and b/doc/fr/images/eficas_valid.png differ diff --git a/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst b/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst index c010cec..9beb578 100644 --- a/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst +++ b/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst @@ -35,11 +35,10 @@ Algorithme de calcul "*DerivativeFreeOptimization*" Description +++++++++++ -Cet algorithme réalise une estimation d'état d'un système dynamique par -minimisation d'une fonctionnelle d'écart :math:`J` sans gradient. C'est une -méthode qui n'utilise pas les dérivées de la fonctionnelle d'écart. Elle entre -dans la même catégorie que -l':ref:`section_ref_algorithm_ParticleSwarmOptimization`. +Cet algorithme réalise une estimation d'état d'un système par minimisation d'une +fonctionnelle d'écart :math:`J` sans gradient. C'est une méthode qui n'utilise +pas les dérivées de la fonctionnelle d'écart. Elle entre par exemple dans la +même catégorie que l':ref:`section_ref_algorithm_ParticleSwarmOptimization`. C'est une méthode d'optimisation permettant la recherche du minimum global d'une fonctionnelle d'erreur :math:`J` quelconque de type :math:`L^1`, :math:`L^2` ou @@ -113,9 +112,14 @@ Les options de l'algorithme sont les suivantes: Minimizer Cette clé permet de changer le minimiseur pour l'optimiseur. Le choix par défaut est "POWELL", et les choix possibles sont "POWELL" (minimisation sans - contrainte de type Powell modifiée, voir [Powell]_), "SIMPLEX" (minimisation - sans contrainte de type simplexe ou Nelder-Mead, voir [Nelder]_). Il est - conseillé de conserver la valeur par défaut. + contraintes de type Powell modifiée, voir [Powell]_), "SIMPLEX" + (minimisation sans contraintes de type simplexe ou Nelder-Mead, voir + [Nelder]_). Il est conseillé de conserver la valeur par défaut. Remarque : + la méthode par défaut "POWELL" effectue une optimisation par boucles + imbriquées interne/externe, conduisant ainsi à un contrôle relaché du nombre + d'évaluations de la fonctionnelle à optimiser. Si un contrôle précis du + nombre d'évaluations de cette fonctionnelle est requis, il faut choisir le + "SIMPLEX". Exemple : ``{"Minimizer":"POWELL"}`` diff --git a/src/daComposant/daAlgorithms/DerivativeFreeOptimization.py b/src/daComposant/daAlgorithms/DerivativeFreeOptimization.py index 1981276..d66bff0 100644 --- a/src/daComposant/daAlgorithms/DerivativeFreeOptimization.py +++ b/src/daComposant/daAlgorithms/DerivativeFreeOptimization.py @@ -46,7 +46,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): name = "MaximumNumberOfFunctionEvaluations", default = 15000, typecast = int, - message = "Nombre maximal de d'évaluations de la function", + message = "Nombre maximal de d'évaluations de la fonction", minval = -1, ) self.defineRequiredParameter( diff --git a/src/daSalome/daGUI/daGuiImpl/adaoCase.py b/src/daSalome/daGUI/daGuiImpl/adaoCase.py index f180bc2..418d5ec 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoCase.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoCase.py @@ -77,8 +77,9 @@ class AdaoCase: self.eficas_editor.saveFile() filename = self.filename[:self.filename.rfind(".")] + '.py' if not os.path.exists(filename): - msg = "Cannot find the COMM associated python file for YACS\n" - msg += "generation. Is your case correct?\n" + msg = "Cannot find the COMM/PY associated EFICAS/Python files for YACS\n" + msg += "generation. Is your case correct? Try to close and re-open the\n" + msg += "case with the ADAO/EFICAS editor." return msg if not os.environ.has_key("ADAO_ROOT_DIR"): @@ -91,7 +92,7 @@ class AdaoCase: (stdoutdata, stderrdata) = p.communicate() if not os.path.exists(self.yacs_filename): msg = "An error occured during the execution of the ADAO YACS Schema\n" - msg += "Creator. If SALOME is launched by command line, see errors\n" + msg += "Creator. If SALOME GUI is launched by command line, see errors\n" msg += "details in your terminal.\n" return msg return rtn @@ -111,3 +112,10 @@ class AdaoCase: msg += traceback.format_exc() return msg return rtn + + def validationReportforJDC(self): + rtn = "Validation report is empty." + if self.eficas_editor.jdc: + rtn = u"Validation report for the selected ADAO case:\n\n" + rtn += unicode( self.eficas_editor.jdc.report()) + return rtn diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py index 2071ff5..86647b4 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py @@ -30,21 +30,29 @@ __sgPyQt = SalomePyQt.SalomePyQt() import adaoModuleHelper from daUtils.qtversion import useQT5 if useQT5: - from PyQt5 import QtGui,QtCore + from PyQt5 import QtGui, QtCore + from PyQt5.QtWidgets import QApplication, QMessageBox else: - from PyQt4 import QtGui,QtCore + from PyQt4 import QtGui, QtCore + from PyQt4.QtGui import QApplication, QMessageBox def waitCursor(): QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) def restoreCursor(): - QtGui.QApplication.restoreOverrideCursor() + QApplication.restoreOverrideCursor() def gui_warning(parent, msg="An error occurs" ): """ This function displays a message dialog box displaying the specified message. """ - QtGui.QMessageBox.warning( parent, "Alerte", msg) + QMessageBox.warning( parent, "Alerte", msg) + +def gui_information(parent, msg="Information" ): + """ + This function displays a message dialog box displaying the specified message. + """ + QMessageBox.information( parent, "Information", msg, QMessageBox.Close) def getActiveStudyId(): """ @@ -120,3 +128,9 @@ def warning(msg): This function displays a message dialog box displaying the specified message. """ gui_warning(getDesktop(),msg) + +def information(msg): + """ + This function displays a message dialog box displaying the specified message. + """ + gui_information(getDesktop(),msg) diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py index 481406a..c44f064 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py @@ -62,6 +62,7 @@ UI_ELT_IDS = Enumerate([ 'OPEN_ADAOCASE_ID', 'SAVE_ADAOCASE_ID', 'SAVE_AS_ADAOCASE_ID', + 'VALIDATE_ADAOCASE_ID', 'CLOSE_ADAOCASE_ID', 'YACS_EXPORT_ID', ],offset=6950) @@ -71,6 +72,7 @@ ACTIONS_MAP={ UI_ELT_IDS.OPEN_ADAOCASE_ID:"openAdaoCase", UI_ELT_IDS.SAVE_ADAOCASE_ID:"saveAdaoCase", UI_ELT_IDS.SAVE_AS_ADAOCASE_ID:"saveasAdaoCase", + UI_ELT_IDS.VALIDATE_ADAOCASE_ID:"validateAdaoCase", UI_ELT_IDS.CLOSE_ADAOCASE_ID:"closeAdaoCase", UI_ELT_IDS.YACS_EXPORT_ID:"exportCaseToYACS", } @@ -304,10 +306,27 @@ class AdaoCaseManager(EficasObserver): # Refresh GUI -> appelle currentSelectionChanged() adaoGuiHelper.refreshObjectBrowser() +####### +# +# Gestion de la validation d'un cas +# 1: la fonction validateAdaoCase est appelee par le GUI SALOME +# +####### + + def validateAdaoCase(self): + adaoLogger.debug("Validation du cas par un rapport sur le JDC") + self.harmonizeSelectionFromEficas() + salomeStudyItem = adaoGuiHelper.getSelectedItem() + for case_name, adao_case in self.cases.iteritems(): + if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + msg = adao_case.validationReportforJDC() + adaoGuiHelper.gui_information(SalomePyQt.SalomePyQt().getDesktop(), msg) + break + ####### # # Gestion de la connexion avec YACS -# 1: la fonction exportCasToYACS exporte l'etude vers YACS +# 1: la fonction exportCaseToYACS exporte l'etude vers YACS # ####### def exportCaseToYACS(self): @@ -402,6 +421,9 @@ class AdaoGuiUiComponentBuilder: a = sgPyQt.createAction( UI_ELT_IDS.SAVE_AS_ADAOCASE_ID, "Save as case", "Save as case", "Save an ADAO case as", "eficas_saveas.png" ) sgPyQt.createMenu(a, mid) sgPyQt.createTool(a, tid) + a = sgPyQt.createAction( UI_ELT_IDS.VALIDATE_ADAOCASE_ID, "Validate case", "Validate case", "Validate an ADAO case", "eficas_valid.png" ) + sgPyQt.createMenu(a, mid) + sgPyQt.createTool(a, tid) a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close case", "Close case", "Close an ADAO case", "eficas_close.png" ) sgPyQt.createMenu(a, mid) sgPyQt.createTool(a, tid)