Commit Graph

204 Commits

Author SHA1 Message Date
Gilles Sadowski 04d1b46525 Unused "import". 2021-08-10 12:42:13 +02:00
Gilles Sadowski 1fb5411a81 Move tests for expected exceptions to "SimplexOptimizerTest" class. 2021-08-10 11:47:59 +02:00
Gilles Sadowski 9fd6725d51 MATH-1623: Add unit tests for "HedarFukushimaTransform".
Adapt input files for the "simulated annealing" option.

Class "SimplexOptimizerHedarFukushimaTest" superseded by input from CSV.
2021-08-10 11:06:14 +02:00
Gilles Sadowski bdd6bc4d13 Unused "import". 2021-08-10 10:56:17 +02:00
Gilles Sadowski 061c6d2c30 Unused field. 2021-08-10 10:22:12 +02:00
Gilles Sadowski 858ecda80f MATH-1623: Remove duplicate unit tests.
Standard test functions are now handled by class "SimplexOptimizerTest".
2021-08-10 01:07:31 +02:00
Gilles Sadowski fdbb8b98f5 MATH-1623: Add parameterized unit tests for simplex-based optimizers. 2021-08-09 18:27:00 +02:00
Gilles Sadowski c40a30678b Unused "import". 2021-08-09 18:22:39 +02:00
Gilles Sadowski 7ce320700a Web links to reference definitions of test functions.
Changed "TestFunction.DIFF_POW" to match the definition.
2021-08-09 17:56:52 +02:00
Gilles Sadowski a2491345b8 Remove duplicate function (unit tests). 2021-08-09 16:10:48 +02:00
Gilles Sadowski 43ac946382 Delete unused test data files. 2021-08-09 11:54:38 +02:00
Gilles Sadowski 970834f9b9 Delete unused test data files. 2021-08-09 11:40:21 +02:00
Gilles Sadowski 1bc6e8de25 "Simplex.TransformFactory" must extend "OptimizationData". 2021-08-09 10:31:07 +02:00
Gilles Sadowski c04dd79f0f Preserve RNG state integrity in case unit tests would be run concurrently. 2021-08-09 10:27:34 +02:00
Gilles Sadowski 1444d2d8d1 Replace deprecated calls. 2021-08-07 22:31:39 +02:00
Gilles Sadowski 26fc13cf66 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-math 2021-08-07 15:34:48 +02:00
Gilles Sadowski 92a3b0c040 Replace calls to deprecated method. 2021-08-07 15:26:02 +02:00
Gilles Sadowski 50ca244b38 MATH-1622: Hybridation of simplex-based search with simulated annealing (SA).
Class "SimulatedAnnealing" provides user-defined input ("OptimizationData").
Behaviour of "SimplexOptimizer" depends on whether SA is activated (if yes,
each "iteration" is further split in "epoch" stages).
The "Simplex.TransformFactory" interface is changed to allow passing the SA
acceptance test ("Metropolis" rule).

The "SimplexOptimizer" is furter refactored (cf. MATH-1614) so that the
steps (in method "doOptimize") clearly stand out as
 1. Setup and iteration (optionally with simulated annealing).
 2. Simplex transformation rule.
 3. Convergence check.
 4. "Best list" search.

This commit also contains the following modifications:
 * "TestFunction": Override "toString" (for display in unit tests).
 * "Simplex"
   - Self-documenting names for factories.
   - Utility methods: "centroid", "asList", "replaceLast".
   - Unit tests.
 * "MultiDirectionalTransform":
   - Use common utility methods.
   - Fix missing sort in "transform" method.
   - Check validity of constructor parameters.
   - Parameter names to match the equivalent in "NelderMeadMeadTransform".
 * Adapt unit test classes to the updated API of class "Simplex".
 * "PointValuePair":
   - "final".
   - Implements "hashCode".
2021-08-07 14:38:46 +02:00
Gilles Sadowski d26470b139 Delete unused test data files.
The same data is still available in directory
  commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/fitting/leastsquares
2021-08-07 14:38:46 +02:00
Gilles Sadowski b167967767 Standard test functions defined in a dedicated factory ("TestFunction" enum). 2021-08-07 14:38:46 +02:00
Gilles Sadowski a791c576d5 Relax tolerance (unit test). 2021-08-07 14:38:46 +02:00
Gilles Sadowski 790ceb5ade Nit: Information message in unit test assertions. 2021-08-07 14:38:46 +02:00
Gilles Sadowski fd3313724e Move utility method "newPoint" to "Simplex" class.
Reduce visibility of utility methods to "package-private".
2021-08-07 14:38:46 +02:00
Gilles Sadowski de99fd0384 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-math 2021-08-07 14:38:04 +02:00
Arturo Bernal 3aab631272 MATH-1573 - Redundant local variable 2021-08-07 13:37:21 +01:00
Arturo Bernal 1c8d8da63a MATH-1572: Simplify conditional expressions
* Simplify bitwise
* Simplify boolean expression
* Simplify conditional expression
* Redundant 'if' statement
2021-08-07 13:19:32 +01:00
Gilles Sadowski b5d21665ff MATH-1621: Override "equals" and "toString". 2021-08-04 06:47:27 +02:00
Gilles Sadowski 771a21815b Unused "import". 2021-08-03 16:20:11 +02:00
Gilles Sadowski 6bc63d4f3f Suppress obsolete unit test.
Class "ConstantContinuousDistribution" has been removed from "Commons Statistics".
2021-08-03 03:22:47 +02:00
Gilles Sadowski 3df6d879e7 Implement "ConstantContinuousDistribution" as a local workaround.
Corresponding code to be removed from "Commons Statistics" (no other known use case).
2021-08-02 02:31:37 +02:00
Gilles Sadowski 8e63d421bf Adapt to "Commons Statistics" API change. 2021-08-02 01:36:34 +02:00
Gilles Sadowski f49e77a806 Delete spurious file.
File was committed by mistake.
2021-07-28 13:01:18 +02:00
Gilles Sadowski 9dbceb0ed1 MATH-1616: Refactor "EmpiricalDistribution".
* No default bin count (cf. MATH-1462).
* No data loading from external sources (file, URL).
* No data abstraction layer.
* Return defensive copies of the internal state.
* Make class immutable.
* Allow user-defined within-bin kernel.
2021-07-20 18:07:12 +02:00
Gilles Sadowski 8968416790 MATH-1379: Fix "LoessInterpolator" in case of unevenly spaced samples.
Thanks to Richard Wilkinson.
2021-07-19 18:43:59 +02:00
Ng Tsz Sum 30a2593c2c MATH-1617: Ensure that "hashCode" is consistent with "equals". 2021-07-19 17:43:51 +02:00
Gilles Sadowski 8cd59b991e Replace deprecated calls. 2021-07-19 15:02:29 +02:00
Gilles Sadowski bf44f34862 "sonarcloud" suggestion. 2021-07-19 15:01:39 +02:00
Gilles Sadowski 0b56f2cf54 MATH-1617: Fix equality check.
Thanks to Ng Tsz Sum.
2021-07-18 17:28:04 +02:00
Gilles Sadowski 4f7ef762d7 Reduce visibility to package-private. 2021-07-18 01:06:00 +02:00
Gilles Sadowski b5fd55e6b9 Avoid usage of "clone" (suggested by "sonarcloud"). 2021-07-18 01:02:28 +02:00
Gilles Sadowski 84f15db1bb Javadoc. 2021-07-17 14:35:37 +02:00
Gilles Sadowski 7de72b3402 Javadoc. 2021-07-17 14:35:26 +02:00
Gilles Sadowski 2218194942 MATH-1611: Obsolete class.
Functionality moved to "Commons RNG" (cf. RNG-140).
2021-07-17 14:19:09 +02:00
Gilles Sadowski e6bc7a4d31 Use functionality from "Commons RNG". 2021-07-17 14:18:38 +02:00
Gilles Sadowski d13aec9b34 Nit. 2021-07-17 01:25:08 +02:00
Gilles Sadowski fb283c85e3 Add issue reference to skipped unit tests (suggested by "sonarcloud"). 2021-07-17 01:12:17 +02:00
Gilles Sadowski dcf83c02a7 Add comment (false positive "sonarcloud" report). 2021-07-15 01:42:38 +02:00
Gilles Sadowski 73d82834ba Rename field (suggested by "sonarcloud"). 2021-07-14 13:46:55 +02:00
Gilles Sadowski 344fb6dedd Unused parameters. 2021-07-14 13:32:39 +02:00
Gilles Sadowski 286ff6ad39 Use method reference (suggested by "sonarcloud"). 2021-07-14 13:32:09 +02:00
Gilles Sadowski befbe8f6e3 Javadoc. 2021-07-14 12:49:28 +02:00
Gilles Sadowski 9afa2f7532 Remove useless override (suggested by "sonarcloud"). 2021-07-14 12:32:14 +02:00
Gilles Sadowski 6bc42d33d2 Simplify condition (suggested by "sonarcloud"). 2021-07-14 11:22:40 +02:00
Gilles Sadowski 1bb918b730 Rephrase condition. 2021-07-14 11:16:58 +02:00
Gilles Sadowski bb5843f4aa CheckStyle. 2021-07-14 11:04:50 +02:00
Gilles Sadowski 8f83827846 Code simplifications (suggested by "sonarcloud"). 2021-07-14 00:36:10 +02:00
Amar Prakash Pandey ded7c63521 MATH-1528: Remove "Serializable".
Closes #191.
2021-07-11 21:33:19 +02:00
Gilles Sadowski f4244dc76d Unused field. 2021-07-11 19:01:22 +02:00
Gilles Sadowski 996426e61e Unused "import". 2021-07-11 19:00:48 +02:00
Gilles Sadowski 78476b09dc MATH-1462: Following advice in the Javadoc (on selecting the number of bins), unit test passes. 2021-07-11 17:35:24 +02:00
Gilles Sadowski 693d560427 Code style and Javadoc nits. 2021-07-11 17:16:06 +02:00
Gilles Sadowski 509f50b0a5 CheckStyle. 2021-07-11 03:15:10 +02:00
Gilles Sadowski eab3bcec3c MATH-1600: Interface is not used anymore. 2021-07-11 02:56:35 +02:00
Gilles Sadowski 5fee542f82 MATH-1615: Functionality is in "Commons RNG" (cf. RNG-137). 2021-07-11 02:44:10 +02:00
Gilles Sadowski 71bfa2daeb Adapt to API change in "Commons Numbers". 2021-07-11 02:36:10 +02:00
Gilles Sadowski 46a0c3ae41 MATH-1614: Refactoring of "SimplexOptimizer".
Class "Simplex" supersedes "AbstractSimplex" whose subclasses are replaced
by implementations of the "Simplex.TransformFactory" interface.
The new classes are immutable.

Test suite has been updated.
It tries to assess correctness through randomization; however some standard
optimization problems entail systematic failures that were previously hidden
through using fixed seeds.  [The corresponding unit tests are skipped, and
further work is needed in order to find out whether those problems are too
hard for the algorithm or the issue lies elsewhere.]
2021-07-11 02:10:11 +02:00
aherbert 7f425354fb MATH-1576: Fix checkstyle in legacy module
Fix many of the modules.

The remaining modules have been added back and commented out:

ParameterNumber - 50 errors
MethodParamPad - 94 errors
NoWhitespaceAfter - 3949 errors
NoWhitespaceBefore - 1605 errors
OperatorWrap - 54 errors
ParenPad - 884 errors
WhitespaceAfter - 7543 errors
WhitespaceAround - 2198 errors
HiddenField - 64 errors
ArrayTypeStyle - 197 errors
Indentation - 7293 errors
2021-06-25 17:32:48 +01:00
aherbert f8741d3ab6 MATH-1576: Reinstate checkstyle to legacy module
A simplified checkstyle configuration has been used. Additional modules
should be added back incrementally as the codebase is corrected.

Removed trailing whitespace.
Removed tab characters.
Fixed the correct licence header.
2021-06-25 16:49:31 +01:00
Gilles Sadowski c98e638d73 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-math 2021-06-25 14:51:00 +02:00
Gilles Sadowski 97dd402d10 MATH-1613: Decrease maximum number of iterations for consistency with internal counter. 2021-06-25 14:50:01 +02:00
aherbert 6ce950d5a3 MATH-1576: Reinstate checkstyle
Checkstyle has been suppressed for the legacy module.

Fixed the new modules to pass the checkstyle configuration ported from
Commons-Numbers.
2021-06-25 12:08:35 +01:00
Gilles Sadowski cd54910edc Javadoc. 2021-06-25 12:12:52 +02:00
Gilles Sadowski 03923d2b79 Adapt to "Commons Numbers" API update (cf. NUMBERS-163). 2021-06-23 02:09:48 +02:00
Gilles Sadowski a1f2a98c28 Use functionality defined in "Commons Numbers". 2021-06-17 15:13:34 +02:00
Gilles Sadowski b509678e95 MATH-1610: Functionality moved to "Commons RNG" (cf. RNG-145). 2021-06-14 22:26:22 +02:00
Gilles Sadowski 24b1d86ffb MATH-1608: Remove random string generator.
Functionality is out-of-scope (cf. "Commons Codec").
2021-06-14 14:49:11 +02:00
Gilles Sadowski bdc4a527fb Remove dependencies on unused "Commons Numbers" modules. 2021-06-10 18:27:59 +02:00
Gilles Sadowski ca830af170 Remove dependency "ComplexUtils" class.
Class will not be released as of "Commons Numbers" v1.0 (cf. NUMBERS-25).
2021-06-10 18:24:53 +02:00
Gilles Sadowski 151b015ea7 MATH-1594: Remove "Serializable". 2021-06-10 17:41:48 +02:00
Gilles Sadowski 759743122d Removed "java.util.Random" wrapper.
Utility is provided by "Commons RNG".
2021-06-10 03:10:21 +02:00
aherbert 8a60de3263 Ignore spotbugs in the legacy module 2021-06-09 16:53:06 +01:00
aherbert af647182ef Fix binary search for index overflow 2021-06-09 16:44:48 +01:00
aherbert df117c1e46 Fix null argument check. Fix javadoc error. 2021-06-09 16:41:20 +01:00
Gilles Sadowski 1d83419c90 Adapt to "Commons Numbers" API updates.
Cf. NUMBERS-159.
2021-06-09 16:20:39 +02:00
Gilles Sadowski a5b1aa0294 Typo. 2021-06-09 16:18:57 +02:00
Gilles Sadowski df927f0b67 MATH-1552: Fiddling with setup and expectations (unit tests). 2021-06-05 23:50:46 +02:00
Gilles Sadowski 4075e87c76 Unneeded "import" statement. 2021-06-05 14:50:58 +02:00
Gilles Sadowski dd73a1ba80 Unneeded dependency (unit test). 2021-06-05 14:49:01 +02:00
Gilles Sadowski 839f8b45a3 Remove info file with useless/outdated contents. 2021-06-05 13:21:02 +02:00
Gilles Sadowski 7b9edac695 Use "Commons RNG" (unit tests). 2021-06-05 03:41:14 +02:00
Gilles Sadowski ac25b3b9f3 Remove fixed seed (unit test). 2021-06-05 02:26:43 +02:00
Gilles Sadowski e24e0a8555 MATH-1595: Interface not used anymore within "Commons Math". 2021-06-04 10:54:23 +02:00
Gilles Sadowski 610564f7d4 MATH-1602: Obsolete class. 2021-06-04 10:46:47 +02:00
Gilles Sadowski b574149094 Adapt to new API ("Commons Numbers"). 2021-06-04 00:23:52 +02:00
Gilles Sadowski 8f39a414c1 MATH-1599: Class removed (out-of-scope). 2021-06-03 19:29:40 +02:00
Gilles Sadowski 1b7f10eed7 Moved "ComplexFormat" class to "util" package. 2021-06-03 18:42:58 +02:00
Gilles Sadowski 7ef0099c9e Adapt to new API ("Commons Numbers"). 2021-06-03 18:27:25 +02:00
Gilles Sadowski 536ee3f645 MATH-1598: Class is not used anymore within "Commons Math".
Functionality is available from "Commons RNG".
2021-06-02 03:26:14 +02:00
Gilles Sadowski 456de1bf98 MATH-1601: Simplified and more robust API.
Factory methods ensure correct use (removed dependency on "NormalizedRandomGenerator").
2021-06-02 03:21:46 +02:00
Gilles Sadowski 8afd815000 Typo (Javadoc). 2021-06-02 01:08:42 +02:00