Source code for pysit.objective_functions.objective_function

from __future__ import absolute_import

from pysit.util.parallel import ParallelWrapShotNull

__all__ = ['ObjectiveFunctionBase']

__docformat__ = "restructuredtext en"

[docs]class ObjectiveFunctionBase(object): def __init__(self, solver, parallel_wrap_shot=ParallelWrapShotNull()): self.solver = solver self.modeling_tools = None self.parallel_wrap_shot = parallel_wrap_shot
[docs] def use_parallel(self): return self.parallel_wrap_shot.use_parallel # or self.parallem_wrap_solver.useparallel etc
[docs] def evaluate(self, *args, **kwargs): raise NotImplementedError("Must be implemented by subclass.")
[docs] def compute_gradient(self, *args, **kwargs): raise NotImplementedError("Must be implemented by subclass.")
[docs] def apply_hessian(self, operand, *args, **kwargs): raise NotImplementedError("Must be implemented by subclass.")