GOptimizer::status() and iter() missing from GOptimizerLM
|Assigned To:||Knödlseder Jürgen||% Done:|
I’m not sure if this is by design, but I think the GOptimizer virtual methods status() and iter() are in $GAMMALIB/include/GOptimizer.hpp, but aren’t coded into classes that inherit from GOptimizer. I’ve been trying to diagnose weird ctlike results, but some fancy regexs are needed to extract basic convergence information from the log files.
#1 Updated by Knödlseder Jürgen about 8 years ago
Can you explain a bit more what your problem is?
GOptimizer has indeed the virtual methods
iter(), and both a implemented in
GOptimizerLM (both return
GOptimizerLM is in fact the only optimizer that exists so far, hence this is the only class that derives from
#2 Updated by Kelley-Hoskins Nathan about 8 years ago
I went looking around OptimizerLM.cpp, but didn’t find them, and wasn’t sure how to get from a ctlike object to the optimizer:
import ctools like = ctools.ctlike() like.opt().status() # ??? like.opt().inter() # ???
#3 Updated by Mayer Michael about 8 years ago
These methods seem to be available in my version. Since these are
inline-methods, you won’t find them in
GOptimizerLM.cpp but in
#4 Updated by Knödlseder Jürgen about 8 years ago
The above lines do in fact not work as without running
ctlike no optimizer object is allocated, hence
None. You have the run
ctlike first and then will get the optimizer, including its methods.
#5 Updated by Mayer Michael about 8 years ago
Ok. Would it make sense to already allocate an empty
GOptimizerLM object in
ctlike::init_members() instead of a null pointer?
#6 Updated by Kelley-Hoskins Nathan about 8 years ago
I think that would work fine.
#7 Updated by Knödlseder Jürgen about 8 years ago
- Status changed from New to In Progress
- Assigned To set to Knödlseder Jürgen
- Target version set to 1.0.0
- % Done changed from 0 to 10
I agree. I’m working on that (needs in fact a small change to GammaLib).
#8 Updated by Knödlseder Jürgen about 8 years ago
- Status changed from In Progress to Closed
- % Done changed from 10 to 100
I added a
logger() method to
GOptimizerLM to allow setting of the logger and I changed the logger constructor so that a pointer to a logger is passed instead of a reference. This allows to set also a NULL logger, which means that the optimizer is not logging.
An optimizer object of type
GOptimizerLM is now allocated in the
ctlike constructor (through the