Feature #1471

GOptimizer::status() and iter() missing from GOptimizerLM

Added by Kelley-Hoskins Nathan almost 9 years ago. Updated almost 9 years ago.

Status:ClosedStart date:06/02/2015
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.0.0
Duration:

Description

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.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen almost 9 years ago

Can you explain a bit more what your problem is?

GOptimizer has indeed the virtual methods status() and iter(), and both a implemented in GOptimizerLM (both return int values). GOptimizerLM is in fact the only optimizer that exists so far, hence this is the only class that derives from GOptimizer.

#2 Updated by Kelley-Hoskins Nathan almost 9 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 almost 9 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 GOptimizerLM.hpp.

#4 Updated by Knödlseder Jürgen almost 9 years ago

The above lines do in fact not work as without running ctlike no optimizer object is allocated, hence ctike.opt() returns None. You have the run ctlike first and then will get the optimizer, including its methods.

#5 Updated by Mayer Michael almost 9 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 almost 9 years ago

I think that would work fine.

#7 Updated by Knödlseder Jürgen almost 9 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 almost 9 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 init_members() method).

Also available in: Atom PDF