Changeset 6733 for branches/GeneralizedQAP/HeuristicLab.Services.ProblemInstances/QAP/QAPInstanceDto.cs
- Timestamp:
- 09/10/11 16:25:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Services.ProblemInstances/QAP/QAPInstanceDto.cs
r6659 r6733 1 2 #region License Information 1 #region License Information 3 2 /* HeuristicLab 4 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 22 21 23 22 using System; 23 using System.Linq; 24 24 using System.Runtime.Serialization; 25 25 … … 37 37 [DataMember] 38 38 public double[][] Distances { get; set; } 39 [DataMember] 40 public double BestKnownQuality { get; set; } 41 [DataMember] 42 public bool HasBestKnownQuality { get; set; } 39 43 40 44 public QAPInstanceDto() { … … 43 47 44 48 public QAPInstanceDto(QAPInstance qAPInstance) { 45 Name = qAPInstance. name;46 Description = qAPInstance. description;47 Maximization = qAPInstance. maximization;49 Name = qAPInstance.Name; 50 Description = qAPInstance.Description; 51 Maximization = qAPInstance.Maximization; 48 52 try { 49 Weights = PrimitiveSerializer.DeserializeDoubleMatrix(qAPInstance.weights);50 Distances = PrimitiveSerializer.DeserializeDoubleMatrix(qAPInstance.distances);53 Weights = SimpleSerializer.DeserializeDoubleMatrix(qAPInstance.Weights); 54 Distances = SimpleSerializer.DeserializeDoubleMatrix(qAPInstance.Distances); 51 55 } catch (ArgumentException e) { 52 throw new PrimitiveSerializationException("Failed to deserialize the weights or distance matrix.", e); 56 throw new SimpleSerializationException("Failed to deserialize the weights or distance matrix.", e); 57 } 58 BestKnownQuality = double.NaN; 59 HasBestKnownQuality = false; 60 if (qAPInstance.Solutions.Any()) { 61 double bestQuality; 62 if (Maximization) bestQuality = qAPInstance.Solutions.Max(x => x.Quality); 63 else bestQuality = qAPInstance.Solutions.Min(x => x.Quality); 64 HasBestKnownQuality = true; 53 65 } 54 66 }
Note: See TracChangeset
for help on using the changeset viewer.