Esempio n. 1
1
 public Solution(IModel model, IProblemData problemData)
   : base(model, problemData) {
   Add(new Result(TrainingSharpeRatioResultName, "Share ratio of the signals of the model on the training partition", new DoubleValue()));
   Add(new Result(TestSharpeRatioResultName, "Sharpe ratio of the signals of the model on the test partition", new DoubleValue()));
   Add(new Result(TrainingProfitResultName, "Profit of the model on the training partition", new DoubleValue()));
   Add(new Result(TestProfitResultName, "Profit of the model on the test partition", new DoubleValue()));
 }
Esempio n. 2
0
 public SymbolicSolution(IModel model, IProblemData problemData)
     : base(model, problemData)
 {
     Add(new Result(ModelLengthResultName, "Length of the symbolic trading model.", new IntValue()));
     Add(new Result(ModelDepthResultName, "Depth of the symbolic trading model.", new IntValue()));
     RecalculateResults();
 }
 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, IProblemData problemData, IEnumerable<int> rows) {
   IEnumerable<double> signals = GetSignals(interpreter, solution, problemData.Dataset, rows);
   IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceChangeVariable, rows);
   OnlineCalculatorError errorState;
   double sharpRatio = OnlineSharpeRatioCalculator.Calculate(returns, signals, problemData.TransactionCosts, out errorState);
   if (errorState != OnlineCalculatorError.None) return 0.0;
   else return sharpRatio;
 }
Esempio n. 4
0
 public Solution(IModel model, IProblemData problemData)
     : base(model, problemData)
 {
     Add(new Result(TrainingSharpeRatioResultName, "Share ratio of the signals of the model on the training partition", new DoubleValue()));
     Add(new Result(TestSharpeRatioResultName, "Sharpe ratio of the signals of the model on the test partition", new DoubleValue()));
     Add(new Result(TrainingProfitResultName, "Profit of the model on the training partition", new DoubleValue()));
     Add(new Result(TestProfitResultName, "Profit of the model on the test partition", new DoubleValue()));
 }
        /// <summary>
        /// Ants are implemented predominantly as per "Ant Colony Optimisation" Dorigo and Stutzle (2004), Ch3.8, p103.
        /// </summary>
        /// <param name="id">The ant's unique integer Id.</param>
        /// <param name="problemData">Provides access to the problem-specific parameters and data matrices.</param>
        /// <param name="nodeSelector">Used to select the next node to move to.</param>
        public Ant(int id, IProblemData problemData, INodeSelector nodeSelector)
        {
            Id = id;
              _problemData = problemData;
              _nodeSelector = nodeSelector;

              // Ant ultimately returns to starting node.
              _tour = new int[_problemData.NodeCount + 1];
              _visited = new bool[_problemData.NodeCount];
        }
Esempio n. 6
0
 public SymbolicSolution(IModel model, IProblemData problemData)
   : base(model, problemData) {
   Add(new Result(ModelLengthResultName, "Length of the symbolic trading model.", new IntValue()));
   Add(new Result(ModelDepthResultName, "Depth of the symbolic trading model.", new IntValue()));
   RecalculateResults();
 }
 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IProblemData problemData, IEnumerable<int> rows) {
   SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
   double sharpRatio = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, problemData, rows);
   SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
   return sharpRatio;
 }
Esempio n. 8
0
        public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IProblemData problemData, IEnumerable <int> rows)
        {
            SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
            double sharpRatio = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, problemData, rows);

            SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
            return(sharpRatio);
        }
Esempio n. 9
0
        public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, IProblemData problemData, IEnumerable <int> rows)
        {
            IEnumerable <double>  signals = GetSignals(interpreter, solution, problemData.Dataset, rows);
            IEnumerable <double>  returns = problemData.Dataset.GetDoubleValues(problemData.PriceChangeVariable, rows);
            OnlineCalculatorError errorState;
            double sharpRatio = OnlineSharpeRatioCalculator.Calculate(returns, signals, problemData.TransactionCosts, out errorState);

            if (errorState != OnlineCalculatorError.None)
            {
                return(0.0);
            }
            else
            {
                return(sharpRatio);
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="problemData">The problem specific <seealso cref="StandardProblemData"/> object containing distance,
 /// pheromone, heuristic and choice info information.</param>
 /// <param name="random">The global random number generator object.</param>
 public RouletteWheelSelector(IProblemData problemData, Random random)
 {
     _problemData = problemData;
       _random = random;
       _probabilities = new double[problemData.NodeCount];
 }
 public NearestNeighbourSelector(IProblemData problemData)
 {
     _problemData = problemData;
 }