Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/16 16:38:21 (8 years ago)
Author:
jlodewyc
Message:

#2582 Parameterizing arrays start

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Hubs/ProgressHub.cs

    r13827 r13834  
    88using HeuristicLab.Data;
    99using System.Reflection;
     10using HeuristicLab.Core;
    1011
    1112namespace HeuristicLab.Clients.Hive.WebJobManager
     
    257258
    258259                //BUGGERS
    259                 if (name == "ReevaluateElites")
    260                     name = "ReevaluteElites";
    261                 if (name == "DominateOnEqualQualities" || name == "PlusSelection" || name == "ReevaluteElites")
    262                     val = ((BoolValue)val).Value;
    263                
    264                // if (name == "ReduceToPopulationSize")
    265                     //name += "Parameter";
    266 
    267                 try
    268                 {
    269                     Algorithm alg = (Algorithm)curr.ItemTask.Item;
    270                     if (prob)
    271                         alg.Problem.GetType().GetProperty(name).SetValue(alg, val);
    272                     else
    273                         alg.GetType().GetProperty(name).SetValue(alg, val);
    274                 }
    275                 catch (NullReferenceException e)
    276                 {
    277                     Console.WriteLine("NullRefException: " + name + " - " + type);
    278                 }
    279                 catch(TargetException e)
    280                 {
    281                     Console.WriteLine("TargetException: " + name + " - " + type);
    282                 }
     260                // if (name == "DominateOnEqualQualities" || name == "PlusSelection" || name == "ReevaluteElites")
     261                //   val = ((BoolValue)val).Value;
     262
     263                // if (name == "ReduceToPopulationSize")
     264                //name += "Parameter";
     265                if (val != null)
     266                {
     267                    try
     268                    {
     269                        IAlgorithm alg = (IAlgorithm)curr.ItemTask.Item;
     270                        if (prob)
     271                            alg.Problem.Parameters[name].ActualValue = (IItem)val;
     272                        else
     273                        {
     274                            alg.Parameters[name].ActualValue = (IItem)val;
     275                        }
     276                    }
     277                    catch (NullReferenceException e)
     278                    {
     279                        Console.WriteLine("NullRefException: " + name + " - " + type);
     280                    }
     281                    catch (TargetException e)
     282                    {
     283                        Console.WriteLine("TargetException: " + name + " - " + type);
     284                    }
     285                    catch (NotSupportedException e)
     286                    {
     287                        Clients.Caller.dataNotSupported(name);
     288                    }
     289                }
     290                else
     291                    Clients.Caller.formatWrong(name, type);
     292
     293
    283294            }
    284295
Note: See TracChangeset for help on using the changeset viewer.