Changeset 9991
- Timestamp:
- 09/19/13 11:29:28 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading.Views/3.4/SolutionLineChartView.cs
r9796 r9991 65 65 this.chart.Series[SIGNALS_SERIES_NAME].Tag = Content; 66 66 67 IEnumerable<double> accumulatedPrice = GetAccumulatedPrices(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.Price Variable));67 IEnumerable<double> accumulatedPrice = GetAccumulatedPrices(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable)); 68 68 this.chart.Series.Add(PRICEVARIABLE_SERIES_NAME); 69 69 this.chart.Series[PRICEVARIABLE_SERIES_NAME].LegendText = PRICEVARIABLE_SERIES_NAME; … … 72 72 this.chart.Series[PRICEVARIABLE_SERIES_NAME].Tag = Content; 73 73 74 IEnumerable<double> profit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.Price Variable), Content.Signals, Content.ProblemData.TransactionCosts);74 IEnumerable<double> profit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceChangeVariable), Content.Signals, Content.ProblemData.TransactionCosts); 75 75 IEnumerable<double> accumulatedProfits = GetAccumulatedPrices(profit); 76 76 this.chart.Series.Add(ASSET_SERIES_NAME); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading/3.4/EcbProblemInstanceProvider.cs
r9989 r9991 78 78 var tList = new List<DateTime>(); 79 79 var dList = new List<double>(); 80 double prevValue = 0;81 80 values.Add(tList); 82 81 values.Add(dList); … … 100 99 if (descriptor.Name.Contains(reader.GetAttribute("currency"))) { 101 100 reader.MoveToAttribute("rate"); 102 var curValue = reader.ReadContentAsDouble(); 103 if (!dList.Any()) 104 dList.Add(0.0); 105 else { 106 dList.Add(curValue - prevValue); 107 } 108 prevValue = curValue; 101 dList.Add(reader.ReadContentAsDouble()); 109 102 110 103 reader.MoveToElement(); … … 117 110 } 118 111 } 119 var allowedInputVariables = new string[] { descriptor.Name }; 120 var targetVariable = descriptor.Name; 121 var ds = new Dataset(new string[] { "Day", descriptor.Name }, values); 112 // entries in ECB XML are ordered most recent first => reverse lists 113 tList.Reverse(); 114 dList.Reverse(); 115 // calculate exchange rate deltas 116 var changes = new[] { 0.0 } // first element 117 .Concat(dList.Zip(dList.Skip(1), (prev, cur) => cur - prev)).ToList(); 118 values.Add(changes); 119 120 var targetVariable = "d(" + descriptor.Name + ")"; 121 var allowedInputVariables = new string[] { targetVariable }; 122 123 var ds = new Dataset(new string[] { "Day", descriptor.Name, targetVariable }, values); 122 124 return new ProblemData(ds, allowedInputVariables, targetVariable); 123 125 } -
trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs
r9456 r9991 21 21 22 22 using System; 23 using System.ComponentModel; 23 24 using System.Linq; 25 using System.Threading.Tasks; 24 26 using System.Windows.Forms; 25 27 using HeuristicLab.MainForm; … … 88 90 89 91 private void instancesComboBox_SelectionChangeCommitted(object sender, System.EventArgs e) { 92 toolTip.SetToolTip(instancesComboBox, String.Empty); 90 93 if (instancesComboBox.SelectedIndex >= 0) { 91 94 var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem; 92 T instance = Content.LoadData(descriptor); 93 try { 94 GenericConsumer.Load(instance); 95 } catch (Exception ex) { 96 ErrorHandling.ShowErrorDialog(String.Format("This problem does not support loading the instance {0}", descriptor.Name), ex); 97 } 98 toolTip.SetToolTip(instancesComboBox, descriptor.Description); 99 } else toolTip.SetToolTip(instancesComboBox, String.Empty); 95 96 IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView; 97 var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm; 98 // lock active view and show progress bar 99 mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance."); 100 // continuation for removing the progess bar from the active view 101 Action<Task> removeProgressFromContent = (_) => mainForm.RemoveOperationProgressFromContent(activeView.Content); 102 103 // task structure: 104 // loadFromProvider 105 // | 106 // +-> on fault -> show error dialog -> remove progress bar 107 // | 108 // `-> success -> loadToProblem 109 // | 110 // +-> on fault -> show error dialog -> remove progress bar 111 // | 112 // `-> success -> set tool tip -> remove progress bar 113 var loadFromProvider = new Task<T>(() => Content.LoadData(descriptor)); 114 115 // success 116 var loadToProblem = loadFromProvider 117 .ContinueWith(task => GenericConsumer.Load(task.Result), TaskContinuationOptions.OnlyOnRanToCompletion); 118 // on error 119 loadFromProvider 120 .ContinueWith(task => { ErrorHandling.ShowErrorDialog(String.Format("Could not load the problem instance {0}", descriptor.Name), task.Exception); }, TaskContinuationOptions.OnlyOnFaulted) 121 .ContinueWith(removeProgressFromContent); 122 123 // success 124 loadToProblem 125 .ContinueWith(task => toolTip.SetToolTip(instancesComboBox, descriptor.Description), TaskContinuationOptions.OnlyOnRanToCompletion) 126 .ContinueWith(removeProgressFromContent); 127 // on error 128 loadToProblem.ContinueWith(task => { ErrorHandling.ShowErrorDialog(String.Format("This problem does not support loading the instance {0}", descriptor.Name), task.Exception); }, TaskContinuationOptions.OnlyOnFaulted) 129 .ContinueWith(removeProgressFromContent); 130 131 // start async loading task 132 loadFromProvider.Start(); 133 } 100 134 } 101 135 }
Note: See TracChangeset
for help on using the changeset viewer.