Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/10/11 16:25:22 (13 years ago)
Author:
abeham
Message:

#1619

  • Updated the model slightly
  • Deployed the service
  • Updated the GUI to perform asynchronous calls to the service
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
    32/* HeuristicLab
    43 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    2221
    2322using System;
     23using System.Linq;
    2424using System.Runtime.Serialization;
    2525
     
    3737    [DataMember]
    3838    public double[][] Distances { get; set; }
     39    [DataMember]
     40    public double BestKnownQuality { get; set; }
     41    [DataMember]
     42    public bool HasBestKnownQuality { get; set; }
    3943
    4044    public QAPInstanceDto() {
     
    4347
    4448    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;
    4852      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);
    5155      } 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;
    5365      }
    5466    }
Note: See TracChangeset for help on using the changeset viewer.