DOLFIN
DOLFIN C++ interface
OptimisationProblem.h
1 // Copyright (C) 2014 Tianyi Li
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // First added: 2014-06-22
19 // Last changed: 2014-07-19
20 
21 #ifndef __OPTIMISATION_PROBLEM_H
22 #define __OPTIMISATION_PROBLEM_H
23 
24 #include "NonlinearProblem.h"
25 
26 namespace dolfin
27 {
28 
29  // Forward declarations
30  class GenericMatrix;
31  class GenericVector;
32 
37 
39  {
40  public:
41 
44 
46  virtual ~OptimisationProblem() {}
47 
49  virtual double f(const GenericVector& x) = 0;
50 
54  virtual void form(GenericMatrix& A, GenericMatrix& P, GenericVector& b,
55  const GenericVector& x)
56  {
57  // Do nothing if not supplied by the user
58  }
59 
61  virtual void F(GenericVector& b, const GenericVector& x) = 0;
62 
64  virtual void J(GenericMatrix& A, const GenericVector& x) = 0;
65 
73  virtual void J_pc(GenericMatrix& P, const GenericVector& x)
74  {
75  // Do nothing if not supplied by the user
76  }
77 
78  };
79 
80 }
81 
82 #endif
OptimisationProblem()
Constructor.
Definition: OptimisationProblem.h:43
Definition: adapt.h:29
virtual void F(GenericVector &b, const GenericVector &x)=0
Compute the gradient :math:`F(x) = f&#39;(x)`.
virtual double f(const GenericVector &x)=0
Compute the objective function :math:f(x)
Definition: NonlinearProblem.h:36
This class defines a common interface for matrices.
Definition: GenericMatrix.h:46
virtual void J(GenericMatrix &A, const GenericVector &x)=0
Compute the Hessian :math:`J(x) = f&#39;&#39;(x)`.
virtual void J_pc(GenericMatrix &P, const GenericVector &x)
Definition: OptimisationProblem.h:73
virtual void form(GenericMatrix &A, GenericMatrix &P, GenericVector &b, const GenericVector &x)
Definition: OptimisationProblem.h:54
virtual ~OptimisationProblem()
Destructor.
Definition: OptimisationProblem.h:46
This class defines a common interface for vectors.
Definition: GenericVector.h:47
Definition: OptimisationProblem.h:38