Index: /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj (revision 5865)
+++ /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj (revision 5866)
@@ -108,5 +108,4 @@
-
Index: /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs (revision 5866)
@@ -163,12 +163,12 @@
Parameters.Add(new OptionalConstrainedValueParameter("InertiaUpdater", "Updates the omega parameter."));
Parameters.Add(new ConstrainedValueParameter("SwarmUpdater", "Encoding-specific parameter which is provided by the problem. May provide additional encoding-specific parameters, such as velocity bounds for real valued problems"));
+ ParticleUpdaterParameter.Hidden = true;
RandomCreator randomCreator = new RandomCreator();
VariableCreator variableCreator = new VariableCreator();
- Assigner assigner = new Assigner();
+ Assigner currentInertiaAssigner = new Assigner();
solutionsCreator = new SolutionsCreator();
SubScopesCounter subScopesCounter = new SubScopesCounter();
Placeholder topologyInitializerPlaceholder = new Placeholder();
- Placeholder analyzerPlaceholder = new Placeholder();
mainLoop = new ParticleSwarmOptimizationMainLoop();
@@ -180,11 +180,10 @@
variableCreator.CollectedValues.Add(new ValueParameter("CurrentIteration", new IntValue(0)));
- variableCreator.CollectedValues.Add(new ValueParameter("CurrentVelocityBounds", new DoubleValue(0)));
- variableCreator.Successor = assigner;
-
- assigner.Name = "CurrentInertia := Inertia";
- assigner.LeftSideParameter.ActualName = "CurrentInertia";
- assigner.RightSideParameter.ActualName = "Inertia";
- assigner.Successor = solutionsCreator;
+ variableCreator.Successor = currentInertiaAssigner;
+
+ currentInertiaAssigner.Name = "CurrentInertia := Inertia";
+ currentInertiaAssigner.LeftSideParameter.ActualName = "CurrentInertia";
+ currentInertiaAssigner.RightSideParameter.ActualName = "Inertia";
+ currentInertiaAssigner.Successor = solutionsCreator;
solutionsCreator.NumberOfSolutionsParameter.ActualName = "SwarmSize";
Index: /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs (revision 5866)
@@ -56,7 +56,4 @@
get { return (IValueLookupParameter)Parameters["NeighborBestAttraction"]; }
}
- public IValueLookupParameter VelocityBoundsParameter {
- get { return (IValueLookupParameter)Parameters["VelocityBounds"]; }
- }
public IValueLookupParameter ParticleUpdaterParameter {
get { return (IValueLookupParameter)Parameters["ParticleUpdater"]; }
@@ -128,5 +125,4 @@
Placeholder particleUpdaterPlaceholder = new Placeholder();
Placeholder topologyUpdaterPlaceholder = new Placeholder();
- UniformSubScopesProcessor uniformSubscopesProcessor2 = new UniformSubScopesProcessor();
UniformSubScopesProcessor evaluationProcessor = new UniformSubScopesProcessor();
Placeholder swarmUpdater = new Placeholder();
@@ -134,5 +130,4 @@
Comparator currentIterationComparator = new Comparator();
ConditionalBranch conditionalBranch = new ConditionalBranch();
- Placeholder velocityBoundsUpdaterPlaceholder = new Placeholder();
Placeholder inertiaUpdaterPlaceholder = new Placeholder();
SubScopesCounter subScopesCounter = new SubScopesCounter();
@@ -176,5 +171,5 @@
topologyUpdaterPlaceholder.Successor = swarmUpdater;
- swarmUpdater.Name = "Swarm Updater";
+ swarmUpdater.Name = "(Swarm Updater)";
swarmUpdater.OperatorParameter.ActualName = SwarmUpdaterParameter.ActualName;
swarmUpdater.Successor = inertiaUpdaterPlaceholder;
Index: unk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/VelocityBoundsModifier.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/VelocityBoundsModifier.cs (revision 5865)
+++ (revision )
@@ -1,117 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see .
- */
-#endregion
-
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
- [Item("VelocityBoundsModifier", "Modifies the velocity bounds.")]
- [StorableClass]
- public sealed class VelocityBoundsModifier : SingleSuccessorOperator, IDiscreteDoubleMatrixModifier {
- #region Parameters
- public ILookupParameter ValueParameter {
- get { return (ILookupParameter)Parameters["Matrix"]; }
- }
- public ILookupParameter ScaleParameter {
- get { return (ILookupParameter)Parameters["Scale"]; }
- }
- public ConstrainedValueParameter ScalingOperatorParameter {
- get { return (ConstrainedValueParameter)Parameters["ScalingOperator"]; }
- }
- public IValueLookupParameter StartValueParameter {
- get { return (IValueLookupParameter)Parameters["StartValue"]; }
- }
- public IValueLookupParameter EndValueParameter {
- get { return (IValueLookupParameter)Parameters["EndValue"]; }
- }
- public ILookupParameter IndexParameter {
- get { return (ILookupParameter)Parameters["Index"]; }
- }
- public IValueLookupParameter StartIndexParameter {
- get { return (IValueLookupParameter)Parameters["StartIndex"]; }
- }
- public IValueLookupParameter EndIndexParameter {
- get { return (IValueLookupParameter)Parameters["EndIndex"]; }
- }
- #endregion
-
- #region Construction & Cloning
-
- [StorableConstructor]
- private VelocityBoundsModifier(bool deserializing) : base(deserializing) { }
- private VelocityBoundsModifier(VelocityBoundsModifier original, Cloner cloner) : base(original, cloner) { }
- public VelocityBoundsModifier() {
- Parameters.Add(new LookupParameter("Matrix", "The double matrix to modify."));
- Parameters.Add(new LookupParameter("Scale", "Scale parameter."));
- Parameters.Add(new ConstrainedValueParameter("ScalingOperator", "Modifies the value"));
- Parameters.Add(new ValueLookupParameter("StartValue", "The start value of 'Value'.", new DoubleValue(1)));
- Parameters.Add(new ValueLookupParameter("EndValue", "The end value of 'Value'."));
- Parameters.Add(new LookupParameter("Index", "The current index."));
- Parameters.Add(new ValueLookupParameter("StartIndex", "The start index at which to start modifying 'Value'."));
- Parameters.Add(new ValueLookupParameter("EndIndex", "The end index by which 'Value' should have reached 'EndValue'."));
-
- Initialize();
- }
-
- public override IDeepCloneable Clone(Cloner cloner) {
- return new VelocityBoundsModifier(this, cloner);
- }
- #endregion
-
- private void Initialize() {
- foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances()) {
- ScalingOperatorParameter.ValidValues.Add(op);
- op.ValueParameter.ActualName = ScaleParameter.Name;
- op.StartValueParameter.ActualName = StartValueParameter.Name;
- op.EndValueParameter.ActualName = EndValueParameter.Name;
- op.IndexParameter.ActualName = IndexParameter.Name;
- op.StartIndexParameter.ActualName = StartIndexParameter.Name;
- op.EndIndexParameter.ActualName = EndIndexParameter.Name;
- }
- }
-
- public override IOperation Apply() {
- OperationCollection next = new OperationCollection();
- DoubleMatrix matrix = ValueParameter.ActualValue;
- if (this.ScaleParameter.ActualValue == null && this.StartValueParameter.ActualValue != null) {
- this.ScaleParameter.ActualValue = new DoubleValue(StartValueParameter.ActualValue.Value);
- }
- for (int i = 0; i < matrix.Rows; i++) {
- for (int j = 0; j < matrix.Columns; j++) {
- if (matrix[i, j] >= 0) {
- matrix[i, j] = ScaleParameter.ActualValue.Value;
- } else {
- matrix[i, j] = (-1) * ScaleParameter.ActualValue.Value;
- }
- }
- }
- next.Add(ExecutionContext.CreateChildOperation(this.ScalingOperatorParameter.Value));
- next.Add(base.Apply());
- return next;
- }
- }
-}
Index: /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorParticleUpdater.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorParticleUpdater.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Interfaces/IRealVectorParticleUpdater.cs (revision 5866)
@@ -27,5 +27,5 @@
public interface IRealVectorParticleUpdater : IParticleUpdater, IRealVectorOperator {
ILookupParameter VelocityParameter { get; }
- ILookupParameter VelocityBoundsParameter { get; }
+ ILookupParameter CurrentVelocityBoundsParameter { get; }
ILookupParameter RealVectorParameter { get; }
ILookupParameter BoundsParameter { get; }
Index: /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs (revision 5866)
@@ -57,5 +57,5 @@
}
- BoundsChecker.Apply(velocity, VelocityBounds);
+ BoundsChecker.Apply(velocity, CurrentVelocityBounds);
for (int i = 0; i < velocity.Length; i++) {
position[i] = RealVector[i] + velocity[i];
Index: /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs (revision 5866)
@@ -59,6 +59,6 @@
get { return (ILookupParameter)Parameters["Bounds"]; }
}
- public ILookupParameter VelocityBoundsParameter {
- get { return (ILookupParameter)Parameters["VelocityBounds"]; }
+ public ILookupParameter CurrentVelocityBoundsParameter {
+ get { return (ILookupParameter)Parameters["CurrentVelocityBounds"]; }
}
public ILookupParameter InertiaParameter {
@@ -97,6 +97,6 @@
get { return BoundsParameter.ActualValue; }
}
- protected DoubleMatrix VelocityBounds {
- get { return VelocityBoundsParameter.ActualValue; }
+ protected DoubleMatrix CurrentVelocityBounds {
+ get { return CurrentVelocityBoundsParameter.ActualValue; }
}
protected DoubleValue Inertia {
@@ -124,5 +124,5 @@
Parameters.Add(new LookupParameter("NeighborBest", "Best neighboring solution."));
Parameters.Add(new LookupParameter("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem."));
- Parameters.Add(new LookupParameter("VelocityBounds", "Upper and lower bounds for the particle's velocity vector."));
+ Parameters.Add(new LookupParameter("CurrentVelocityBounds", "Upper and lower bounds for the particle's velocity vector."));
Parameters.Add(new LookupParameter("CurrentInertia", "The weight for the particle's velocity vector."));
Parameters.Add(new LookupParameter("PersonalBestAttraction", "The weight for the particle's personal best position."));
Index: /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs (revision 5866)
@@ -26,6 +26,8 @@
using HeuristicLab.Operators;
using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
namespace HeuristicLab.Encodings.RealVectorEncoding {
@@ -34,4 +36,7 @@
public sealed class RealVectorSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater {
+ [Storable]
+ private ResultsCollector ResultsCollector;
+
public override bool CanChangeName {
get { return false; }
@@ -69,10 +74,38 @@
get { return (IScopeTreeLookupParameter)Parameters["Neighbors"]; }
}
- public ValueLookupParameter VelocityBoundsUpdaterParameter {
- get { return (ValueLookupParameter)Parameters["VelocityBoundsUpdater"]; }
- }
- public LookupParameter VelocityBoundsParameter {
- get { return (LookupParameter)Parameters["VelocityBounds"]; }
- }
+ public IValueLookupParameter VelocityBoundsParameter {
+ get { return (ValueLookupParameter)Parameters["VelocityBounds"]; }
+ }
+ public ILookupParameter CurrentVelocityBoundsParameter {
+ get { return (ILookupParameter)Parameters["CurrentVelocityBounds"]; }
+ }
+ public LookupParameter ResultsParameter {
+ get { return (LookupParameter)Parameters["Results"]; }
+ }
+
+ #region Velocity Bounds Updating
+ public ILookupParameter VelocityBoundsScaleParameter {
+ get { return (ILookupParameter)Parameters["VelocityBoundsScale"]; }
+ }
+ public OptionalConstrainedValueParameter VelocityBoundsScalingOperatorParameter {
+ get { return (OptionalConstrainedValueParameter)Parameters["VelocityBoundsScalingOperator"]; }
+ }
+ public IValueLookupParameter VelocityBoundsStartValueParameter {
+ get { return (IValueLookupParameter)Parameters["VelocityBoundsStartValue"]; }
+ }
+ public IValueLookupParameter VelocityBoundsEndValueParameter {
+ get { return (IValueLookupParameter)Parameters["VelocityBoundsEndValue"]; }
+ }
+ public ILookupParameter VelocityBoundsIndexParameter {
+ get { return (ILookupParameter)Parameters["VelocityBoundsIndex"]; }
+ }
+ public IValueLookupParameter VelocityBoundsStartIndexParameter {
+ get { return (IValueLookupParameter)Parameters["VelocityBoundsStartIndex"]; }
+ }
+ public IValueLookupParameter VelocityBoundsEndIndexParameter {
+ get { return (IValueLookupParameter)Parameters["VelocityBoundsEndIndex"]; }
+ }
+ #endregion
+
#endregion
@@ -114,10 +147,23 @@
get { return NeighborsParameter.ActualValue; }
}
- private IDiscreteDoubleMatrixModifier VelocityBoundsUpdater {
- get { return VelocityBoundsUpdaterParameter.ActualValue; }
- }
private DoubleMatrix VelocityBounds {
get { return VelocityBoundsParameter.ActualValue; }
- set { VelocityBoundsParameter.ActualValue = value; }
+ }
+ private DoubleMatrix CurrentVelocityBounds {
+ get { return CurrentVelocityBoundsParameter.ActualValue; }
+ set { CurrentVelocityBoundsParameter.ActualValue = value; }
+ }
+ private DoubleValue VelocityBoundsScale {
+ get { return VelocityBoundsScaleParameter.ActualValue; }
+ set { VelocityBoundsScaleParameter.ActualValue = value; }
+ }
+ private DoubleValue VelocityBoundsStartValue {
+ get { return VelocityBoundsStartValueParameter.ActualValue; }
+ }
+ private IDiscreteDoubleValueModifier VelocityBoundsScalingOperator {
+ get { return VelocityBoundsScalingOperatorParameter.Value; }
+ }
+ private ResultCollection Results {
+ get { return ResultsParameter.ActualValue; }
}
#endregion
@@ -127,5 +173,8 @@
[StorableConstructor]
private RealVectorSwarmUpdater(bool deserializing) : base(deserializing) { }
- private RealVectorSwarmUpdater(RealVectorSwarmUpdater original, Cloner cloner) : base(original, cloner) { }
+ private RealVectorSwarmUpdater(RealVectorSwarmUpdater original, Cloner cloner)
+ : base(original, cloner) {
+ ResultsCollector = cloner.Clone(original.ResultsCollector);
+ }
public RealVectorSwarmUpdater()
: base() {
@@ -140,6 +189,21 @@
Parameters.Add(new ScopeTreeLookupParameter("Neighbors", "The list of neighbors for each particle."));
Parameters.Add(new LookupParameter("Maximization", "True if the problem is a maximization problem, otherwise false."));
- Parameters.Add(new ValueLookupParameter("VelocityBoundsUpdater", "Modifies the velocity bounds in the course of optimization."));
- Parameters.Add(new LookupParameter("VelocityBounds", "Maximum velocity for each dimension."));
+ Parameters.Add(new ValueLookupParameter("VelocityBounds", "Maximum velocity for each dimension.", new DoubleMatrix(new double[,] { { -1, 1 } })));
+ Parameters.Add(new LookupParameter("CurrentVelocityBounds", "Current value of velocity bounds."));
+ Parameters.Add(new LookupParameter("Results", "Results"));
+
+ #region Velocity Bounds Updating
+ Parameters.Add(new LookupParameter("VelocityBoundsScale", "Scale parameter."));
+ Parameters.Add(new OptionalConstrainedValueParameter("VelocityBoundsScalingOperator", "Modifies the value"));
+ Parameters.Add(new ValueLookupParameter("VelocityBoundsStartValue", "The start value of 'Value'.", new DoubleValue(1)));
+ Parameters.Add(new ValueLookupParameter("VelocityBoundsEndValue", "The end value of 'Value'.", new DoubleValue(1E-10)));
+ Parameters.Add(new LookupParameter("VelocityBoundsIndex", "The current index.", "CurrentIteration"));
+ Parameters.Add(new ValueLookupParameter("VelocityBoundsStartIndex", "The start index at which to start modifying 'Value'.", new IntValue(0)));
+ Parameters.Add(new ValueLookupParameter("VelocityBoundsEndIndex", "The end index by which 'Value' should have reached 'EndValue'.", "MaxIterations"));
+ VelocityBoundsStartIndexParameter.Hidden = true;
+ VelocityBoundsEndIndexParameter.Hidden = true;
+ #endregion
+
+ Initialize();
}
@@ -149,4 +213,21 @@
#endregion
+
+ private void Initialize() {
+ ResultsCollector = new ResultsCollector();
+ ResultsCollector.CollectedValues.Add(CurrentVelocityBoundsParameter);
+ ResultsCollector.CollectedValues.Add(VelocityBoundsParameter);
+
+ foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances()) {
+ VelocityBoundsScalingOperatorParameter.ValidValues.Add(op);
+ op.ValueParameter.ActualName = VelocityBoundsScaleParameter.Name;
+ op.StartValueParameter.ActualName = VelocityBoundsStartValueParameter.Name;
+ op.EndValueParameter.ActualName = VelocityBoundsEndValueParameter.Name;
+ op.IndexParameter.ActualName = VelocityBoundsIndexParameter.Name;
+ op.StartIndexParameter.ActualName = VelocityBoundsStartIndexParameter.Name;
+ op.EndIndexParameter.ActualName = VelocityBoundsEndIndexParameter.Name;
+ }
+ VelocityBoundsScalingOperatorParameter.Value = null;
+ }
public override IOperation Apply() {
@@ -194,13 +275,36 @@
}
+
+
private IOperation UpdateVelocityBounds() {
- if (VelocityBounds == null)
- VelocityBounds = new DoubleMatrix(new double[,] { { -1, 1 } });
- return VelocityBoundsUpdater == null ?
- base.Apply() :
- new OperationCollection() {
- ExecutionContext.CreateChildOperation(VelocityBoundsUpdater),
- ExecutionContext.CreateOperation(Successor)
+ if (CurrentVelocityBounds == null)
+ CurrentVelocityBounds = (DoubleMatrix)VelocityBounds.Clone();
+
+ if (VelocityBoundsScalingOperator == null)
+ return new OperationCollection() {
+ ExecutionContext.CreateChildOperation(ResultsCollector),
+ base.Apply()
};
+
+
+ DoubleMatrix matrix = CurrentVelocityBounds;
+ if (VelocityBoundsScale == null && VelocityBoundsStartValue != null) {
+ VelocityBoundsScale = new DoubleValue(VelocityBoundsStartValue.Value);
+ }
+ for (int i = 0; i < matrix.Rows; i++) {
+ for (int j = 0; j < matrix.Columns; j++) {
+ if (matrix[i, j] >= 0) {
+ matrix[i, j] = VelocityBoundsScale.Value;
+ } else {
+ matrix[i, j] = (-1) * VelocityBoundsScale.Value;
+ }
+ }
+ }
+
+ return new OperationCollection() {
+ ExecutionContext.CreateChildOperation(ResultsCollector),
+ ExecutionContext.CreateChildOperation(VelocityBoundsScalingOperator),
+ base.Apply()
+ };
}
}
Index: /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs
===================================================================
--- /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs (revision 5865)
+++ /trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs (revision 5866)
@@ -57,5 +57,5 @@
}
- BoundsChecker.Apply(velocity, VelocityBounds);
+ BoundsChecker.Apply(velocity, CurrentVelocityBounds);
for (int i = 0; i < velocity.Length; i++) {
position[i] = RealVector[i] + velocity[i];