Commit ad3d3b81 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

WIP: initial, change interface to abc and implement metric

parent d71c4cd5
package org.vadere.simulator.models.osm.optimization;
import org.vadere.util.geometry.shapes.VPoint;
/**
* @author Daniel Lehmberg
* //TODO
*/
public class OptimizationMetric {
private VPoint optimalPoint;
private double optimalFuncValue;
private VPoint foundPoint;
private double foundFuncValue;
public OptimizationMetric(){
}
public OptimizationMetric(final VPoint optimalPoint, double optimalFuncValue, VPoint foundPoint,
double foundFuncValue){
this.optimalPoint = optimalPoint;
this.optimalFuncValue = optimalFuncValue;
this.foundPoint = foundPoint;
this.foundFuncValue = foundFuncValue;
}
public VPoint getOptimalPoint() {
return optimalPoint;
}
public double getOptimalFuncValue() {
return optimalFuncValue;
}
public VPoint getFoundPoint() {
return foundPoint;
}
public double getFoundFuncValue() {
return foundFuncValue;
}
}
......@@ -18,7 +18,7 @@ import java.util.List;
/**
* @author Benedikt Zoennchen
*/
public class ParticleSwarmOptimizer implements StepCircleOptimizer {
public class ParticleSwarmOptimizer extends StepCircleOptimizer {
private final double movementThreshold;
private final Random random;
......
......@@ -9,10 +9,24 @@ import org.vadere.util.geometry.shapes.VPoint;
* The Interface StepCircleOptimizer.
*
*/
public interface StepCircleOptimizer {
public abstract class StepCircleOptimizer {
private OptimizationMetric currentMetricValues;
protected StepCircleOptimizer(){
// TODO: read if the metric should be computed
boolean computeMetric = true;
if(computeMetric){
this.currentMetricValues = new OptimizationMetric();
}else{
this.currentMetricValues = null;
}
}
/** Returns the reachable position with the minimal potential. */
VPoint getNextPosition(PedestrianOSM pedestrian, Shape reachableArea);
abstract VPoint getNextPosition(PedestrianOSM pedestrian, Shape reachableArea);
StepCircleOptimizer clone();
//abstract StepCircleOptimizer clone();
}
......@@ -18,7 +18,7 @@ import java.util.Random;
* The Class StepCircleOptimizerBrent.
*
*/
public class StepCircleOptimizerBrent implements StepCircleOptimizer {
public class StepCircleOptimizerBrent extends StepCircleOptimizer {
private static Logger logger = Logger
.getLogger(StepCircleOptimizerBrent.class);
......
......@@ -19,7 +19,7 @@ import java.util.Random;
* in [Seitz, 2012]
*
*/
public class StepCircleOptimizerDiscrete implements StepCircleOptimizer {
public class StepCircleOptimizerDiscrete extends StepCircleOptimizer {
private final double movementThreshold;
private final Random random;
......
......@@ -15,7 +15,7 @@ import org.vadere.util.geometry.shapes.VPoint;
* The Class StepCircleOptimizerEvolStrat.
*
*/
public class StepCircleOptimizerEvolStrat implements StepCircleOptimizer {
public class StepCircleOptimizerEvolStrat extends StepCircleOptimizer {
private final Random random;
private final double startrandom;
......
......@@ -15,7 +15,7 @@ import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.simulator.models.potential.solver.gradients.FloorGradientProviderDiscrete;
import org.vadere.simulator.models.potential.solver.gradients.GradientProvider;
public class StepCircleOptimizerGradient implements StepCircleOptimizer {
public class StepCircleOptimizerGradient extends StepCircleOptimizer {
private final AttributesOSM attributesOSM;
private final IPotentialFieldTargetGrid potentialFieldTarget;
......
......@@ -22,7 +22,7 @@ import java.util.Random;
* The Class StepCircleOptimizerNelderMead.
*
*/
public class StepCircleOptimizerNelderMead implements StepCircleOptimizer {
public class StepCircleOptimizerNelderMead extends StepCircleOptimizer {
private static Logger logger = Logger
.getLogger(StepCircleOptimizerNelderMead.class);
......
......@@ -12,7 +12,7 @@ import org.apache.commons.math3.optimization.GoalType;
import org.apache.commons.math3.optimization.PointValuePair;
import org.apache.commons.math3.analysis.MultivariateFunction;
public class StepCircleOptimizerPowell implements StepCircleOptimizer {
public class StepCircleOptimizerPowell extends StepCircleOptimizer {
private Random random;
......
Supports Markdown
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