From 9ac42e65cadf6000078cc853997e482b548f90db Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 5 Apr 2017 16:53:21 +0200 Subject: [PATCH] Documentation and source minor corrections --- ...ef_algorithm_DerivativeFreeOptimization.rst | 9 +++++++++ ...ef_algorithm_DerivativeFreeOptimization.rst | 10 ++++++++++ src/daComposant/daCore/ExtendedLogging.py | 18 +++++++++++++----- src/daComposant/daCore/PlatformInfo.py | 7 +++++-- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/doc/en/ref_algorithm_DerivativeFreeOptimization.rst b/doc/en/ref_algorithm_DerivativeFreeOptimization.rst index c2c5072..7898082 100644 --- a/doc/en/ref_algorithm_DerivativeFreeOptimization.rst +++ b/doc/en/ref_algorithm_DerivativeFreeOptimization.rst @@ -123,6 +123,15 @@ The options of the algorithm are the following: Example : ``{"Minimizer":"BOBYQA"}`` + Bounds + This key allows to define upper and lower bounds for every state variable + being optimized. Bounds have to be given by a list of list of pairs of + lower/upper bounds for each variable, with possibly ``None`` every time + there is no bound. The bounds can always be specified, but they are taken + into account only by the constrained optimizers. + + Example : ``{"Bounds":[[2.,5.],[1.e-2,10.],[-30.,None],[None,None]]}`` + MaximumNumberOfSteps This key indicates the maximum number of iterations allowed for iterative optimization. The default is 15000, which is very similar to no limit on diff --git a/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst b/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst index 74def65..aafe52f 100644 --- a/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst +++ b/doc/fr/ref_algorithm_DerivativeFreeOptimization.rst @@ -126,6 +126,16 @@ Les options de l'algorithme sont les suivantes: Exemple : ``{"Minimizer":"BOBYQA"}`` + Bounds + Cette clé permet de définir des bornes supérieure et inférieure pour chaque + variable d'état optimisée. Les bornes doivent être données par une liste de + liste de paires de bornes inférieure/supérieure pour chaque variable, avec + une valeur ``None`` chaque fois qu'il n'y a pas de borne. Les bornes peuvent + toujours être spécifiées, mais seuls les optimiseurs sous contraintes les + prennent en compte. + + Exemple : ``{"Bounds":[[2.,5.],[1.e-2,10.],[-30.,None],[None,None]]}`` + MaximumNumberOfSteps Cette clé indique le nombre maximum d'itérations possibles en optimisation itérative. Le défaut est 15000, qui est une limite arbitraire. Il est ainsi diff --git a/src/daComposant/daCore/ExtendedLogging.py b/src/daComposant/daCore/ExtendedLogging.py index a3bbf22..8ed4948 100644 --- a/src/daComposant/daCore/ExtendedLogging.py +++ b/src/daComposant/daCore/ExtendedLogging.py @@ -102,12 +102,20 @@ class ExtendedLogging(object): p = PlatformInfo.PlatformInfo() # logging.info( "--------------------------------------------------" ) - logging.info( "Lancement de "+p.getName()+" "+p.getVersion() ) + logging.info( p.getName()+" version "+p.getVersion() ) logging.info( "--------------------------------------------------" ) - logging.info( "Versions logicielles :" ) - logging.info( "- Python "+p.getPythonVersion() ) - logging.info( "- Numpy "+p.getNumpyVersion() ) - logging.info( "- Scipy "+p.getScipyVersion() ) + logging.info( "Library availability:" ) + logging.info( "- Python.......: True" ) + logging.info( "- Numpy........: True" ) + logging.info( "- Scipy........: "+str(PlatformInfo.has_scipy) ) + logging.info( "- Matplotlib...: "+str(PlatformInfo.has_matplotlib) ) + logging.info( "- Gnuplot......: "+str(PlatformInfo.has_scipy) ) + logging.info( "- Sphinx.......: "+str(PlatformInfo.has_sphinx) ) + logging.info( "- Nlopt........: "+str(PlatformInfo.has_nlopt) ) + logging.info( "Library versions:" ) + logging.info( "- Python.......:"+p.getPythonVersion() ) + logging.info( "- Numpy........:"+p.getNumpyVersion() ) + logging.info( "- Scipy........:"+p.getScipyVersion() ) logging.info( "" ) def setLogfile(self, filename=LOGFILE, filemode="w", level=logging.NOTSET): diff --git a/src/daComposant/daCore/PlatformInfo.py b/src/daComposant/daCore/PlatformInfo.py index 1ab3a7e..f14654e 100644 --- a/src/daComposant/daCore/PlatformInfo.py +++ b/src/daComposant/daCore/PlatformInfo.py @@ -76,8 +76,11 @@ class PlatformInfo(object): def getScipyVersion(self): "Retourne la version de scipy disponible" - import scipy.version - return scipy.version.version + try: + import scipy.version + return scipy.version.version + except ImportError: + return "0.0.0" def getMatplotlibVersion(self): "Retourne la version de matplotlib disponible" -- 2.39.2