#region License Information /* HeuristicLab * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System.Collections.Generic; using System.Linq; using HeuristicLab.Encodings.BinaryVectorEncoding; using HeuristicLab.Encodings.IntegerVectorEncoding; using HeuristicLab.Encodings.PermutationEncoding; using HeuristicLab.Encodings.RealVectorEncoding; namespace HeuristicLab.Problems.Programmable { public class ParameterVector { protected Dictionary BinaryParameters; protected Dictionary IntegerParameters; protected Dictionary RealParameters; protected Dictionary PermutationParameters; public ParameterVector(IEnumerable> binaryVectors = null, IEnumerable> integerVectors = null, IEnumerable> realVectors = null, IEnumerable> permutations = null) { if (binaryVectors != null) BinaryParameters = binaryVectors.ToDictionary(x => x.Key, x => x.Value); if (integerVectors != null) IntegerParameters = integerVectors.ToDictionary(x => x.Key, x => x.Value); if (realVectors != null) RealParameters = realVectors.ToDictionary(x => x.Key, x => x.Value); if (permutations != null) PermutationParameters = permutations.ToDictionary(x => x.Key, x => x.Value); } public BinaryVector Binary(string name) { return BinaryParameters[name]; } public bool Binary(string name, int index) { return BinaryParameters[name][index]; } public IEnumerable BinaryNames { get { return BinaryParameters.Keys; } } public IntegerVector Integer(string name) { return IntegerParameters[name]; } public int Integer(string name, int index) { return IntegerParameters[name][index]; } public IEnumerable IntegerNames { get { return IntegerParameters.Keys; } } public RealVector Real(string name) { return RealParameters[name]; } public double Real(string name, int index) { return RealParameters[name][index]; } public IEnumerable RealNames { get { return RealParameters.Keys; } } public Permutation Permutation(string name) { return PermutationParameters[name]; } public IEnumerable PermutationNames { get { return PermutationParameters.Keys; } } } }