C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
OptimizationView.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Runtime.Serialization;
4using System.ComponentModel;
5
10
12{
15 {
16 #region APIResource Interface Members
18 public static readonly string CLASS_COLLECTION_NAME = "optimization_views";
19
22 public override string collection_name => CLASS_COLLECTION_NAME;
23 #endregion APIResource Interface Members
24
25 #region Public Properties
27 [DataMember(Order = 12)]
28 [GreaterThan(1, true)]
29 [LessThan(10000, true)]
30 public int iterations { get; set; }
31
33 [DataMember(Order = 13)]
34 [GreaterThan(1, true)]
35 [LessThan(10000, true)]
36 public int population_size { get; set; }
37
39 [DataMember(Order = 14)]
40 [NotNull]
42
44 [DataMember(Order = 15)]
45 [NotNull]
46 [NotEmpty]
47 public List<DomainEntry> domains { get; set; }
48
51 [DataMember(Order = 16)]
52 [NotNull]
53 [NotEmpty]
55
58 [DataMember(Order = 17)]
60 public string target_currency { get; set; }
61
63 [DataMember(Order = 99)]
65 [DisplayName("Run Time")]
66 public RunTime runtime_seconds { get; set; }
69 [DataMember(Order = 100)]
71 public double progress { get; set; }
72
73 #region Endpoints and Sub-Resources
74
75 #region Private Fields
77 private Candidates _candidates;
78
80 private DataSubResource _csv;
81
83 private SubResource<OptimizationResult> _initialPortfolioResult;
84
86 private SubResource<SensitivityAnalysis> _sensitivityAnalysis;
87 #endregion Private Fields
88
93 public Candidates candidates => _candidates ?? (_candidates = new Candidates(this));
94
98 public DataSubResource csv => _csv ?? (_csv = new DataSubResource(this, "csv"));
99
106 (_initialPortfolioResult = new SubResource<OptimizationResult>(this, "initial_portfolio_metrics"));
107
112 (_sensitivityAnalysis = new SubResource<SensitivityAnalysis>(this, "sensitivity_analysis"));
113 #endregion Endpoints and Sub-Resources
114
115 #region Deprecated
119 [Obsolete("2018-04-23: The initial_portfolio_metrics attribute is deprecated, " +
120 "please use initial_portfolio_result instead.")]
121 [DataMember(Order = 18)]
124
128 [Obsolete("2018-04-23: This endpoint is being deprecated because it isn't scalable. " +
129 "The preferred method is now to paginate the /candidates/ endpoint or to " +
130 "download the entire results set as a .csv file via the /csv/ endpoint.")]
132 {
133 DefaultTimeout = API.DefaultRequestTimeoutCollections
134 };
135 #endregion Deprecated
136 #endregion Public Properties
137
138 #region Constructor
145
147 protected override void AfterMembersCloned(APIType _)
148 {
149 base.AfterMembersCloned(_);
150 _candidates = null;
151 _csv = null;
152 _initialPortfolioResult = null;
153 _sensitivityAnalysis = null;
154 }
155 #endregion Constructor
156
157 #region Public Methods
164
173 .AddQueryParameter(nameof(candidates), String.Join(",", candidates)), timeout_ms);
174
182 candidates.GetItem($"{candidateIndex:0}", timeout: timeout_ms);
183
191 {
192 // We don't need to retrieve the actual Candidate instance to get its portfolio_view,
193 // just create one with the correct id so we can navigate to the sub-resource.
194 return new Candidate
195 {
196 optimization_view = this.ToReference(),
197 index = candidateIndex
198 }.portfolio_view.Get(timeout: timeout_ms);
199 }
200
207 public long GetCandidateResultsCount(int? timeout_ms = null) =>
209 #endregion Public Methods
210 }
211}
Attribute used to define the default value assigned to the target_currency property by the server whe...
Base class used by all types and resources.
Definition APIType.cs:8
Describes an additional data sub-resource available off a resource. Endpoint supports GET and PUT.
Describes a collection of resources which can be listed.
Base class for a StoredAPIResource that has a "status" property and corresponding "status_message" wh...
Specifies that a property is generated by the server and should not be specified on the client side d...
A candidate is a potential solution to the optimization problem.
Definition Candidate.cs:11
A sub-collection of candidate results that exists off of an OptimizationView resource.
Definition Candidates.cs:7
Object to map metrics on the initial portfolio.
Representation of a set of Optimization Parameters.
int iterations
The maximum number of iterations to perform during the optimization.
DataSubResource csv
Allows retrieval of the YLT (Year Loss Table) associated with this view once it has been simulated.
SubResource< CandidateResultsList > result
Get the result of this OptimizationView. Will return a 503 with a Retry-After if not ready.
static readonly string CLASS_COLLECTION_NAME
The collection endpoint at which resources of this type reside on the server.
SubResource< OptimizationResult > initial_portfolio_result
Once this optimization's run has completed, this will contain the objective, constraint,...
IReference< AnalysisProfile > analysis_profile
The optimizations's analysis profile.
OptimizationView()
Construct a new OptimizationView with empty domain and custom_parameters lists.
Dictionary< string, object > custom_parameters
A key/value pair dictionary of additional parameters taken by the optimization function.
PortfolioView GetCandidatePortfolioView(int candidateIndex, int? timeout_ms=null)
Retrieves a PortfolioView corresponding to the specified candidate portfolio result,...
OptimizationResult GetInitialPortfolioMetrics(int? timeout_ms=null)
Retrieves the initial portfolio metrics, which contain the objective, constraint, and feasibility res...
int population_size
The population size to use in the optimization.
SubResource< SensitivityAnalysis > sensitivity_analysis
Once an optimization run has completed, this endpoint can be used to perform a sensitivity analysis o...
Candidates candidates
A collection of optimization result from this Optimization run. Will return a 503 with a Retry-After ...
Dictionary< string, double > initial_portfolio_metrics
Once this optimization's run has completed, this will contain the objective metrics' results for the ...
long GetCandidateResultsCount(int? timeout_ms=null)
Retrieves the number of candidate results produced by this optimization run. Note that you can also g...
string target_currency
The currency that this optimization's results should be returned in.
Candidate GetCandidateResult(int candidateIndex, int? timeout_ms=null)
Retrieves the specified candidate portfolio result, which contains its metrics (objective,...
SensitivityAnalysis GetSensitivityAnalysis(IEnumerable< int > candidates=null, int? timeout_ms=null)
Retrieves sensitivity analysis metrics, which contain the min, max, mean share, normalized standard d...
override string collection_name
The collection endpoint at which resources of this type reside on the server.
List< DomainEntry > domains
The list of layers to be optimized and their min/max constraints.
override void AfterMembersCloned(APIType _)
Invoked following construction if the current instance has been created using a member-wise clone of ...
double progress
The fractional progress made in completing this optimization, as a number between 0 and 1 (where 1 me...
RunTime runtime_seconds
The optimization run time.
Sensitivity analysis for the optimization view.
Represents the Analysis of a Portfolio.
Helper class which makes it easier to build a set of request parameters.
User-friendly representation of the numeric optimization runtime_seconds field. Wraps a nullable doub...
Definition RunTime.cs:10
Interface for resources that reference an analysis profile.