Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
- import org.apache.commons.math3.linear.Array2DRowRealMatrix;
- import org.apache.commons.math3.linear.ArrayRealVector;
- import org.junit.Test;
- public class BOBYQAOptimizerTest {
- @Test(timeout = 10000)
- public void testInfiniteLoop() throws Exception {
- BOBYQAOptimizer optim = new BOBYQAOptimizer(13);
- /*
- * The visibility of these fields needs to be set to "package".
- */
- optim.currentBest = new ArrayRealVector(new double[] {
- 0.08873732733679275, 0.0727730484082505, 5.0,
- 0.4739772780102623, 0.3254098307735338, 0.011690891124956138 });
- optim.trustRegionCenterOffset = new ArrayRealVector(
- new double[] { 0.08873732733679275, -0.8154052319625713, 0.0,
- 0.04315377185976695, 0.00763116579283767,
- 0.006690891124956133 });
- optim.lowerDifference = new ArrayRealVector(new double[] { 0.0,
- -0.8881782803708218, -4.999999999999999, -0.42582350615049547,
- -0.3177786649806961, 0.0 });
- optim.gradientAtTrustRegionCenter = new ArrayRealVector(new double[] {
- 1.8796268088008995E126, 3.529308428257907E122,
- 4.339520711070304E125, 5.608812786974868E126,
- -4.886897857097816E125, 3.487006131445964E125 });
- optim.trialStepPoint = new ArrayRealVector(new double[] {
- 0.018534274689260638, -3.0286453569394745E-5,
- 9.307922453577254E-5, 0.08393819985263673,
- -0.0047990613305209035, 0.006690891124956133 });
- optim.upperDifference = new ArrayRealVector(new double[] { 5.0,
- 4.111821719629179, 0.0, 4.569176493849504, 0.6722213350193036,
- 0.995 });
- optim.modelSecondDerivativesValues = new ArrayRealVector(new double[] {
- 8.347666014168881E22, 3.083084801163501E24,
- 6.897175318585434E28, -0.44515251255638855,
- -14.882236374143211, 1.1725054479105397, 3.7517428938402095E22,
- 5.715239375136025E26, -2.615998357726303, 4.737565374055262E24,
- 7.715920246182096E22, 1.9694186667973142E27,
- -0.3462401331093542, 1.6317726106153778E25,
- 5.623617765741468E25, 0.36431300388940296,
- -5.086426080473383E12, -0.8209127432417354,
- 4.913708497322823E12, -1.3907154846378276E12,
- 8.46293921765543E10 });
- optim.modelSecondDerivativesParameters = new ArrayRealVector(
- new double[] { -8.280972179979475E107, 6.483491305977545E121,
- -3.591105321248276E122, -7.150793784954832E122,
- 8.716344713872511E122, 7.393516096544781E120,
- -8.727921483213026E121, 2.2946726277373087E123,
- -3.4278084109205284E107, 6.018665812878733E119,
- -5.46624278297487E119, 4.4618180068639655E108,
- 6.859493898945998E121 });
- double[][] matrix = {
- { 0.08873732733679275, -0.8154052319625713, 0.0,
- 0.04315377185976695, 0.00763116579283767,
- 0.006690891124956133 },
- { 0.0, -0.09914138449641066, 0.0, 5.403478276122921E-5,
- 1.224284426168555E-4, 0.0 },
- { 0.0, 0.006616520523110381, 0.0, 5.805252696630824E-5,
- 9.736209365813516E-5, 0.0 },
- { 0.0, -0.04798067054496377, 0.0, 6.902083900586665E-5,
- 1.8453954146836646E-4, 0.0 },
- { 0.0, -0.8153670291635121, -0.0012633603831365423,
- -0.41116414296856707, 0.17181681223620485, 0.0 },
- { 1.930200144389376E-5, 0.006551199859120928, 0.0,
- 4.055203974058454E-5, 1.2802485498026033E-4, 0.0 },
- { 0.0, 0.0061801450873448195, 0.0, 1.8504424483918167E-5,
- 7.930155796052627E-5, 0.0 },
- { 0.0, -2.4394116078706174E-5, 0.0, 5.143706659899293E-5,
- 1.4902504955366063E-4, 0.0 },
- { 4.167302901016568E-7, 0.006563172498281823,
- -4.4057982349691814E-5, 6.366744098999058E-5,
- 1.0225459633527619E-4, 3.0413608576169715E-5 },
- { 0.0, -0.003217994941491575, 0.0, 8.627259287170399E-7,
- -1.5191639112058534E-6, 0.0 },
- { 0.07020305264753211, -0.8153749455090019,
- -9.307922453577254E-5, -0.04078442799286978,
- 0.012430227123358574, 0.0 },
- { 0.0, 0.006571035139421758, 0.0, 4.922113885024038E-5,
- 1.4154133501121982E-4, 1.7131917154176267E-5 },
- { 0.0, -0.2014627189010238, 0.0, 1.2867809856229346E-4,
- 2.953203272088548E-4, 0.0 }, };
- optim.interpolationPoints = new Array2DRowRealMatrix(matrix);
- /*
- * method parameters
- */
- ArrayRealVector gnew = new ArrayRealVector(new double[] { 0, 0, 0, 0,
- 0, 0 });
- ArrayRealVector xbdi = new ArrayRealVector(new double[] { 0, 0, 0, 0,
- 0, 0 });
- ArrayRealVector s = new ArrayRealVector(
- new double[] { 0, 0, 0, 0, 0, 0 });
- ArrayRealVector hs = new ArrayRealVector(new double[] { 0, 0, 0, 0, 0,
- 0 });
- ArrayRealVector hred = new ArrayRealVector(new double[] { 0, 0, 0, 0,
- 0, 0 });
- /*
- * The visibility of this method needs to be changed to "package"
- */
- optim.trsbox(0.2046430153957766, gnew, xbdi, s, hs, hred);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment