Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3467 for trunk/sources


Ignore:
Timestamp:
04/21/10 18:33:42 (15 years ago)
Author:
svonolfe
Message:

Added simple view for the KnapsackProblem (#917)

Location:
trunk/sources
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Knapsack.Views/3.3/HeuristicLab.Problems.Knapsack.Views-3.3.csproj

    r3437 r3467  
    8383  <ItemGroup>
    8484    <Compile Include="HeuristicLabProblemsKnapsackViewsPlugin.cs" />
     85    <Compile Include="KnapsackSolutionView.cs">
     86      <SubType>UserControl</SubType>
     87    </Compile>
     88    <Compile Include="KnapsackSolutionView.Designer.cs">
     89      <DependentUpon>KnapsackSolutionView.cs</DependentUpon>
     90    </Compile>
    8591    <Compile Include="Properties\AssemblyInfo.cs" />
     92    <Compile Include="Properties\Resources.Designer.cs">
     93      <AutoGen>True</AutoGen>
     94      <DesignTime>True</DesignTime>
     95      <DependentUpon>Resources.resx</DependentUpon>
     96    </Compile>
    8697  </ItemGroup>
    8798  <ItemGroup>
     
    95106      <Name>HeuristicLab.Collections-3.3</Name>
    96107    </ProjectReference>
     108    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj">
     109      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
     110      <Name>HeuristicLab.Common.Resources-3.2</Name>
     111    </ProjectReference>
     112    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
     113      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     114      <Name>HeuristicLab.Common-3.3</Name>
     115    </ProjectReference>
    97116    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    98117      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
     
    102121      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    103122      <Name>HeuristicLab.Core-3.3</Name>
     123    </ProjectReference>
     124    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
     125      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
     126      <Name>HeuristicLab.Data-3.3</Name>
     127    </ProjectReference>
     128    <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">
     129      <Project>{66D249C3-A01D-42A8-82A2-919BC8EC3D83}</Project>
     130      <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>
    104131    </ProjectReference>
    105132    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
     
    119146      <Name>HeuristicLab.Optimization-3.3</Name>
    120147    </ProjectReference>
     148    <ProjectReference Include="..\..\HeuristicLab.Optimizer\3.3\HeuristicLab.Optimizer-3.3.csproj">
     149      <Project>{C664305E-497C-4533-A140-967DEDB05C19}</Project>
     150      <Name>HeuristicLab.Optimizer-3.3</Name>
     151    </ProjectReference>
     152    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     153      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     154      <Name>HeuristicLab.Persistence-3.3</Name>
     155    </ProjectReference>
    121156    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    122157      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     
    127162      <Name>HeuristicLab.Problems.Knapsack-3.3</Name>
    128163    </ProjectReference>
     164  </ItemGroup>
     165  <ItemGroup>
     166    <EmbeddedResource Include="KnapsackSolutionView.resx">
     167      <DependentUpon>KnapsackSolutionView.cs</DependentUpon>
     168    </EmbeddedResource>
     169    <EmbeddedResource Include="Properties\Resources.resx">
     170      <Generator>ResXFileCodeGenerator</Generator>
     171      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     172    </EmbeddedResource>
    129173  </ItemGroup>
    130174  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.Problems.Knapsack.Views/3.3/HeuristicLabProblemsKnapsackViewsPlugin.cs.frame

    r3437 r3467  
    2929  [PluginFile("HeuristicLab.Problems.Knapsack.Views-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
     31  [PluginDependency("HeuristicLab.Common", "3.3")]
     32  [PluginDependency("HeuristicLab.Common.Resources", "3.2")]
    3133  [PluginDependency("HeuristicLab.Core", "3.3")]
    3234  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
     35  [PluginDependency("HeuristicLab.Data", "3.3")]
     36  [PluginDependency("HeuristicLab.Encodings.BinaryVectorEncoding", "3.3")]
    3337  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3438  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3539  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3640  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
     41  [PluginDependency("HeuristicLab.Optimizer", "3.3")]
    3742  [PluginDependency("HeuristicLab.Problems.Knapsack", "3.3")]
    3843  public class HeuristicLabProblemsKnapsackViewsPlugin : PluginBase {
  • trunk/sources/HeuristicLab.Problems.Knapsack/3.3/HeuristicLab.Problems.Knapsack-3.3.csproj

    r3384 r3467  
    8787    <Compile Include="Interfaces\IKnapsackMoveEvaluator.cs" />
    8888    <Compile Include="KnapsackProblem.cs" />
     89    <Compile Include="KnapsackSolution.cs" />
    8990    <Compile Include="MoveEvaluators\KnapsackMoveEvaluator.cs" />
    9091    <Compile Include="MoveEvaluators\KnapsackOneBitflipMoveEvaluator.cs" />
    9192    <Compile Include="Properties\AssemblyInfo.cs" />
     93    <Compile Include="Visualizers\BestKnapsackVisualizer.cs" />
    9294  </ItemGroup>
    9395  <ItemGroup>
  • trunk/sources/HeuristicLab.Problems.Knapsack/3.3/Interfaces/IKnapsackSolutionsVisualizer.cs

    r3116 r3467  
    2121
    2222using HeuristicLab.Optimization;
     23using HeuristicLab.Core;
     24using HeuristicLab.Encodings.BinaryVectorEncoding;
     25using HeuristicLab.Data;
    2326
    2427namespace HeuristicLab.Problems.Knapsack {
     
    2629  /// An interface which represents an operator for visualizing solutions of Knapsack Problems.
    2730  /// </summary>
    28   public interface IKnapsackSolutionsVisualizer : ISingleObjectiveSolutionsVisualizer { }
     31  public interface IKnapsackSolutionsVisualizer : ISingleObjectiveSolutionsVisualizer {
     32    ILookupParameter<ItemArray<BinaryVector>> BinaryVectorParameter { get; }
     33    ILookupParameter<IntValue> KnapsackCapacityParameter { get; }
     34    ILookupParameter<IntArray> WeightsParameter { get; }
     35    ILookupParameter<IntArray> ValuesParameter { get; }
     36  }
    2937}
  • trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs

    r3463 r3467  
    3232using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3333using HeuristicLab.PluginInfrastructure;
     34using HeuristicLab.Problems.Knapsack.Visualizers;
    3435
    3536namespace HeuristicLab.Problems.Knapsack {
     
    161162      RandomBinaryVectorCreator creator = new RandomBinaryVectorCreator();
    162163      KnapsackEvaluator evaluator = new KnapsackEvaluator();
     164      IKnapsackSolutionsVisualizer visualizer = new BestKnapsackVisualizer();
    163165
    164166      Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to true as the Knapsack Problem is a maximization problem.", new BoolValue(true)));
     
    170172      Parameters.Add(new ValueParameter<IKnapsackEvaluator>("Evaluator", "The operator which should be used to evaluate Knapsack solutions.", evaluator));
    171173      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this Knapsack instance."));
    172       Parameters.Add(new ValueParameter<IKnapsackSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize Knapsack solutions.", null));
     174      Parameters.Add(new ValueParameter<IKnapsackSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize Knapsack solutions.", visualizer));
    173175
    174176      creator.BinaryVectorParameter.ActualName = "KnapsackSolution";
     
    179181      ParameterizeSolutionCreator();
    180182      ParameterizeEvaluator();
     183      ParameterizeVisualizer();
    181184
    182185      Initialize();
     
    219222      ParameterizeSolutionCreator();
    220223      ParameterizeEvaluator();
     224      ParameterizeVisualizer();
    221225      ParameterizeOperators();
    222226      OnSolutionCreatorChanged();
     
    224228    private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
    225229      ParameterizeEvaluator();
     230      ParameterizeVisualizer();
    226231      ParameterizeOperators();
    227232    }
    228233    private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
    229234      ParameterizeEvaluator();
     235      ParameterizeVisualizer();
    230236      OnEvaluatorChanged();
    231237    }
    232238    void KnapsackCapacityParameter_ValueChanged(object sender, EventArgs e) {
    233239      ParameterizeEvaluator();
     240      ParameterizeVisualizer();
    234241    }
    235242    void WeightsParameter_ValueChanged(object sender, EventArgs e) {
    236243      ParameterizeEvaluator();
     244      ParameterizeVisualizer();
    237245      ParameterizeSolutionCreator();
    238246
     
    247255    void ValuesParameter_ValueChanged(object sender, EventArgs e) {
    248256      ParameterizeEvaluator();
     257      ParameterizeVisualizer();
    249258      ParameterizeSolutionCreator();
    250259
     
    302311      }
    303312    }
     313    private void ParameterizeVisualizer() {
     314      if (Visualizer is IKnapsackSolutionsVisualizer) {
     315        IKnapsackSolutionsVisualizer visualizer =
     316          (IKnapsackSolutionsVisualizer)Visualizer;
     317        visualizer.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName;
     318        visualizer.KnapsackCapacityParameter.ActualName = KnapsackCapacityParameter.Name;
     319        visualizer.WeightsParameter.ActualName = WeightsParameter.Name;
     320        visualizer.ValuesParameter.ActualName = ValuesParameter.Name;
     321      }
     322    }
    304323    private void InitializeOperators() {
    305324      operators = new List<IBinaryVectorOperator>();
Note: See TracChangeset for help on using the changeset viewer.