Kaydet (Commit) 90ace7be authored tarafından Todor Balabanov's avatar Todor Balabanov Kaydeden (comit) Tomaž Vajngerl

Range for DE scaling factor was implemented.

Change-Id: I5b8d3cd69a6138d7eebf37c299626019b32d639a
Reviewed-on: https://gerrit.libreoffice.org/72373Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
Tested-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 7bf2515f
...@@ -41,7 +41,10 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine { ...@@ -41,7 +41,10 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
private static final int DVNum = 2; private static final int DVNum = 2;
//scale constant: (0, 1.2], normally be 0.5 //scale constant: (0, 1.2], normally be 0.5
public double FACTOR = 0.5; public double MIN_FACTOR = 0.5;
//scale constant: (0, 1.2], normally be 0.5
public double MAX_FACTOR = 0.5;
//crossover constant: [0, 1], normally be 0.1 or 0.9 //crossover constant: [0, 1], normally be 0.1 or 0.9
public double CR = 0.9; public double CR = 0.9;
...@@ -70,7 +73,7 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine { ...@@ -70,7 +73,7 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
delta += (i % 2 == 0 ? +1D : -1D) * differenceVectors[i].getLocation()[index]; delta += (i % 2 == 0 ? +1D : -1D) * differenceVectors[i].getLocation()[index];
} }
trialVector[index] = globalVector[index] + FACTOR * delta; trialVector[index] = globalVector[index] + RandomGenerator.doubleRangeRandom(MIN_FACTOR, MAX_FACTOR) * delta;
} }
@Override @Override
......
...@@ -59,7 +59,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver ...@@ -59,7 +59,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
super(context, "DEPS Evolutionary Algorithm"); super(context, "DEPS Evolutionary Algorithm");
registerProperty(m_agentSwitchRate); registerProperty(m_agentSwitchRate);
registerProperty(m_factor); registerProperty(m_minFactor);
registerProperty(m_maxFactor);
registerProperty(m_CR); registerProperty(m_CR);
registerProperty(m_c1); registerProperty(m_c1);
registerProperty(m_c2); registerProperty(m_c2);
...@@ -102,7 +103,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver ...@@ -102,7 +103,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
private final PropertyInfo<Double> m_agentSwitchRate = new PropertyInfo<Double>("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)"); private final PropertyInfo<Double> m_agentSwitchRate = new PropertyInfo<Double>("AgentSwitchRate", 0.5, "Agent Switch Rate (DE Probability)");
// --DE // --DE
private final PropertyInfo<Double> m_factor = new PropertyInfo<Double>("DEFactor", 0.5, "DE: Scaling Factor (0-1.2)"); private final PropertyInfo<Double> m_minFactor = new PropertyInfo<Double>("DEFactorMin", 0.5, "DE: Min Scaling Factor (0-1.2)");
private final PropertyInfo<Double> m_maxFactor = new PropertyInfo<Double>("DEFactorMax", 0.5, "DE: Max Scaling Factor (0-1.2)");
private final PropertyInfo<Double> m_CR = new PropertyInfo<Double>("DECR", 0.9, "DE: Crossover Probability (0-1)"); private final PropertyInfo<Double> m_CR = new PropertyInfo<Double>("DECR", 0.9, "DE: Crossover Probability (0-1)");
// --PS // --PS
private final PropertyInfo<Double> m_c1 = new PropertyInfo<Double>("PSC1", 1.494, "PS: Cognitive Constant"); private final PropertyInfo<Double> m_c1 = new PropertyInfo<Double>("PSC1", 1.494, "PS: Cognitive Constant");
...@@ -126,7 +128,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver ...@@ -126,7 +128,8 @@ public final class DEPSSolverImpl extends BaseEvolutionarySolver
agents[i].setPbest(m_library.getSelectedPoint(i)); agents[i].setPbest(m_library.getSelectedPoint(i));
DEGTBehavior deGTBehavior = new DEGTBehavior(); DEGTBehavior deGTBehavior = new DEGTBehavior();
deGTBehavior.FACTOR = m_factor.getValue(); deGTBehavior.MIN_FACTOR = m_minFactor.getValue();
deGTBehavior.MAX_FACTOR = m_maxFactor.getValue();
deGTBehavior.CR = m_CR.getValue(); deGTBehavior.CR = m_CR.getValue();
PSGTBehavior psGTBehavior = new PSGTBehavior(); PSGTBehavior psGTBehavior = new PSGTBehavior();
......
...@@ -15,7 +15,8 @@ NLPSolverCommon.Properties.EnhancedSolverStatus=Show enhanced solver status ...@@ -15,7 +15,8 @@ NLPSolverCommon.Properties.EnhancedSolverStatus=Show enhanced solver status
#DEPS #DEPS
NLPSolverCommon.Properties.AgentSwitchRate=Agent Switch Rate (DE Probability) NLPSolverCommon.Properties.AgentSwitchRate=Agent Switch Rate (DE Probability)
NLPSolverCommon.Properties.DEFactor=DE: Scaling Factor (0-1.2) NLPSolverCommon.Properties.DEFactorMin=DE: Min Scaling Factor (0-1.2)
NLPSolverCommon.Properties.DEFactorMax=DE: Max Scaling Factor (0-1.2)
NLPSolverCommon.Properties.DECR=DE: Crossover Probability (0-1) NLPSolverCommon.Properties.DECR=DE: Crossover Probability (0-1)
NLPSolverCommon.Properties.PSC1=PS: Cognitive Constant NLPSolverCommon.Properties.PSC1=PS: Cognitive Constant
NLPSolverCommon.Properties.PSC2=PS: Social Constant NLPSolverCommon.Properties.PSC2=PS: Social Constant
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment