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
26namespace dolfin
27{
28
29 // Forward declarations
30 class GenericMatrix;
31 class GenericVector;
32
37
39 {
40 public:
41
44
47
49 virtual double f(const GenericVector& x) = 0;
50
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
This class defines a common interface for matrices.
Definition: GenericMatrix.h:47
This class defines a common interface for vectors.
Definition: GenericVector.h:48
Definition: NonlinearProblem.h:37
Definition: OptimisationProblem.h:39
virtual void J(GenericMatrix &A, const GenericVector &x)=0
Compute the Hessian :math:‘J(x) = f’'(x)`.
virtual void F(GenericVector &b, const GenericVector &x)=0
Compute the gradient :math:‘F(x) = f’(x)`.
OptimisationProblem()
Constructor.
Definition: OptimisationProblem.h:43
virtual void form(GenericMatrix &A, GenericMatrix &P, GenericVector &b, const GenericVector &x)
Definition: OptimisationProblem.h:54
virtual void J_pc(GenericMatrix &P, const GenericVector &x)
Definition: OptimisationProblem.h:73
virtual double f(const GenericVector &x)=0
Compute the objective function :math:f(x)
virtual ~OptimisationProblem()
Destructor.
Definition: OptimisationProblem.h:46
Definition: adapt.h:30