protected IEnumerator <T> optimize_trajectory(NextTrajectory next, TrajectoryPredicate is_better, TrajectoryPredicate not_found) { T current = null; T best = null; var maxI = GLB.TRJ.MaxIterations; var frameI = GLB.TRJ.PerFrameIterations; do { // if(best != null && !string.IsNullOrEmpty(TCAGui.StatusMessage)) //debug // { yield return null; continue; } current = next(current, best); if (best == null || is_better(current, best)) { best = current; } frameI--; maxI--; if (frameI <= 0) { // clear_nodes(); //debug // add_node(current.ManeuverDeltaV, current.StartUT);//debug // var lnd = current as LandingTrajectory;//debug // if(lnd != null) add_node(lnd.BrakeDeltaV, lnd.BrakeStartUT);//debug // Status("Push to continue");//debug yield return(null); frameI = GLB.TRJ.PerFrameIterations; } } while(not_found(current, best) && maxI > 0); // Log("Best trajectory:\n{0}", best);//debug // clear_nodes();//debug yield return(best); }
protected virtual void setup_calculation(NextTrajectory next) { next_trajectory = next; end_predicate = target_is_far; better_predicate = trajectory_is_better; }
protected override void setup_calculation(NextTrajectory next) { next_trajectory = next; end_predicate = trajectories_converging; better_predicate = trajectory_is_better; }
public virtual void Setup(NextTrajectory next, TrajectoryPredicate is_better, TrajectoryPredicate not_found) { Trajectory = null; optimizer = optimize_trajectory(next, is_better, not_found); }
public void Setup(NextTrajectory next) { optimizer = optimize_trajectory(next, trajectory_is_better, target_is_far); }
protected virtual void setup_calculation(NextTrajectory next) { next_trajectory = next; continue_predicate = continue_calculation; better_predicate = trajectory_is_better; }