Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/13/10 02:14:39 (14 years ago)
Author:
abeham
Message:

#1258

  • Updated binding according to discussion
  • Added small test case for the TSP
Location:
branches/ParameterBinding
Files:
2 added
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ParameterBinding/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r4758 r4787  
    143143    <Compile Include="Constraints\IConstraint.cs" />
    144144    <Compile Include="Constraints\TypeCompatibilityConstraint.cs" />
    145     <Compile Include="Interfaces\IParameterBinding.cs" />
     145    <Compile Include="Interfaces\IItemBinding.cs" />
     146    <Compile Include="ItemBinding.cs" />
    146147    <Compile Include="OperatorExecutionException.cs" />
    147148    <Compile Include="Interfaces\IScopeTreeLookupParameter.cs" />
  • branches/ParameterBinding/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs

    r4770 r4787  
    3333  public abstract class ParameterizedNamedItem : NamedItem, IParameterizedNamedItem {
    3434    [Storable]
    35     private List<IParameterBinding> parameterBindingList;
    36     public List<IParameterBinding> ParameterBindingList {
     35    private List<IItemBinding> parameterBindingList;
     36    public List<IItemBinding> ParameterBindingList {
    3737      get { return parameterBindingList; }
    3838    }
     
    6262      name = ItemName;
    6363      description = ItemDescription;
    64       parameterBindingList = new List<IParameterBinding>();
     64      parameterBindingList = new List<IItemBinding>();
    6565      parameters = new ParameterCollection();
    6666      readOnlyParameters = null;
     
    6969      : base(name) {
    7070      description = ItemDescription;
    71       parameterBindingList = new List<IParameterBinding>();
     71      parameterBindingList = new List<IItemBinding>();
    7272      parameters = new ParameterCollection();
    7373      readOnlyParameters = null;
     
    7676      : base(name) {
    7777      description = ItemDescription;
    78       parameterBindingList = new List<IParameterBinding>();
     78      parameterBindingList = new List<IItemBinding>();
    7979      this.parameters = parameters;
    8080      readOnlyParameters = null;
     
    8282    protected ParameterizedNamedItem(string name, string description)
    8383      : base(name, description) {
    84       parameterBindingList = new List<IParameterBinding>();
     84      parameterBindingList = new List<IItemBinding>();
    8585      parameters = new ParameterCollection();
    8686      readOnlyParameters = null;
     
    8888    protected ParameterizedNamedItem(string name, string description, ParameterCollection parameters)
    8989      : base(name, description) {
    90       parameterBindingList = new List<IParameterBinding>();
     90      parameterBindingList = new List<IItemBinding>();
    9191      this.parameters = parameters;
    9292      readOnlyParameters = null;
     
    105105    }
    106106
     107    protected virtual void AddBinding(string targetPath, string sourcePath) {
     108      ItemBinding binding = new ItemBinding(this, targetPath, this, sourcePath);
     109      parameterBindingList.Add(binding);
     110      binding.Bind();
     111    }
     112
     113    protected virtual void AddSourceBinding(IDeepCloneable target, string targetPath, string sourcePath) {
     114      ItemBinding binding = new ItemBinding(target, targetPath, this, sourcePath);
     115      parameterBindingList.Add(binding);
     116      binding.Bind();
     117    }
     118
     119    protected virtual void AddTargetBinding(string targetPath, IDeepCloneable source, string sourcePath) {
     120      ItemBinding binding = new ItemBinding(this, targetPath, source, sourcePath);
     121      parameterBindingList.Add(binding);
     122      binding.Bind();
     123    }
     124
    107125    [StorableHook(HookType.AfterDeserialization)]
    108126    private void AfterDeserialization() {
     
    110128      #region Remove this code when going to 3.4
    111129      if (parameterBindingList == null)
    112         parameterBindingList = new List<IParameterBinding>();
     130        parameterBindingList = new List<IItemBinding>();
    113131      #endregion
    114132    }
  • branches/ParameterBinding/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj

    r4770 r4787  
    111111    <None Include="HeuristicLabParametersPlugin.cs.frame" />
    112112    <Compile Include="ConstrainedValueParameter.cs" />
    113     <Compile Include="ParameterSecondLevelNameBinding.cs" />
    114     <Compile Include="ParameterValueBinding.cs" />
    115113    <Compile Include="OptionalConstrainedValueParameter.cs" />
    116     <Compile Include="ParameterNameBinding.cs" />
    117114    <Compile Include="ScopeTreeLookupParameter.cs" />
    118115    <Compile Include="ValueParameter.cs" />
  • branches/ParameterBinding/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs

    r4770 r4787  
    178178      InitializeOperators();
    179179      AttachEventHandlers();
     180
     181      AddBinding("BestTSPSolutionAnalyzer.QualityParameter.ActualName", "Evaluator.QualityParameter.ActualName");
     182      AddBinding("BestTSPSolutionAnalyzer.CoordinatesParameter.ActualName", "CoordinatesParameter.Name");
     183      AddBinding("BestTSPSolutionAnalyzer.PermutationParameter.ActualName", "SolutionCreator.PermutationParameter.ActualName");
     184      AddBinding("BestTSPSolutionAnalyzer.BestKnownQualityParameter.ActualName", "BestKnownQualityParameter.Name");
     185      AddBinding("BestTSPSolutionAnalyzer.BestKnownSolutionParameter.ActualName", "BestKnownSolutionParameter.Name");
     186      AddBinding("BestTSPSolutionAnalyzer.MaximizationParameter.ActualName", "MaximizationParameter.Name");
     187      BestTSPSolutionAnalyzer.ResultsParameter.ActualName = "Results";
    180188    }
    181189
     
    320328    }
    321329    private void ParameterizeAnalyzers() {
    322       if (BestTSPSolutionAnalyzer != null) {
    323         #region Using First Level Bindings
    324         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    325           BestTSPSolutionAnalyzer.QualityParameter,
    326           Evaluator.QualityParameter
    327           ));
    328         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    329           BestTSPSolutionAnalyzer.CoordinatesParameter,
    330           CoordinatesParameter
    331           ));
    332         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    333           BestTSPSolutionAnalyzer.PermutationParameter,
    334           SolutionCreator.PermutationParameter
    335           ));
    336         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    337           BestTSPSolutionAnalyzer.BestKnownQualityParameter,
    338           BestKnownQualityParameter
    339           ));
    340         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    341           BestTSPSolutionAnalyzer.BestKnownSolutionParameter,
    342           BestKnownSolutionParameter
    343           ));
    344         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding(
    345           BestTSPSolutionAnalyzer.MaximizationParameter,
    346           MaximizationParameter
    347           ));
    348         #endregion
    349         #region Using Second Level Bindings
    350         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterSecondLevelNameBinding(
    351           BestTSPSolutionAnalyzer.QualityParameter,
    352           EvaluatorParameter, "QualityParameter"
    353           ));
    354         BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterSecondLevelNameBinding(
    355            BestTSPSolutionAnalyzer.PermutationParameter,
    356            SolutionCreatorParameter, "PermutationParameter"
    357            ));
    358         #endregion
    359         #region Old
     330      /*if (BestTSPSolutionAnalyzer != null) {
    360331        BestTSPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    361332        BestTSPSolutionAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
     
    365336        BestTSPSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
    366337        BestTSPSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
    367         #endregion
    368       }
     338      }*/
    369339
    370340      if (TSPAlleleFrequencyAnalyzer != null) {
Note: See TracChangeset for help on using the changeset viewer.