We describe an object-oriented approach to implementing optimization software in C++, and in particular an adaptation of Hager and Zhang's CG\_Descent bound-constrained conjugate gradient solver. The goal is to allow the fundamental algorithm to be expressed almost as concisely and naturally as in MATLAB, but with efficient execution both in serial and in parallel, adaptable to different applications and parallel hardware environments. The idea is that the same simple code base may be used both serially and in a variety of parallel applications, without sacrificing efficiency. We describe our use of object-oriented design and operator overloading to attain this design goal, with minimal run-time overhead and avoiding creation of unnecessary temporary vectors. We also describe how the bound-constrained implementation will be incorporated into a more general-purpose solver allowing general nonlinear constraints, using an approximate augmented Lagrangian algorithm. |