EstervQrCode 2.0.0
Library for qr code manipulation
Loading...
Searching...
No Matches
optim.hpp
1/*M///////////////////////////////////////////////////////////////////////////////////////
2//
3// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4//
5// By downloading, copying, installing or using the software you agree to this license.
6// If you do not agree to this license, do not download, install,
7// copy or use the software.
8//
9//
10// License Agreement
11// For Open Source Computer Vision Library
12//
13// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
14// Third party copyrights are property of their respective owners.
15//
16// Redistribution and use in source and binary forms, with or without modification,
17// are permitted provided that the following conditions are met:
18//
19// * Redistribution's of source code must retain the above copyright notice,
20// this list of conditions and the following disclaimer.
21//
22// * Redistribution's in binary form must reproduce the above copyright notice,
23// this list of conditions and the following disclaimer in the documentation
24// and/or other materials provided with the distribution.
25//
26// * The name of the copyright holders may not be used to endorse or promote products
27// derived from this software without specific prior written permission.
28//
29// This software is provided by the copyright holders and contributors "as is" and
30// any express or implied warranties, including, but not limited to, the implied
31// warranties of merchantability and fitness for a particular purpose are disclaimed.
32// In no event shall the OpenCV Foundation or contributors be liable for any direct,
33// indirect, incidental, special, exemplary, or consequential damages
34// (including, but not limited to, procurement of substitute goods or services;
35// loss of use, data, or profits; or business interruption) however caused
36// and on any theory of liability, whether in contract, strict liability,
37// or tort (including negligence or otherwise) arising in any way out of
38// the use of this software, even if advised of the possibility of such damage.
39//
40//M*/
41
42#ifndef OPENCV_OPTIM_HPP
43#define OPENCV_OPTIM_HPP
44
45#include "opencv2/core.hpp"
46
47namespace cv
48{
49
59{
60public:
64 {
65 public:
66 virtual ~Function() {}
67 virtual int getDims() const = 0;
68 virtual double getGradientEps() const;
69 virtual double calc(const double* x) const = 0;
70 virtual void getGradient(const double* x,double* grad);
71 };
72
81 virtual Ptr<Function> getFunction() const = 0;
82
89 virtual void setFunction(const Ptr<Function>& f) = 0;
90
95 virtual TermCriteria getTermCriteria() const = 0;
96
108 virtual void setTermCriteria(const TermCriteria& termcrit) = 0;
109
122 virtual double minimize(InputOutputArray x) = 0;
123};
124
156{
157public:
164 virtual void getInitStep(OutputArray step) const=0;
165
180 virtual void setInitStep(InputArray step)=0;
181
199 InputArray initStep=Mat_<double>(1,1,0.0),
200 TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
201};
202
237{
238public:
253 TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
254};
255
265
298CV_EXPORTS_W int solveLP(InputArray Func, InputArray Constr, OutputArray z, double constr_eps);
299
302
304
305}// cv
306
307#endif
This is a base class for all more or less complex algorithms in OpenCV.
Definition core.hpp:3197
This class is used to perform the non-linear non-constrained minimization of a function with known gr...
Definition optim.hpp:237
static Ptr< ConjGradSolver > create(const Ptr< MinProblemSolver::Function > &f=Ptr< ConjGradSolver::Function >(), TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS, 5000, 0.000001))
This function returns the reference to the ready-to-use ConjGradSolver object.
This class is used to perform the non-linear non-constrained minimization of a function,...
Definition optim.hpp:156
static Ptr< DownhillSolver > create(const Ptr< MinProblemSolver::Function > &f=Ptr< MinProblemSolver::Function >(), InputArray initStep=Mat_< double >(1, 1, 0.0), TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS, 5000, 0.000001))
This function returns the reference to the ready-to-use DownhillSolver object.
virtual void getInitStep(OutputArray step) const =0
Returns the initial step that will be used in downhill simplex algorithm.
virtual void setInitStep(InputArray step)=0
Sets the initial step that will be used in downhill simplex algorithm.
Template matrix class derived from Mat.
Definition mat.hpp:2230
Represents function being optimized.
Definition optim.hpp:64
virtual void getGradient(const double *x, double *grad)
virtual double calc(const double *x) const =0
virtual ~Function()
Definition optim.hpp:66
virtual double getGradientEps() const
virtual int getDims() const =0
Basic interface for all solvers.
Definition optim.hpp:59
virtual void setFunction(const Ptr< Function > &f)=0
Setter for the optimized function.
virtual Ptr< Function > getFunction() const =0
Getter for the optimized function.
virtual TermCriteria getTermCriteria() const =0
Getter for the previously set terminal criteria for this algorithm.
virtual void setTermCriteria(const TermCriteria &termcrit)=0
Set terminal criteria for solver.
virtual double minimize(InputOutputArray x)=0
actually runs the algorithm and performs the minimization.
The class defining termination criteria for iterative algorithms.
Definition types.hpp:886
Definition mat.hpp:387
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition mat.hpp:296
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition mat.hpp:442
void int step
Definition core_c.h:905
const CvArr CvArr * x
Definition core_c.h:1195
int CvArr CvTermCriteria termcrit
Definition core_c.h:1927
CV_EXPORTS_W int solveLP(InputArray Func, InputArray Constr, OutputArray z, double constr_eps)
Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).
SolveLPResult
return codes for cv::solveLP() function
Definition optim.hpp:258
@ SOLVELP_SINGLE
there is only one maximum for target function
Definition optim.hpp:262
@ SOLVELP_UNBOUNDED
problem is unbounded (target function can achieve arbitrary high values)
Definition optim.hpp:260
@ SOLVELP_LOST
problem is feasible, but solver lost solution due to floating-point arithmetic errors
Definition optim.hpp:259
@ SOLVELP_MULTI
there are multiple maxima for target function - the arbitrary one is returned
Definition optim.hpp:263
@ SOLVELP_UNFEASIBLE
problem is unfeasible (there are no points that satisfy all the constraints imposed)
Definition optim.hpp:261
#define CV_EXPORTS
Definition cvdef.h:435
#define CV_EXPORTS_W
Definition cvdef.h:472
"black box" representation of the file storage associated with a file on disk.
Definition calib3d.hpp:441
Definition cvstd_wrapper.hpp:74