Scarcity of hydrocarbon resources and high exploration risks motivate the development of high fidelity algorithms and computationally viable approaches to exploratory geophysics. Inverse problem formulations for large scale imaging and full waveform inversion have proven very valuable over the past two decades. While initial approaches considered minimizing least squares, recent developments have emphasized the importance of robust formulations, as well as formulations that allow disciplined encoding of prior information into the inverse problem formulation. We propose a generic, flexible optimization framework capable of incorporating a broad range of noise models, forward models, regularizers, and reparametrization transforms. This framework covers seamlessly robust noise models (such as Huber and student's t), as well as sparse regularizers, projected constraints, and Total Variation regularization. The framework is also expandable - we explain the adjustments that are required for any new formulation to be included. We conclude with few numerical examples demonstrating the versatility of the formulation.