Related tdf#135211: return early if no data

With DEPS or SCO Evolutionary algorithms, it'll return
"No solution found."
Change-Id: I15e8e24eb519a20e3f3645b79e990949f648fbd2

Change-Id: I7321419ccc1cd00d75f03fa86d3c0cb4bf9ad473
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99584
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet 2020-07-28 11:32:03 +02:00
parent 9282871ab0
commit a7e92d71d7
3 changed files with 13 additions and 0 deletions

View File

@ -189,6 +189,10 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
protected void initializeSolve() { protected void initializeSolve() {
super.initializeSolve(); super.initializeSolve();
if (m_variableCount == 0)
{
return;
}
if (m_enhancedSolverStatus.getValue()) if (m_enhancedSolverStatus.getValue())
m_solverStatusDialog = new EvolutionarySolverStatusUno(m_xContext); m_solverStatusDialog = new EvolutionarySolverStatusUno(m_xContext);
else else

View File

@ -119,6 +119,10 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
Logger.getLogger(DEPSSolverImpl.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(DEPSSolverImpl.class.getName()).log(Level.SEVERE, null, ex);
} }
initializeSolve(); initializeSolve();
if (m_problemEncoder == null)
{
return;
}
//Init: //Init:
DEPSAgent[] agents = new DEPSAgent[m_swarmSize.getValue()]; DEPSAgent[] agents = new DEPSAgent[m_swarmSize.getValue()];

View File

@ -90,6 +90,11 @@ public final class SCOSolverImpl extends BaseEvolutionarySolver
public void solve() { public void solve() {
initializeSolve(); initializeSolve();
if (m_problemEncoder == null)
{
return;
}
//Init: //Init:
int swarmSize = m_swarmSize.getValue(); int swarmSize = m_swarmSize.getValue();
SCAgent[] agents = new SCAgent[swarmSize]; SCAgent[] agents = new SCAgent[swarmSize];