Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit b4bd3c14 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Updated SearchAlgorithm to try both direction for interpolate search

parent dc025f33
No related branches found
No related tags found
No related merge requests found
...@@ -146,7 +146,7 @@ namespace TUGraz.VectoCore.Configuration ...@@ -146,7 +146,7 @@ namespace TUGraz.VectoCore.Configuration
/// The initial search interval for the operating point search in the driver. /// The initial search interval for the operating point search in the driver.
/// </summary> /// </summary>
public static readonly MeterPerSquareSecond OperatingPointInitialSearchIntervalAccelerating = public static readonly MeterPerSquareSecond OperatingPointInitialSearchIntervalAccelerating =
-0.1.SI<MeterPerSquareSecond>(); 0.1.SI<MeterPerSquareSecond>();
public static readonly PerSecond EngineIdlingSearchInterval = 10.SI<PerSecond>(); public static readonly PerSecond EngineIdlingSearchInterval = 10.SI<PerSecond>();
......
...@@ -97,8 +97,14 @@ namespace TUGraz.VectoCore.Utils ...@@ -97,8 +97,14 @@ namespace TUGraz.VectoCore.Utils
ref iterationCount); ref iterationCount);
} catch (VectoException ex) { } catch (VectoException ex) {
var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName);
log.Debug("Falling back to LineSearch. InterpolationSearch failed: " + ex.Message); log.Debug("Falling back to InterpolationSearch in reverse. Normal InterpolationSearch failed: " + ex.Message);
result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); try {
result = InterpolateSearch(x, y, -interval, getYValue, evaluateFunction, criterion, abortCriterion,
ref iterationCount);
} catch (VectoException ex1) {
log.Debug("Falling back to LineSearch. Reverse InterpolationSearch failed: " + ex1.Message);
result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount);
}
} }
return result; return result;
} }
......
...@@ -194,7 +194,7 @@ namespace TUGraz.VectoCore.Tests.Integration ...@@ -194,7 +194,7 @@ namespace TUGraz.VectoCore.Tests.Integration
Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Concat(jobContainer.Runs.Select(r => r.ExecException))); Assert.IsTrue(jobContainer.Runs.All(r => r.Success), string.Concat(jobContainer.Runs.Select(r => r.ExecException)));
} }
[TestCase(GearboxSpeedLimitJobDecl)] [TestCategory("LongRunning"), TestCase(GearboxSpeedLimitJobDecl)]
public void TestRunGbxSpeedLimitedSimulations(string file) public void TestRunGbxSpeedLimitedSimulations(string file)
{ {
var fileWriter = new FileOutputWriter(file); var fileWriter = new FileOutputWriter(file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment