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 import org.hipparchus.util.FastMath;
25
26 public class HockSchittkowskiConstraintEquality77 extends EqualityConstraint {
27
28 public HockSchittkowskiConstraintEquality77() {
29 super(MatrixUtils.createRealVector(new double[] {
30 2.0 * FastMath.sqrt(2.0),
31 8.0 + FastMath.sqrt(2.0)
32 }));
33 }
34
35 @Override
36 public RealVector value(RealVector x) {
37 double x1 = x.getEntry(0);
38 double x2 = x.getEntry(1);
39 double x3 = x.getEntry(2);
40 double x4 = x.getEntry(3);
41 double x5 = x.getEntry(4);
42
43
44 RealVector a=new ArrayRealVector(2);
45 a.setEntry(0,x1*x1*x4+FastMath.sin(x4-x5));
46 a.setEntry(1,x2+x3*x3*x3*x3*x4*x4);
47
48
49 return a;
50 }
51
52 @Override
53 public RealMatrix jacobian(RealVector x) {
54 double x1 = x.getEntry(0);
55 double x3 = x.getEntry(2);
56 double x4 = x.getEntry(3);
57 double x5 = x.getEntry(4);
58 RealMatrix a= new Array2DRowRealMatrix(2,5);
59
60 a.setEntry(0,0,2.0*x1*x4);
61 a.setEntry(0,1,0.0);
62 a.setEntry(0,2,0.0);
63 a.setEntry(0,3,x1*x1+FastMath.cos(x4-x5));
64 a.setEntry(0,4,-1.0*FastMath.cos(x4-x5));
65 a.setEntry(1,0,0.0);
66 a.setEntry(1,1,1.0);
67 a.setEntry(1,2,4.0*x3*x3*x3*x4*x4);
68 a.setEntry(1,3,2.0*x3*x3*x3*x3*x4);
69 a.setEntry(1,4,0.0);
70
71 return a;
72 }
73
74 @Override
75 public int dim() {
76 return 5;
77 }
78 }