|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjml.optimization.PrimalDualInteriorPoint
public class PrimalDualInteriorPoint
A Java implementation for the Primal-dual Interior-point method. While general nonlinear objective functions and nonlinear inequality constraints are supported, only linear equality constraints are allowed.
Example:
fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
H_x = Q;
DF_x = B;
F_x = B.multiply(x).subtract(d);
G_f_x = Q.multiply(x).add(c);
boolean flags[] = null;
int k = 0;
while (true) {
  flags = PrimalDualInteriorPoint.run(A, b, H_x, F_x, DF_x, G_f_x, fval, x, l, v);
  if (flags[0])
    break;
  // Compute the objective function value, if flags[1] is true
  // gradient will also be computed.
  fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
  F_x = B.multiply(x).subtract(d);
  if (flags[1]) {
    k = k + 1;
    // Compute the gradient
    G_f_x = Q.multiply(x).add(c);
  }
}
Field Summary | |
---|---|
private static double |
alpha
|
private static double |
beta
|
private static boolean |
converge
If the algorithm converges or not. |
private static double |
epsilon
|
private static double |
epsilon_feas
|
private static double |
eta_t
|
private static boolean |
gradientRequired
If gradient is required for the next step. |
private static java.util.ArrayList<java.lang.Double> |
J
An array holding the sequence of objective function values. |
private static int |
k
Iteration counter. |
private static org.apache.commons.math.linear.RealMatrix |
l
Lambda, i.e., the Lagrangian multipliers for inequality constraints. |
private static org.apache.commons.math.linear.RealMatrix |
l_nt
|
private static int |
m
Number of inequality constraints |
private static org.apache.commons.math.linear.RealMatrix |
Matrix
|
private static double |
mu
|
private static int |
n
Number of unknown variables |
private static int |
p
Number of equality constraints |
private static org.apache.commons.math.linear.RealMatrix |
r_cent
|
private static org.apache.commons.math.linear.RealMatrix |
r_dual
|
private static org.apache.commons.math.linear.RealMatrix |
r_prim
|
private static double |
residual
|
private static double |
s
Step length for backtracking line search. |
private static int |
state
State for the automata machine. |
private static double |
t
|
private static org.apache.commons.math.linear.RealMatrix |
v
Nu, i.e., the Lagrangian multipliers for equality constraints. |
private static org.apache.commons.math.linear.RealMatrix |
v_nt
|
private static org.apache.commons.math.linear.RealMatrix |
Vector
|
private static org.apache.commons.math.linear.RealMatrix |
x
Unknown variable vector. |
private static org.apache.commons.math.linear.RealMatrix |
x_nt
|
private static org.apache.commons.math.linear.RealMatrix |
z_pd
|
Constructor Summary | |
---|---|
PrimalDualInteriorPoint()
|
Method Summary | |
---|---|
static org.apache.commons.math.linear.RealMatrix |
getOptimalLambda()
Get Lambda. |
static org.apache.commons.math.linear.RealMatrix |
getOptimalNu()
Get Nu. |
static void |
main(java.lang.String[] args)
|
static boolean[] |
run(org.apache.commons.math.linear.RealMatrix A,
org.apache.commons.math.linear.RealMatrix b,
org.apache.commons.math.linear.RealMatrix H_x,
org.apache.commons.math.linear.RealMatrix F_x,
org.apache.commons.math.linear.RealMatrix DF_x,
org.apache.commons.math.linear.RealMatrix G_f_x,
double fval,
org.apache.commons.math.linear.RealMatrix x)
Run this optimization algorithm. |
static boolean[] |
run(org.apache.commons.math.linear.RealMatrix A,
org.apache.commons.math.linear.RealMatrix b,
org.apache.commons.math.linear.RealMatrix H_x,
org.apache.commons.math.linear.RealMatrix F_x,
org.apache.commons.math.linear.RealMatrix DF_x,
org.apache.commons.math.linear.RealMatrix G_f_x,
double fval,
org.apache.commons.math.linear.RealMatrix x_s,
org.apache.commons.math.linear.RealMatrix l_opt,
org.apache.commons.math.linear.RealMatrix v_opt)
Run this optimization algorithm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.math.linear.RealMatrix x
private static org.apache.commons.math.linear.RealMatrix l
private static org.apache.commons.math.linear.RealMatrix v
private static boolean gradientRequired
private static boolean converge
private static int state
private static double t
private static int k
private static int n
private static int p
private static int m
private static double mu
private static double epsilon
private static double epsilon_feas
private static double alpha
private static double beta
private static double eta_t
private static double s
private static double residual
private static org.apache.commons.math.linear.RealMatrix r_prim
private static org.apache.commons.math.linear.RealMatrix r_dual
private static org.apache.commons.math.linear.RealMatrix r_cent
private static org.apache.commons.math.linear.RealMatrix Matrix
private static org.apache.commons.math.linear.RealMatrix Vector
private static org.apache.commons.math.linear.RealMatrix z_pd
private static org.apache.commons.math.linear.RealMatrix x_nt
private static org.apache.commons.math.linear.RealMatrix l_nt
private static org.apache.commons.math.linear.RealMatrix v_nt
private static java.util.ArrayList<java.lang.Double> J
Constructor Detail |
---|
public PrimalDualInteriorPoint()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- public static org.apache.commons.math.linear.RealMatrix getOptimalLambda()
public static org.apache.commons.math.linear.RealMatrix getOptimalNu()
public static boolean[] run(org.apache.commons.math.linear.RealMatrix A, org.apache.commons.math.linear.RealMatrix b, org.apache.commons.math.linear.RealMatrix H_x, org.apache.commons.math.linear.RealMatrix F_x, org.apache.commons.math.linear.RealMatrix DF_x, org.apache.commons.math.linear.RealMatrix G_f_x, double fval, org.apache.commons.math.linear.RealMatrix x)
fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
H_x = Q;
DF_x = B;
F_x = B.multiply(x).subtract(d);
G_f_x = Q.multiply(x).add(c);
boolean flags[] = null;
int k = 0;
while (true) {
  flags = PrimalDualInteriorPoint.run(A, b, H_x, F_x, DF_x, G_f_x, fval, x, l, v);
  if (flags[0])
    break;
  // Compute the objective function value, if flags[1] is true
  // gradient will also be computed.
  fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
  F_x = B.multiply(x).subtract(d);
  if (flags[1]) {
    k = k + 1;
    // Compute the gradient
    G_f_x = Q.multiply(x).add(c);
  }
}
A
- matrix for equality constraintsb
- the constant vector for equality constraintsH_x
- Hessian for the objective function and nonlinear functions for
inequality constraintsF_x
- a vector of nonlinear functions for inequality constraints,
F_x(i) is the i-th nonlinear function value for the i-th
inequality constraintDF_x
- Derivative for F_xG_f_x
- Gradient of the objective function at the current point xfval
- objective function value at the current point xx
- current point, will be set in place during the procedure
boolean
array of two elements: {converge, gradientRequired}public static boolean[] run(org.apache.commons.math.linear.RealMatrix A, org.apache.commons.math.linear.RealMatrix b, org.apache.commons.math.linear.RealMatrix H_x, org.apache.commons.math.linear.RealMatrix F_x, org.apache.commons.math.linear.RealMatrix DF_x, org.apache.commons.math.linear.RealMatrix G_f_x, double fval, org.apache.commons.math.linear.RealMatrix x_s, org.apache.commons.math.linear.RealMatrix l_opt, org.apache.commons.math.linear.RealMatrix v_opt)
fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
H_x = Q;
DF_x = B;
F_x = B.multiply(x).subtract(d);
G_f_x = Q.multiply(x).add(c);
boolean flags[] = null;
int k = 0;
while (true) {
  flags = PrimalDualInteriorPoint.run(A, b, H_x, F_x, DF_x, G_f_x, fval, x, l, v);
  if (flags[0])
    break;
  // Compute the objective function value, if flags[1] is true
  // gradient will also be computed.
  fval = innerProduct(x, Q.multiply(x)) / 2 + innerProduct(c, x);
  F_x = B.multiply(x).subtract(d);
  if (flags[1]) {
    k = k + 1;
    // Compute the gradient
    G_f_x = Q.multiply(x).add(c);
  }
}
A
- matrix for equality constraintsb
- the constant vector for equality constraintsH_x
- Hessian for the objective function and nonlinear functions for
inequality constraintsF_x
- a vector of nonlinear functions for inequality constraints,
F_x(i) is the i-th nonlinear function value for the i-th
inequality constraintDF_x
- Derivative for F_xG_f_x
- Gradient of the objective function at the current point xfval
- objective function value at the current point xx_s
- current point, will be set in place during the procedurel_opt
- optimal Lambdav_opt
- optimal Nu
boolean
array of two elements: {converge, gradientRequired}
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |