Preparation for pull request
authorAlex Leontiev <alozz1991@gmail.com>
Thu, 11 Jul 2013 06:31:10 +0000 (09:31 +0300)
committerAlex Leontiev <alozz1991@gmail.com>
Thu, 11 Jul 2013 06:31:10 +0000 (09:31 +0300)
Additional cleaning for simplex method, removing the parts that are
currently unused. Removing developer's notes. Trying to reach production
level.

modules/optim/include/opencv2/optim.hpp
modules/optim/src/lpsolver.cpp
modules/optim/test/test_lpsolver.cpp

index f40456c..a50af74 100644 (file)
 
 namespace cv{namespace optim
 {
-//! generic class for optimization algorithms */
-class CV_EXPORTS Solver : public Algorithm /* Algorithm is the base OpenCV class */
-{
-    public:
-    class CV_EXPORTS Function
-    {
-    public:
-        virtual ~Function(){}
-        virtual double calc(InputArray args) const = 0;
-    };
-    class CV_EXPORTS Constraints
-    {
-    public:
-        virtual ~Constraints(){}
-    };
-
-    //! could be reused for all the generic algorithms like downhill simplex. Return value is the maximum value of a function*/
-    virtual double solve(const Function& F,const Constraints& C, OutputArray result) const = 0;
-
-    /*virtual void setTermCriteria(const TermCriteria& criteria) = 0;
-    virtual TermCriteria getTermCriteria() = 0;*/
-
-    // more detailed API to be defined later ...
-};
-
-class CV_EXPORTS LPSolver : public Solver
-{
-public:
-    class CV_EXPORTS LPFunction:public Solver::Function
-    {
-        Mat z;
-    public:
-        //! Note, that this class is supposed to be immutable, so it's ok to make only a shallow copy of z_in.*/
-        LPFunction(Mat z_in):z(z_in){}
-        ~LPFunction(){};
-        const Mat& getz()const{return z;}
-        double calc(InputArray args)const;
-    };
-
-    //!This class represents constraints for linear problem. There are two matrix stored: m-by-n matrix A and n-by-1 column-vector b.
-    //!What this represents is the set of constraints Ax\leq b and x\geq 0. It can be shown that any set of linear constraints can be converted
-    //!this form and **we shall create various constructors for this class that will perform these conversions**.
-    class CV_EXPORTS LPConstraints:public Solver::Constraints
-    {
-        Mat A,b;
-    public:
-        ~LPConstraints(){};
-        //! Note, that this class is supposed to be immutable, so it's ok to make only a shallow copy of A_in and b_in.*/
-        LPConstraints(Mat A_in, Mat b_in):A(A_in),b(b_in){}
-        const Mat& getA()const{return A;}
-        const Mat& getb()const{return b;}
-    };
-
-    LPSolver(){}
-    double solve(const Function& F,const Constraints& C, OutputArray result)const;
-};
-
 //!the return codes for solveLP() function
 enum
 {
index 1e80dfa..a0bece3 100644 (file)
@@ -16,16 +16,6 @@ const void dprintf(const char* format,...){
 #endif
 }
 
-double LPSolver::solve(const Function& F,const Constraints& C, OutputArray result)const{
-    return 0.0;
-}
-
-double LPSolver::LPFunction::calc(InputArray args)const{
-    dprintf("call to LPFunction::calc()\n");
-    return 0.0;
-}
-
-
 void const print_matrix(const Mat& X){
 #ifdef ALEX_DEBUG
     dprintf("\ttype:%d vs %d,\tsize: %d-on-%d\n",X.type(),CV_64FC1,X.rows,X.cols);
@@ -337,7 +327,3 @@ const inline void swap_columns(Mat_<double>& A,int col1,int col2){
     }
 }
 }}
-/*FIXME (possible optimizations)
- * use iterator-style (as in ddc0010e7... commit version of this file)
- * remove calls to pivot inside the while-loops
- */
index 8d14bf9..bcab3fa 100644 (file)
@@ -112,23 +112,3 @@ TEST(Optim_LpSolver, regression_cycling){
     //ASSERT_EQ(res,1);
     }
 }
-
-//TODO
-// get optimal solution from initial (0,0,...,0) - DONE
-// milestone: pass first test (wo initial solution) - DONE
-    //
-    // ??how_check_multiple_solutions & pass_test - DONE
-    // Blands_rule - DONE
-    // (assert, assign) - DONE
-    //
-    // (&1tests on cycling)
-    // make_more_clear
-    // wrap in OOP
-    //
-    // non-trivial tests
-    // pull-request
-    //
-    // study hill and other algos
-    //
-// ??how to get smallest l2 norm
-// FUTURE: compress&debug-> more_tests(Cormen) -> readNumRecipes-> fast&stable || hill_climbing