diff options
author | Todor Balabanov <todor.balabanov@gmail.com> | 2021-06-20 13:49:57 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-21 08:48:50 +0200 |
commit | 89459662bf2684a07596d4132c84e5da7e0af8d4 (patch) | |
tree | 1148699aa52bf5b30c97682780db443b01ec06ee /nlpsolver | |
parent | 2e3046cc6fdebb52cfb1cdc114a9c2cd26bcc178 (diff) |
Global optimization metaheuristics sometimes are sensitive to the quality of the random numbers.
Change-Id: Ibc1e95736c5f9355e67f2129a7804064e329da89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117510
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'nlpsolver')
-rw-r--r-- | nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java | 5 | ||||
-rw-r--r-- | nlpsolver/src/locale/NLPSolverCommon_en_US.properties | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java index b33d77a438d9..0c402e87c12f 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseEvolutionarySolver.java @@ -34,6 +34,7 @@ import com.sun.star.sheet.SolverConstraintOperator; import com.sun.star.uno.XComponentContext; import java.util.ArrayList; import net.adaptivebox.global.BasicBound; +import net.adaptivebox.global.RandomGenerator; import net.adaptivebox.goodness.ACRComparator; import net.adaptivebox.goodness.BCHComparator; import net.adaptivebox.goodness.IGoodnessCompareEngine; @@ -53,6 +54,7 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { registerProperty(m_useACRComperator); registerProperty(m_useRandomStartingPoint); + registerProperty(m_useStrongerPRNG); registerProperty(m_required); registerProperty(m_tolerance); @@ -168,6 +170,7 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { private final PropertyInfo<Double> m_variableRangeThreshold = new PropertyInfo<Double>("VariableRangeThreshold", 3.0, "Variable Bounds Threshold (when guessing)"); //to approximate the variable bounds private final PropertyInfo<Boolean> m_useACRComperator = new PropertyInfo<Boolean>("UseACRComparator", false, "Use ACR Comparator (instead of BCH)"); private final PropertyInfo<Boolean> m_useRandomStartingPoint = new PropertyInfo<Boolean>("UseRandomStartingPoint", false, "Use Random starting point"); + private final PropertyInfo<Boolean> m_useStrongerPRNG = new PropertyInfo<Boolean>("UseStrongerPRNG", false, "Use a stronger random generator (slower)"); protected PropertyInfo<Integer> m_required = new PropertyInfo<Integer>("StagnationLimit", 70, "Stagnation Limit"); protected PropertyInfo<Double> m_tolerance = new PropertyInfo<Double>("Tolerance", 1e-6, "Stagnation Tolerance"); private final PropertyInfo<Boolean> m_enhancedSolverStatus = new PropertyInfo<Boolean>("EnhancedSolverStatus", true, "Show enhanced solver status"); @@ -324,6 +327,8 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver { m_envCompareEngine = new BCHComparator(); m_specCompareEngine = m_useACRComperator.getValue() ? new ACRComparator(m_library, m_learningCycles.getValue()) : new BCHComparator(); + + RandomGenerator.useStrongerGenerator( m_useStrongerPRNG.getValue() ); } protected void applySolution() { diff --git a/nlpsolver/src/locale/NLPSolverCommon_en_US.properties b/nlpsolver/src/locale/NLPSolverCommon_en_US.properties index 84262674ddb9..5ab304d69ebb 100644 --- a/nlpsolver/src/locale/NLPSolverCommon_en_US.properties +++ b/nlpsolver/src/locale/NLPSolverCommon_en_US.properties @@ -9,6 +9,7 @@ NLPSolverCommon.Properties.GuessVariableRange=Variable Bounds Guessing NLPSolverCommon.Properties.VariableRangeThreshold=Variable Bounds Threshold (when guessing) NLPSolverCommon.Properties.UseACRComparator=Use ACR Comparator (instead of BCH) NLPSolverCommon.Properties.UseRandomStartingPoint=Use Random starting point +NLPSolverCommon.Properties.UseStrongerPRNG=Use a stronger random generator (slower) NLPSolverCommon.Properties.StagnationLimit=Stagnation Limit NLPSolverCommon.Properties.Tolerance=Stagnation Tolerance NLPSolverCommon.Properties.EnhancedSolverStatus=Show enhanced solver status |