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 HockSchittkowskiConstraintInequality71 extends InequalityConstraint {
26
27 public HockSchittkowskiConstraintInequality71() {
28 super(MatrixUtils.createRealVector(new double[] {
29 25.0, 1.0, 1.0, 1.0, 1.0, -5.0, -5.0, -5.0, -5.0
30 }));
31 }
32
33 @Override
34 public RealVector value(RealVector x) {
35 double x1 = x.getEntry(0);
36 double x2 = x.getEntry(1);
37 double x3 = x.getEntry(2);
38 double x4 = x.getEntry(3);
39
40 RealVector a=new ArrayRealVector(9);
41 a.setEntry(0,x1*x2*x3*x4);
42 a.setEntry(1,x1);
43 a.setEntry(2,x2);
44 a.setEntry(3,x3);
45 a.setEntry(4,x4);
46 a.setEntry(5,-x1);
47 a.setEntry(6,-x2);
48 a.setEntry(7,-x3);
49 a.setEntry(8,-x4);
50
51 return a;
52 }
53
54 @Override
55 public RealMatrix jacobian(RealVector x) {
56 double x1 = x.getEntry(0);
57 double x2 = x.getEntry(1);
58 double x3 = x.getEntry(2);
59 double x4 = x.getEntry(3);
60 RealMatrix a= new Array2DRowRealMatrix(9,4);
61 a.setEntry(0,0,x2*x3*x4);
62 a.setEntry(0,1,x1*x3*x4);
63 a.setEntry(0,2,x2*x1*x4);
64 a.setEntry(0,3,x1*x3*x2);
65 a.setEntry(1,0,1.0);
66 a.setEntry(2,1,1.0);
67 a.setEntry(3,2,1.0);
68 a.setEntry(4,3,1.0);
69 a.setEntry(5,0,-1.0);
70 a.setEntry(6,1,-1.0);
71 a.setEntry(7,2,-1.0);
72 a.setEntry(8,3,-1.0);
73
74 return a;
75 }
76
77 @Override
78 public int dim() {
79 return 4;
80 }
81 }