Optimo  0.1.0
A C++ header library for optimization
 All Classes Functions Variables Pages
solver.h
1 // Copyright (C) 2014 Victor Fragoso <vfragoso@cs.ucsb.edu>
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 //
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following
13 // disclaimer in the documentation and/or other materials provided
14 // with the distribution.
15 //
16 // * Neither the name of the University of California, Santa Barbara nor the
17 // names of its contributors may be used to endorse or promote products
18 // derived from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 // ARE DISCLAIMED. IN NO EVENT SHALL VICTOR FRAGOSO BE LIABLE FOR ANY DIRECT,
24 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 //
31 
32 #ifndef OPTIMO_SOLVERS_SOLVER_H_
33 #define OPTIMO_SOLVERS_SOLVER_H_
34 namespace optimo {
35 namespace solvers {
36 
38 enum TERMINATION_TYPE {
39  SOLVED = 0, //< Solver succesfully solved the problem
40  FAIL_NAN_INF = 1, //< Solver encountered NaN/Inf
41  MAX_ITERATIONS = 2, //< Solver reached max. number of iterations
42  NOT_SOLVED = 3, //< Solver could not solve problem
43  // Params used to map the SuiteSparse return types for sparse-matrix
44  // based solvers.
45  INVALID_ARGUMENTS = 4, //< Solver received invalid arguments/parameters
46  NUMERICAL_ISSUE = 5, //< Solver encountered a numerical issue
47  NO_CONVERGENCE = 6, //< Solver did not converge
48  INFEASIBLE_STARTING_POINT = 7 //< Starting point is infeasible
49 };
50 
52 template <typename Scalar>
53 class Solver {
54  public:
56  struct Options {
57  // Line search params (backtracking params)
58  Scalar alpha_ = 0.01;
59  Scalar beta_ = 0.5;
60  // Primal dual and Newton params
61  Scalar mu_ = 10;
62  Scalar eps_feas_ = 1e-8;
63  Scalar epsilon_ = 1e-6;
64  uint max_iter_ = 1000;
65  } options;
66 };
67 } // solvers
68 } // optimo
69 #endif // OPTIMO_SOLVERS_SOLVER_H_
Abstract class for a Solver algorithm.
Definition: solver.h:53
Scalar eps_feas_
Tolerance for primal dual residuals.
Definition: solver.h:62
Scalar epsilon_
Tolerance.
Definition: solver.h:63
Scalar mu_
For primal dual computation.
Definition: solver.h:61
uint max_iter_
Maximum number of iterations.
Definition: solver.h:64
struct optimo::solvers::Solver::Options options
Solver parameters.
Scalar alpha_
Backtracking (Line search) parameter.
Definition: solver.h:58
Various parameters for line search and tolerances.
Definition: solver.h:56
Scalar beta_
Backtracking (line search) parameter.
Definition: solver.h:59