Opened 10 years ago
Closed 8 years ago
#2281 closed feature request (done)
New parameter type for storing results
Reported by: | mkommend | Owned by: | abeham |
---|---|---|---|
Priority: | medium | Milestone: | HeuristicLab 3.3.14 |
Component: | Optimization | Version: | 3.3.10 |
Keywords: | Cc: |
Description (last modified by mkommend)
It is quite cumbersome to store results in the result collection from an analyzer. One has to look up the result collection, check if the results already exists and eventually create it and set the value. This procedure is the same for each produced results and should be performed by a specialized parameter, so that all of the steps above are simplified to:
ResultsParameter.Value = bestSolution;
The following functionality should be provided:
- ResultsParameter automatically look up the results collection
- ResultsParameter provide a ResultsName property
- It is possible to set an initial value of the ResultsParameter (avoid null checks)
- The indexer of ResultCollection should return the value instead of the result
Furthermore, the results parameter should provide the possibility to change the name of the produced result.
Attachments (3)
Change History (28)
comment:1 Changed 10 years ago by mkommend
- Description modified (diff)
- Priority changed from high to medium
comment:2 Changed 10 years ago by mkommend
- Milestone changed from HeuristicLab 3.3.11 to HeuristicLab 3.3.12
comment:3 Changed 10 years ago by abeham
- Owner changed from mkommend to abeham
- Status changed from new to accepted
Changed 10 years ago by abeham
comment:4 Changed 10 years ago by abeham
- Owner changed from abeham to mkommend
- Status changed from accepted to assigned
Please have a look at the patch. A few issues that should be noted here that have also been discussed:
- The new parameter halves the amount of LOC in the Apply method of the QualityDistributionAnalyzer. The ctor becomes a bit more complex though. There is a much nicer separation though. Additionally, there is the benefit that the ResultName may be configured in the GUI without additional parameters.
- It is not possible to put this parameter in the HeuristicLab.Parameters plugin. The reason is that ResultCollection is not accessible in this assembly. It was decided to put it into HeuristicLab.Optimization.
- A new interface IContextualParameter was introduced that is the new base to ILookupParameter and IResultParameter and which exposes only the ExecutionContext property. This is needed, because Operator currently only sets the ExecutionContext for ILookupParameters. IContextualParameter may not yet be the final name (suggestions necessary).
- A view for the new parameter is not yet included in the patch.
- Backwards compatibility of the adapted operator is not accounted for.
comment:5 Changed 10 years ago by mkommend
- Owner changed from mkommend to architects
comment:6 Changed 10 years ago by abeham
- Owner changed from architects to abeham
- Status changed from assigned to accepted
Derive ResultParameter<T> from LookupParameter<ResultCollection> and reuse the lookup mechanism.
comment:7 Changed 10 years ago by abeham
- Component changed from Parameters to Optimization
- Owner changed from abeham to mkommend
- Status changed from accepted to reviewing
Please have a look at the new patch. I regrouped files in HeuristicLab.Optimization and made the changes described in the architects meeting.
Open points:
- Make the ResultParameter class a [NonDiscoverableType], as otherwise users would probably use them in the GUI - they don't do anything when added in the GUI
- I put the interface in HeuristicLab.Optimization and chose to derive from ILookupParameter<ResultCollection> so that I can derive from the lookup parameter's view
comment:8 Changed 10 years ago by abeham
Btw, I did come up with cases where ResultParameter makes sense in the GUI. E.g. when making a ProgrammableAnalyzer I would want to add a ResultParameter. But then the problem is that we need to configure the DefaultValue in the GUI.
comment:9 Changed 10 years ago by mkommend
- Owner changed from mkommend to abeham
- Status changed from reviewing to assigned
Reviewed the attached patch resultparameter2.patch. IMHO the changes look fine and are ready for inclusion in the trunk. However, two minor improvements should be included:
- A different item image for result parameters, to distinguish them in the GUI (save as?)
- The result type should also be displayed in the ResultParameterView
comment:10 Changed 9 years ago by ascheibe
- Milestone changed from HeuristicLab 3.3.12 to HeuristicLab 3.3.13
comment:11 Changed 9 years ago by abeham
- Milestone changed from HeuristicLab 3.3.13 to HeuristicLab 4.0.x Backlog
comment:12 Changed 8 years ago by mkommend
- Milestone changed from HeuristicLab 4.0 to HeuristicLab 3.3.14
comment:13 Changed 8 years ago by mkommend
- Owner changed from abeham to mkommend
- Status changed from assigned to accepted
comment:14 Changed 8 years ago by mkommend
r14037: Refactored LookupParameter<T> to prepare for the ResultsParamter and make the name translation methods reusable.
comment:15 Changed 8 years ago by mkommend
- Owner changed from mkommend to abeham
- Status changed from accepted to assigned
comment:16 Changed 8 years ago by abeham
- Moved check if context contains a parameter of the requested translated name to the front of the loop
- Reason is that ResultsParameter queries for a parameter "Results" which doesn't exist in its own context
- Added a flag to suppress the type check in LookupParameter's GetValue
- Default value of that flag is true, so existing code is not affected
- Reason is that ResultsParameter queries for ResultCollection while having a generic type e.g. IntValue which don't match
- Replaced some ContainsKey/Access combinations with TryGetValue
comment:17 Changed 8 years ago by abeham
r14057: moved type verification to member method
comment:18 Changed 8 years ago by abeham
- Owner changed from abeham to mkommend
- Status changed from assigned to reviewing
The ResultsParameter has been committed to the PerformanceComparison branch in r14058:14059. I used the exception icon as it is more subtle and also fits more nicely into a pattern with the OperatorParameter. Also, it's a discoverable type now and can be used in e.g. ProgrammableOperators.
comment:19 Changed 8 years ago by mkommend
comment:20 Changed 8 years ago by abeham
r14071: merged ResultParameter to trunk
I removed two references from Parameters.Views to Optimization and Optimization.Views respectively, because I needed them they other way around. They were not necessary for Parameters.Views.
We should release revisions: 14037,14056,14057,14071.
Please forward ticket to release if you're ready.
comment:21 Changed 8 years ago by mkommend
- Owner changed from mkommend to abeham
- Status changed from reviewing to readytorelease
I am ready.
comment:22 Changed 8 years ago by abeham
r14100: Fixed description of result parameter not appearing in result (thx to mkommend)
comment:23 Changed 8 years ago by mkommend
comment:24 Changed 8 years ago by abeham
- made setter more robust and removed redundant null check
- I had a backwards compatibility problem with previously stored files, resultCollectionName could never be set if it was null to begin with
comment:25 Changed 8 years ago by abeham
- Resolution set to done
- Status changed from readytorelease to closed
Patching the trunk to include the result parameter, also adapts QualityDistributionAnalyzer to use this new parameter