Xmipp  v3.23.11-Nereus
CTRSSolver.cpp
Go to the documentation of this file.
1 /*
2 
3 CONDOR 1.06 - COnstrained, Non-linear, Direct, parallel Optimization
4  using trust Region method for high-computing load,
5  noisy functions
6 Copyright (C) 2004 Frank Vanden Berghen
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation version 2
11 of the License.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 
22 If you want to include this tools in any commercial product,
23 you can contact the author at fvandenb@iridia.ulb.ac.be
24 
25 */
26 
27 #include <stdio.h>
28 #include <memory.h>
29 
30 //#include <crtdbg.h>
31 
32 #include "ObjectiveFunction.h"
33 #include "Matrix.h"
34 #include "IntPoly.h"
35 #include "tools.h"
36 #include "VectorChar.h"
37 
39 
40 // from QPsolver:
41 void simpleQPSolve(Matrix mH, Vector vG, Matrix mA, Vector vB, // in
42  Vector vP, Vector vLambda, int *info); // out
43 void restartSimpleQPSolve(Vector vBO, // in
44  Vector vP); // out
45 
46 // from TRSSolver:
48  int *infoOut=NULL, int maxIter=1000, double *lambda1=NULL);
49 Vector L2NormMinimizer(Polynomial q, Vector pointXk, double delta,
50  int *infoOut=NULL, int maxIter=1000, double *lambda1=NULL);
51 Vector L2NormMinimizer(Polynomial q, Vector pointXk, double delta,
52  int *infoOut, int maxIter, double *lambda1, Vector minusG, Matrix H);
53 
54 
55 // from CTRSSolver:
56 char checkForTermination(Vector d, Vector Base, double rhoEnd){return 0;}
57 void initConstrainedStep(ObjectiveFunction *of){ FullLambda.setSize(0); }
58 
60  int *info, int iterMax, double *lambda1, Vector vOBase, ObjectiveFunction *of)
61 {
62  int dim=poly.dim();
63  Matrix mH(dim,dim);
64  Vector vG(dim);
65  poly.gradientHessian(poly.NewtonPoints[k],vG,mH);
66 
67  if (of->isConstrained)
68  printf("Limited version! Ignoring constraints !\n");
69  return L2NormMinimizer(poly, poly.NewtonPoints[k], delta, info, iterMax, lambda1, vG, mH);
70 
71 // return ConstrainedL2NormMinimizer(mH,vG,delta,info,iterMax,lambda1,vOBase+poly.NewtonPoints[k],of);
72 }
73 
75 {
76  vBase.copyFrom(vFrom);
77 }
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
Vector * NewtonPoints
Definition: IntPoly.h:47
Vector ConstrainedL2NormMinimizer(InterPolynomial poly, int k, double delta, int *info, int iterMax, double *lambda1, Vector vOBase, ObjectiveFunction *of)
Definition: CTRSSolver.cpp:59
void restartSimpleQPSolve(Vector vBO, Vector vP)
Definition: QPSolver.cpp:363
Definition: Vector.h:37
unsigned dim()
Definition: Poly.h:62
void simpleQPSolve(Matrix mH, Vector vG, Matrix mA, Vector vB, Vector vP, Vector vLambda, int *info)
Definition: QPSolver.cpp:105
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
doublereal * d
void setSize(int _n)
Definition: Vector.cpp:112
void gradientHessian(Vector P, Vector G, Matrix H)
Definition: Poly.cpp:515
void projectionIntoFeasibleSpace(Vector vFrom, Vector vBase, ObjectiveFunction *of)
Definition: CTRSSolver.cpp:74
Definition: Matrix.h:38
char checkForTermination(Vector d, Vector Base, double rhoEnd)
Definition: CTRSSolver.cpp:56
Vector FullLambda
Definition: CTRSSolver.cpp:38
void copyFrom(Vector r, int _n=0)
Definition: Vector.cpp:215
void initConstrainedStep(ObjectiveFunction *of)
Definition: CTRSSolver.cpp:57
Vector L2NormMinimizer(Polynomial q, double delta, int *infoOut=NULL, int maxIter=1000, double *lambda1=NULL)
Definition: UTRSSolver.cpp:307
double * delta