ningshuxia
2022-12-12 e78f5936fee9ab4fff600515bb20a41a28f329c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using IStation.Numerics.LinearAlgebra;
using System.Collections.Generic;
 
namespace IStation.Numerics.Optimization
{
    public interface IObjectiveModelEvaluation
    {
        IObjectiveModel CreateNew();
 
        /// <summary>
        /// Get the y-values of the observations.
        /// </summary>
        Vector<double> ObservedY { get; }
 
        /// <summary>
        /// Get the values of the weights for the observations.
        /// </summary>
        Matrix<double> Weights { get; }
 
        /// <summary>
        /// Get the y-values of the fitted model that correspond to the independent values.
        /// </summary>
        Vector<double> ModelValues { get; }
 
        /// <summary>
        /// Get the values of the parameters.
        /// </summary>
        Vector<double> Point { get; }
 
        /// <summary>
        /// Get the residual sum of squares.
        /// </summary>
        double Value { get; }
 
        /// <summary>
        /// Get the Gradient vector. G = J'(y - f(x; p))
        /// </summary>
        Vector<double> Gradient { get; }
 
        /// <summary>
        /// Get the approximated Hessian matrix. H = J'J
        /// </summary>
        Matrix<double> Hessian { get; }
 
        /// <summary>
        /// Get the number of calls to function.
        /// </summary>
        int FunctionEvaluations { get; set; }
 
        /// <summary>
        /// Get the number of calls to jacobian.
        /// </summary>
        int JacobianEvaluations { get; set; }
 
        /// <summary>
        /// Get the degree of freedom.
        /// </summary>
        int DegreeOfFreedom { get; }
 
        bool IsGradientSupported { get; }
        bool IsHessianSupported { get; }
    }
 
    public interface IObjectiveModel : IObjectiveModelEvaluation
    {
        void SetParameters(Vector<double> initialGuess, List<bool> isFixed = null);
 
        void EvaluateAt(Vector<double> parameters);
 
        IObjectiveModel Fork();
 
        IObjectiveFunction ToObjectiveFunction();
    }
}