Skip to content
This repository has been archived by the owner on Nov 13, 2017. It is now read-only.

Commit

Permalink
naming conventions of other examples: *Difficulty/Strength
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0ffrey committed Mar 23, 2013
1 parent 02314fb commit bbbbe9b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.optaplanner.core.api.domain.value.ValueRange;
import org.optaplanner.core.api.domain.value.ValueRangeType;
import org.optaplanner.core.api.domain.variable.PlanningVariable;
import org.optaplanner.examples.projectscheduling.domain.solver.AllocationComparator;
import org.optaplanner.examples.projectscheduling.domain.solver.AllocationDifficultyComparator;
import org.optaplanner.examples.projectscheduling.domain.solver.JobModeComparator;
import org.optaplanner.examples.projectscheduling.domain.solver.StartDateComparator;
import org.optaplanner.examples.projectscheduling.domain.solver.StartDateStrengthComparator;

@PlanningEntity(difficultyComparatorClass = AllocationComparator.class)
@PlanningEntity(difficultyComparatorClass = AllocationDifficultyComparator.class)
public class Allocation {

private final Job job;
Expand Down Expand Up @@ -49,7 +49,7 @@ public Collection<JobMode> getJobModes() {
return this.job.getJobModes();
}

@PlanningVariable(strengthComparatorClass = StartDateComparator.class)
@PlanningVariable(strengthComparatorClass = StartDateStrengthComparator.class)
@ValueRange(planningEntityProperty = "startDates", type = ValueRangeType.FROM_PLANNING_ENTITY_PROPERTY)
public Integer getStartDate() {
return this.startDate;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.optaplanner.examples.projectscheduling.domain.solver;

import java.util.Comparator;

import org.optaplanner.examples.projectscheduling.domain.Allocation;

public class AllocationDifficultyComparator implements Comparator<Allocation> {

@Override
public int compare(final Allocation a, final Allocation b) {
final int aSize = a.getJob().getRecursiveSuccessors().size();
final int bSize = b.getJob().getRecursiveSuccessors().size();
if (aSize < bSize) {
return -1;
} else if (aSize == bSize) {
return 0;
} else {
return 1;
}
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.optaplanner.examples.projectscheduling.domain.solver;

import java.util.Comparator;

public class StartDateStrengthComparator implements Comparator<Integer> {

@Override
public int compare(Integer a, Integer b) {
return a.compareTo(b);
}

}

0 comments on commit bbbbe9b

Please sign in to comment.