Package: occamypy
OccamyPy: an object-oriented optimization framework for small- and large-scale problemsWe present an object-oriented optimization framework that can be employed to solve
small- and large-scale problems based on the concept of vectors and operators.
By using such a strategy, we implement different iterative optimization algorithms
that can be used in combination with architecture-independent vectors and operators,
allowing the minimization of single-machine or cluster-based problems with a unique codebase.
We implement a Python library following the described structure with a user-friendly interface.
We demonstrate its flexibility and scalability on multiple inverse problems,
where convex and non-convex objective functions are optimized with different iterative algorithms.InstallationPreferred way is through Python Package Index:pipinstalloccamypyIn order to have Cupy-based vectors and operators, you should install alsoCupyandcuSIGNAL.
They are not included in this installation as they are dependent on the target CUDA device and compiler.As this library strongly relies on Numpy, we suggest installing OccamyPy in a conda environment likethis.HistoryThis library was initially developed atStanford Exploration Projectfor solving large scale seismic problems.
Inspired by Equinor'sPyLopswe publish this library as our contribution to scientific community.How it worksThis framework allows for the definition of linear and non-linear mapping functions that
operate on abstract vector objects that can be defined to use
heterogeneous computational resources, from personal laptops to HPC environments.vectorclass: this is the building block for handling data. It contains the required
mathematical operations such as norm, scaling, dot-product, sum, point-wise multiplication.
These methods can be implemented using existing libraries (e.g., Numpy, Cupy, PyTorch) or
user-defined ones (e.g.,SEPLib).
See thevectorsubpackage for details and implementations.operatorclass: a mapping function between adomainvector and arangevector.
It  can be linear and non-linear.
Linear operators require the definition of both the forward and adjoint functions;
non-linear operators require the forward mapping and its Jacobian operator.
See theoperatorsubpackage for details and implementations.problemclass: it represents the objective function related to  an optimization problem.
Defined upon operators (e.g., modeling and regularization) and vectors (observed data, priors).
It contains the methods for objective function and gradient computation, as our solvers are mainly gradient based.
See theproblemsubpackage for details and implementations.solverclass: it aims at finding the solution to a problem by employing methods
defined within the vector, operator and problem classes.
Additionally, it allows to restart an optimization method from an intermetdiate result
written as serialized objects on permanent computer memory.
We have a number of linear and nonlinear solver, along with some stepper algorithms.
See thesolversubpackage for details and implementations.Features at a glancevector enginesoperatorsproblemssolversnumpylinearleast squaresConjugate Gradientcupynonlinearsymmetric least squaresSteepest DescenttorchdistributedL2-reg least squaresLSQRLASSOsymmetric Conjugate Gradientgeneralized LASSOnonlinear Conjugate Gradientnonlinear least squaresL-BFGSL2-reg nonlinear least squaresL-BFGS-Bregularized Variable ProjectionTruncated NewtonMarkov Chain Monte CarloISTA and Fast-ISTAISTC (ISTA with cooling)Split-BregmanScalabilityThe main objective of the described framework and implemented library is to solve large-scale inverse problems.
Any vector and operator can be split into blocks to be distributed to multiple nodes.
This is achieved via customDaskvector and operator classes.
See thedasksubpackage for details and implementations.TutorialsWe provide sometutorialsthat demonstrate the flexibility of occamypy.
Please refer to them as a good starting point for developing your own code.
If you have a good application example, contact us! We will be happy to see OccamyPy in action.Check out thetutorialwe gave at SWUNG's Transform 2022!ContributingFollow the following instructions and read carefully theCONTRIBUTINGfile before getting started.AuthorsEttore BiondiGuillame BarnierRobert ClappFrancesco PicettiStuart FarrisCitation@article{biondi2021object,
  title = {An object-oriented optimization framework for large-scale inverse problems},
  author = {Ettore Biondi and Guillaume Barnier and Robert G. Clapp and Francesco Picetti and Stuart Farris},
  journal = {Computers & Geosciences},
  volume = {154},
  pages = {104790},
  year = {2021},
  doi = {https://doi.org/10.1016/j.cageo.2021.104790},
}