- public double computeValue(Simulation simulation) throws OptimizationException, InterruptedException {
- try {
- log.debug("Running simulation to evaluate rocket landing distance");
- simulation.simulate(new InterruptListener());
- double value = simulation.getSimulatedData().getBranch(0).getLast(FlightDataType.TYPE_POSITION_XY);
- log.debug("Landing distance was " + value);
- return value;
- } catch (MotorIgnitionException e) {
- // A problem with motor ignition will cause optimization to fail
- throw new OptimizationException(e);
- } catch (SimulationLaunchException e) {
- // Other launch exceptions result in zero altitude
- return Double.NaN;
- } catch (SimulationCancelledException e) {
- throw (InterruptedException) new InterruptedException("Optimization was interrupted").initCause(e);
- } catch (SimulationException e) {
- // Other exceptions fail
- throw new OptimizationException(e);
- }
+ protected double getResultValue(FlightData simulatedData) {
+ return simulatedData.getBranch(0).getLast(FlightDataType.TYPE_POSITION_XY);