Commit a8b02830 authored by Tong Li's avatar Tong Li

初始话

parent 8cd195f9
...@@ -344,9 +344,9 @@ public class Initialization { ...@@ -344,9 +344,9 @@ public class Initialization {
/** /**
* 使用构造启发式算法生成初始种群 * 使用构造启发式算法生成初始种群
*/ */
public List<Chromosome> generateHeuristicInitialPopulation(ScheduleParams param) { public List<Chromosome> generateHeuristicInitialPopulation(ScheduleParams param,int _PopulationSize) {
List<Chromosome> population = new ArrayList<>(); List<Chromosome> population = new ArrayList<>();
int populationSize = param.getPopulationSize(); int populationSize = param.getPopulationSize()==0?_PopulationSize:param.getPopulationSize();
this.baseTime=param.getBaseTime(); this.baseTime=param.getBaseTime();
// 按比例生成不同启发式规则的个体(优化:增加混合策略和瓶颈优先) // 按比例生成不同启发式规则的个体(优化:增加混合策略和瓶颈优先)
int sptCount = (int) (populationSize * 0.15); int sptCount = (int) (populationSize * 0.15);
...@@ -1116,7 +1116,7 @@ public class Initialization { ...@@ -1116,7 +1116,7 @@ public class Initialization {
subParam.setBaseTime(param.getBaseTime()); subParam.setBaseTime(param.getBaseTime());
List<Chromosome> heuristicPopulation = List<Chromosome> heuristicPopulation =
generateHeuristicInitialPopulation(subParam); generateHeuristicInitialPopulation(subParam,remaining);
for (Chromosome chromo : heuristicPopulation) { for (Chromosome chromo : heuristicPopulation) {
chromo.setOrders(new CopyOnWriteArrayList<>(orders)); chromo.setOrders(new CopyOnWriteArrayList<>(orders));
} }
......
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