Free cookie consent management tool by TermsFeed Policy Generator

source: branches/MPI/HeuristicLab.Operators.MPISupport/3.3/BinaryTransport/ItemTransfer.cs @ 11291

Last change on this file since 11291 was 7544, checked in by svonolfe, 13 years ago

Improved performance, added MPISolutionsCreator (#1542)

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Data;
7using HeuristicLab.Encodings.PermutationEncoding;
8using HeuristicLab.Problems.VehicleRouting.Interfaces;
9
10namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
11  class ItemTransfer {
12    public static object Convert(IItem item) {
13      if (item is IScope)
14        return ScopeTransfer.Convert(item as IScope);
15      else if (item is IVariable)
16        return VariableTransfer.Convert(item as IVariable);
17      else if (item is DoubleValue)
18        return DoubleValueTransfer.Convert(item as DoubleValue);
19      else if (item is IntValue)
20        return IntValueTransfer.Convert(item as IntValue);
21      else if (item is IVRPEncoding)
22        return VRPTransfer.Convert(item as IVRPEncoding);
23      else if (item is Permutation)
24        return PermutationTransfer.Convert(item as Permutation);
25      else
26        return null;
27    }
28
29    public static IItem Convert(object item, IExecutionContext globalScope) {
30      if (item is ScopeTransfer)
31        return ScopeTransfer.Convert(item as ScopeTransfer, globalScope);
32      else if (item is VariableTransfer)
33        return VariableTransfer.Convert(item as VariableTransfer, globalScope);
34      else if (item is DoubleValueTransfer)
35        return DoubleValueTransfer.Convert(item as DoubleValueTransfer);
36      else if (item is IntValueTransfer)
37        return IntValueTransfer.Convert(item as IntValueTransfer);
38      else if (item is PermutationTransfer)
39        return PermutationTransfer.Convert(item as PermutationTransfer);
40      else if (item is VRPTransfer)
41        return VRPTransfer.Convert(item as VRPTransfer, globalScope);
42      else
43        return null;
44    }
45  }
46}
Note: See TracBrowser for help on using the repository browser.