Newton equality constrained with feasible starting point
s.t.
where is convex and twice differentiable, and with , given a starting point with
Code example
Consider the following convex problem: with
// Objective function
ConvexMultivariateRealFunction objectiveFunction = new ConvexMultivariateRealFunction() {
public double value(DoubleMatrix1D X) {
double x = X.getQuick(0);
return x - Math.log(1-x*x);
}
public DoubleMatrix1D gradient(DoubleMatrix1D X) {
double x = X.getQuick(0);
return F1.make(new double[]{1+2*x/(1-x*x)});
}
public DoubleMatrix2D hessian(DoubleMatrix1D X) {
double x = X.getQuick(0);
return F2.make(new double[][]{{4*Math.pow(x, 2)/Math.pow(1-x*x, 2)+2/(1-x*x)}});
}
public int getDim() {
return 1;
}
};
OptimizationRequest or = new OptimizationRequest();
or.setCheckKKTSolutionAccuracy(true);
or.setF0(objectiveFunction);
or.setInitialPoint(new double[] {0});//must be feasible
// optimization
NewtonLEConstrainedFSP opt = new NewtonLEConstrainedFSP();
opt.setOptimizationRequest(or);
opt.optimize();
double[] sol = opt.getOptimizationResponse().solution; sol[0] = 1-Math.sqrt(2);

