Changeset 1151


Ignore:
Timestamp:
01/15/09 20:04:46 (12 years ago)
Author:
gkronber
Message:

worked on #419 (Refactor CEDMA plugins):

  • increased number of sessions for the grid service from 20 to 100
  • implemented results query
  • fixed a bug in the Dispatcher
Location:
branches/CEDMA-Refactoring-Ticket419
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChart.cs

    r1109 r1151  
    116116      double minSize = 1;
    117117      try {
    118         if (sizeDimension != null && Results.OrdinalVariables.Contains(sizeDimension)) {
     118        if (sizeDimension != null && results.OrdinalVariables.Contains(sizeDimension)) {
    119119          var sizes = records
    120120            .Select(x => Convert.ToDouble(x.Get(sizeDimension)))
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs

    r1129 r1151  
    3737namespace HeuristicLab.CEDMA.Core {
    3838  public class Results : ItemBase {
    39     public static string[] CategoricalVariables {
    40       get { return new string[] { "TargetVariable" }; }
     39    private string[] categoricalVariables = null;
     40    public string[] CategoricalVariables {
     41      get {
     42        if (categoricalVariables == null) {
     43          LoadModelAttributes();
     44        }
     45        return categoricalVariables;
     46      }
    4147    }
    4248
    43     public static string[] OrdinalVariables {
    44       get { return new string[] { "ValidationMeanAbsolutePercentageError" }; }
     49    private string[] ordinalVariables = null;
     50    public string[] OrdinalVariables {
     51      get {
     52        if (ordinalVariables == null) {
     53          LoadModelAttributes();
     54        }
     55        return ordinalVariables;
     56      }
    4557    }
    4658
     
    7385    private IEnumerable<ResultsEntry> SelectRows() {
    7486      if (store == null) yield break;
     87      entries = new List<ResultsEntry>();
     88      var results = store.Query("<"+dataSetEntity + "> <" + Ontology.PredicateHasModel + "> ?Model ." + Environment.NewLine +
     89        "?Model ?Attribute ?Value .")
     90        .GroupBy(x=>(Entity)x.Get("Model"));
     91      foreach (var modelBindings in results) {
     92        ResultsEntry entry = new ResultsEntry(modelBindings.Key.Uri);
     93        foreach (var binding in modelBindings) {
     94          if (binding.Get("Value") is Literal) {
     95            string name = ((Entity)binding.Get("Attribute")).Uri.Replace(Ontology.CedmaNameSpace, "");
     96            if (entry.Get(name) == null) {
     97              object value = ((Literal)binding.Get("Value")).Value;
     98              entry.Set(name, value);
     99            }
     100          }
     101        }
     102        entries.Add(entry);
     103        yield return entry;
     104      }
    75105
    76       //var models = store.Select(new Statement(dataSetEntity, Ontology.PredicateHasModel, Ontology.AnyEntity));
    77 
    78       ////var results = store.Select(new Statement(dataSetEntity, Ontology.PredicateHasModel, Ontology.AnyEntity))
    79       ////   .SelectMany(x => store.Select(new SelectFilter(
    80       ////     new Entity[] { (Entity)x.Property },
    81       ////     new Entity[] { Ontology.PredicateModelAttribute },
    82       ////     new Resource[] { Ontology.AnyEntity })))
    83       ////   .SelectMany(x =>
    84       ////     store.Select(
    85       ////        new SelectFilter(
    86       ////        new Entity[] { (Entity)x.Property },
    87       ////        new Entity[] { Ontology.PredicateModelAttributeName },
    88       ////        new Entity[] { Ontology.AnyEntity })).Select(y =>
    89       ////          new {
    90       ////            Model = x.Subject,
    91       ////            Attribute = (Entity)x.Property,
    92       ////            AttributeName = (Literal)y.Property
    93       ////          }))
    94       ////   .SelectMany(x =>
    95       ////     store.Select(
    96       ////       new Statement(x.Attribute, Ontology.PredicateModelAttributeValue, Ontology.AnyEntity))
    97       ////       .Select(y =>
    98       ////         new {
    99       ////           Model = x.Model.Uri,
    100       ////           AttributeName = x.AttributeName.Value,
    101       ////           AttributeValue = ((Literal)y.Property).Value
    102       ////         })).GroupBy(x => x.Model);
    103 
    104       //entries = new List<ResultsEntry>();
    105       //foreach (var model in models) {
    106       //  var attributes = store.Select(new Statement((Entity)model.Property, Ontology.PredicateModelAttribute, Ontology.AnyEntity));
    107 
    108       //  foreach (var attr in attributes) {
    109       //    var namesAndValues = store
    110       //      .Select(new SelectFilter(new Entity[] { (Entity)attr.Property },
    111       //        new Entity[] { Ontology.PredicateModelAttributeName, Ontology.PredicateModelAttributeValue },
    112       //        new Entity[] { Ontology.AnyEntity }));
    113       //  }
    114       //}
    115 
    116       //foreach (var row in results) {
    117       //  ResultsEntry entry = new ResultsEntry(row.First().Model);
    118       //  foreach (var attr in row) {
    119       //    entry.Set((string)attr.AttributeName, attr.AttributeValue);
    120       //  }
    121       //  entries.Add(entry);
    122       //  yield return entry;
    123       //}
    124 
    125       //FireChanged();
    126       //cached = true;
     106      FireChanged();
     107      cached = true;
    127108    }
    128109
    129110    internal IEnumerable<string> SelectModelAttributes() {
    130       if (store == null) yield break;
     111      return CategoricalVariables.Concat(OrdinalVariables);
     112    }
    131113
    132       //var attributeNames =
    133       //  store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateModelAttributeName, Ontology.AnyEntity))
    134       //  .Select(s => (string)((Literal)s.Property).Value)       
    135       //  .Distinct();
    136       //foreach (var name in attributeNames) {
    137       //  yield return name;
    138       //}
     114    private void LoadModelAttributes() {
     115      this.ordinalVariables =
     116        store.Query("?ModelAttribute <" + Ontology.PredicateInstanceOf + "> <" + Ontology.TypeOrdinalAttribute + "> .")
     117        .Select(s => ((Entity)s.Get("ModelAttribute")).Uri.Replace(Ontology.CedmaNameSpace, ""))
     118        .ToArray();
     119      this.categoricalVariables =
     120        store.Query("?ModelAttribute <" + Ontology.PredicateInstanceOf + "> <" + Ontology.TypeCategoricalAttribute + "> .")
     121        .Select(s => ((Entity)s.Get("ModelAttribute")).Uri.Replace(Ontology.CedmaNameSpace, ""))
     122        .ToArray();
    139123    }
    140124  }
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.DB.Interfaces/Entity.cs

    r552 r1151  
    3535    }
    3636
     37    public override string ToString() {
     38      return Uri;
     39    }
     40
    3741    public override bool Equals(object obj) {
    3842      if(this == obj) return true;
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs

    r1130 r1151  
    6969      var modelMAPE = new HeuristicLab.CEDMA.DB.Interfaces.Variable("ModelMAPE");
    7070
    71       //var query = new Statement[] {
    72       //  new Statement(dataSetEntity, Ontology.PredicateHasModel, modelVar),
    73       //  new Statement(modelVar, Ontology.TargetVariable, targetVar),
    74       //  new Statement(modelVar, Ontology.ValidationMeanAbsolutePercentageError, modelMAPE)
    75       //};
    76 
    7771      var query = "<" + dataSetEntity.Uri + "> <" + Ontology.PredicateHasModel.Uri + "> ?Model ." + Environment.NewLine +
    7872        "?Model <" + Ontology.TargetVariable.Uri + "> ?TargetVariable ." + Environment.NewLine +
     
    10094      int nConfigurations = utilization.Length;
    10195      for (int j = nConfigurations - 1; j > nConfigurations * 0.8; j--) {
    102         int targetVariable = dataSet.Problem.AllowedTargetVariables[j];
     96        int targetVariable = dataSet.Problem.AllowedTargetVariables[idx[j]];
    10397        IEngine engine = CreateEngine(dataSet.Problem, targetVariable);
    10498        if (engine != null) {
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Grid/ServerForm.cs

    r1130 r1151  
    6666      internalHost = new ServiceHost(jobStore, new Uri(internalAddressTextBox.Text));
    6767      ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior();
    68       throttlingBehavior.MaxConcurrentSessions = 20;
     68      throttlingBehavior.MaxConcurrentSessions = 100;
    6969      internalHost.Description.Behaviors.Add(throttlingBehavior);
    7070      try {
Note: See TracChangeset for help on using the changeset viewer.