1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.hipparchus.optim.nonlinear.vector.constrained;
18
19 import org.hipparchus.linear.Array2DRowRealMatrix;
20 import org.hipparchus.linear.ArrayRealVector;
21 import org.hipparchus.linear.MatrixUtils;
22 import org.hipparchus.linear.RealMatrix;
23 import org.hipparchus.linear.RealVector;
24
25 public class HockSchittkowskiConstraintInequality72 extends InequalityConstraint {
26
27 private static final double A11 = 4;
28 private static final double A12 = 2.25;
29 private static final double A13 = 1.0;
30 private static final double A14 = 0.25;
31 private static final double A21 = 0.16;
32 private static final double A22 = 0.36;
33 private static final double A23 = 0.64;
34 private static final double A24 = 0.64;
35 private static final double B1 = 0.0401;
36 private static final double B2 = 0.010085;
37
38 public HockSchittkowskiConstraintInequality72() {
39 super(MatrixUtils.createRealVector(new double[] { -B1, -B2 }));
40 }
41
42 @Override
43 public RealVector value(RealVector x) {
44 double x1 = x.getEntry(0);
45 double x2 = x.getEntry(1);
46 double x3 = x.getEntry(2);
47 double x4 = x.getEntry(3);
48
49
50
51 RealVector a=new ArrayRealVector(2);
52 a.setEntry(0,-A11/x1-A12/x2-A13/x3-A14/x4);
53 a.setEntry(1,-A21/x1-A22/x2-A23/x3-A24/x4);
54
55
56 return a;
57 }
58
59 @Override
60 public RealMatrix jacobian(RealVector x) {
61 double x1 = x.getEntry(0);
62 double x2 = x.getEntry(1);
63 double x3 = x.getEntry(2);
64 double x4 = x.getEntry(3);
65
66 RealMatrix a= new Array2DRowRealMatrix(2,4);
67
68 a.setEntry(0,0,A11/(x1*x1));
69 a.setEntry(0,1,A12/(x2*x2));
70 a.setEntry(0,2,A13/(x3*x3));
71 a.setEntry(0,3,A14/(x4*x4));
72
73 a.setEntry(1,0,A21/(x1*x1));
74 a.setEntry(1,1,A22/(x2*x2));
75 a.setEntry(1,2,A23/(x3*x3));
76 a.setEntry(1,3,A24/(x4*x4));
77
78
79 return a;
80 }
81
82 @Override
83 public int dim() {
84 return 4;
85 }
86
87 }