OpenPisco.Optim.Problems.ProblemFactory module#

Factory for handling problems

OpenPisco.Optim.Problems.ProblemFactory.CheckIntegrity()[source]#
OpenPisco.Optim.Problems.ProblemFactory.Create(name: str, ops: Optional[Dict] = None) OptimProblemBase[source]#

Create a instance of a class associated to the problem name. The class must have been registered first.

Parameters
  • name (str) – problem name to instantiate

  • ops (Optional[Dict], optional) – Parameters required by the problem, by default None

Returns

problem instance

Return type

OptimProblemBase

OpenPisco.Optim.Problems.ProblemFactory.CreateDerived(name: str, ops: Optional[Dict] = None) OptimProblemBase[source]#
OpenPisco.Optim.Problems.ProblemFactory.InitAllProblems()[source]#

In order to initialize the problem factory, all the modules calling the ‘RegisterClass’ function must be imported here

class OpenPisco.Optim.Problems.ProblemFactory.ProblemFactory[source]#

Bases: Factory

OpenPisco.Optim.Problems.ProblemFactory.RegisterClass(name: str, classtype: Type[T], constructor: Optional[Callable] = None, withError: bool = True)[source]#

Allow to save a mapping between a problem name and the associated operation.

Parameters
  • name (str) – Problem name

  • classtype (Type[T]) – Operation associated to the problem name

  • constructor (Optional[Callable], optional) – Constructor associated to the operation, by default None

  • withError (bool, optional) – if false then the user can override an existent class/constructor , by default True