Free cookie consent management tool by TermsFeed Policy Generator

Changeset 123


Ignore:
Timestamp:
04/15/08 15:57:41 (17 years ago)
Author:
gkronber
Message:

fixed more bugs (not thoroughly tested but at least it works for OSGP_NOx and OSGA_TSP)

Location:
branches/XmlTextReaderBranch
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs

    r121 r123  
    9898    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    9999      base.Populate(reader, restoredObjects);
     100      reader.Read();
    100101      groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(reader, "SubOperatorsGroupConstraint", restoredObjects);
     102      reader.Read();
    101103    }
    102104    #endregion persistence
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/AndConstraint.cs

    r121 r123  
    8787    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8888      base.Populate(reader, restoredObjects);
     89      reader.Read();
    8990      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects);
     91      reader.Read();
    9092    }
    9193    #endregion persistence
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/NotConstraint.cs

    r121 r123  
    8181    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8282      base.Populate(reader, restoredObjects);
     83      reader.Read();
    8384      subConstraint = (ConstraintBase)PersistenceManager.Restore(reader, "SubConstraint", restoredObjects);
     85      reader.Read();
    8486    }
    8587    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs

    r122 r123  
    9494    //}
    9595    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     96      base.Populate(reader, restoredObjects);
     97      reader.Read();
    9698      minOperators = (IntData)PersistenceManager.Restore(reader, "min", restoredObjects);
     99      reader.Read();
    97100      maxOperators = (IntData)PersistenceManager.Restore(reader, "max", restoredObjects);
    98       base.Populate(reader, restoredObjects);
     101      reader.Read();
    99102    }
    100103    #endregion persistence
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/OrConstraint.cs

    r121 r123  
    8888    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8989      base.Populate(reader, restoredObjects);
     90      reader.Read();
    9091      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects);
     92      reader.Read();
    9193    }
    9294    #endregion persistence
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs

    r122 r123  
    131131    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    132132      base.Populate(reader, restoredObjects);
     133      reader.Read();
    133134      subOperatorIndex = (IntData)PersistenceManager.Restore(reader, "SubOperatorIndex", restoredObjects);
     135      reader.Read();
    134136      subOperators = new List<IOperator>();
    135       reader.ReadToDescendant("AllowedSubOperators");
    136       while(reader.IsStartElement())
    137         subOperators.Add((IOperator)PersistenceManager.Restore(reader, restoredObjects));
    138       reader.ReadEndElement();
     137      if(reader.Name !="AllowedSubOperators") throw new XmlException("Expected: \"AllowedSubOperators\", found: \""+reader.Name+"\"");
     138      if(!reader.IsEmptyElement) {
     139        reader.Read();
     140        while(reader.IsStartElement()) {
     141          subOperators.Add((IOperator)PersistenceManager.Restore(reader, restoredObjects));
     142          reader.Skip();
     143        }
     144        reader.ReadEndElement();
     145      } else {
     146        reader.Read();
     147      }
    139148    }
    140149    #endregion persistence
  • branches/XmlTextReaderBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs

    r121 r123  
    125125    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    126126      base.Populate(reader, restoredObjects);
     127      reader.Read();
    127128      leftVarName = (StringData)PersistenceManager.Restore(reader, "LeftVarName", restoredObjects);
     129      reader.Skip();
    128130      rightVarName = (StringData)PersistenceManager.Restore(reader, "RightVarName", restoredObjects);
     131      reader.Skip();
    129132      comparer = (IntData)PersistenceManager.Restore(reader, "Comparer", restoredObjects);
     133      reader.Read();
    130134    }
    131135    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Core/CompositeOperation.cs

    r122 r123  
    8484      base.Populate(reader, restoredObjects);
    8585
    86       reader.ReadToDescendant("Operations");
    87       while(reader.IsStartElement())
    88         AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects));
    89       reader.ReadEndElement();
     86      if(reader.Name != "Operations") throw new XmlException("Expected: \"Operations\", found: \""+reader.Name+"\"");
     87      if(!reader.IsEmptyElement) {
     88        reader.Read();
     89        while(reader.IsStartElement()) {
     90          AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects));
     91          reader.Skip();
     92        }
     93        reader.ReadEndElement();
     94      } else {
     95        reader.Read();
     96      }
    9097    }
    9198    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Core/ConstrainedItemBase.cs

    r122 r123  
    111111      if(reader.Name == "Constraints") {
    112112        myConstraints.Clear();
    113         while(reader.IsStartElement())
     113        reader.Read();
     114        while(reader.IsStartElement()) {
    114115          AddConstraint((IConstraint)PersistenceManager.Restore(reader, restoredObjects));
     116          reader.Skip();
     117        }
    115118        reader.ReadEndElement();
    116119      }
  • branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorGroup.cs

    r122 r123  
    111111      myName = reader["Name"];
    112112      base.Populate(reader, restoredObjects);
    113 
    114       reader.ReadToDescendant("SubGroups");
    115       while(reader.IsStartElement())
    116         AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects));
    117       reader.ReadEndElement();
    118       reader.ReadToDescendant("Operators");
    119       while(reader.IsStartElement())
    120         AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
    121       reader.ReadEndElement();
     113      reader.Read();
     114      if(reader.Name != "SubGroups") throw new XmlException("Expected: \"SubGroups\", found: \"" + reader.Name + "\"");
     115      if(!reader.IsEmptyElement) {
     116        reader.Read();
     117        while(reader.IsStartElement()) {
     118          AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects));
     119          reader.Skip();
     120        }
     121        reader.ReadEndElement();
     122      } else {
     123        reader.Read();
     124      }
     125      if(reader.Name != "Operators") throw new XmlException("Expected: \"Operators\", found: \"" + reader.Name + "\"");
     126      if(!reader.IsEmptyElement) {
     127        reader.Read();
     128        while(reader.IsStartElement()) {
     129          AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
     130          reader.Skip();
     131        }
     132        reader.ReadEndElement();
     133      } else {
     134        reader.Read();
     135      }
    122136    }
    123137    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorLibrary.cs

    r121 r123  
    5858    public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
    5959      base.Populate(reader, restoredObjects);
     60      reader.Read();
    6061      myGroup = (IOperatorGroup)PersistenceManager.Restore(reader, "OperatorGroup", restoredObjects);
     62      reader.Read();
    6163    }
    6264    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedDoubleData.cs

    r121 r123  
    6868      base.Populate(reader, restoredObjects);
    6969      base.Data = (DoubleData)PersistenceManager.Restore(reader, "Value", restoredObjects);
     70      reader.Read();
    7071    }
    7172
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedIntData.cs

    r121 r123  
    6868      base.Populate(reader, restoredObjects);
    6969      base.Data = (IntData)PersistenceManager.Restore(reader, "Value", restoredObjects);
     70      reader.Read();
    7071    }
    7172
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedItemList.cs

    r122 r123  
    7777    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    7878      base.Populate(reader, restoredObjects);
    79       reader.Read();
    8079      if(reader.Name!="ListItems") throw new XmlException("Expected: \"ListItems\", found: \""+reader.Name+"\"");
    8180      suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]);
  • branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleArrayData.cs

    r121 r123  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     47    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    4848      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    4949      node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ItemList_T.cs

    r122 r123  
    6363    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    6464      base.Populate(reader, restoredObjects);
    65       reader.Read();
    66       while(reader.IsStartElement()) {
    67         list.Add((T)PersistenceManager.Restore(reader, restoredObjects));
    68         reader.Skip();
    69       }
    70       reader.ReadEndElement();
     65      if(!reader.IsEmptyElement) {
     66        reader.Read();
     67        while(reader.IsStartElement()) {
     68          list.Add((T)PersistenceManager.Restore(reader, restoredObjects));
     69          reader.Skip();
     70        }
     71        reader.ReadEndElement();
     72      } else {
     73        reader.Read();
     74      }
    7175    }
    7276
  • branches/XmlTextReaderBranch/HeuristicLab.ES/ES.cs

    r122 r123  
    612612    //}
    613613    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     614      base.Populate(reader, restoredObjects);
     615      reader.Read();
    614616      myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects);
    615       base.Populate(reader, restoredObjects);
    616617      SetReferences();
     618      reader.Read();
    617619    }
    618620    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Functions/Constant.cs

    r121 r123  
    8080    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8181      base.Populate(reader, restoredObjects);
    82 
    8382      value = GetVariable("Value");
    8483    }
  • branches/XmlTextReaderBranch/HeuristicLab.Functions/FunctionBase.cs

    r122 r123  
    329329    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    330330      base.Populate(reader, restoredObjects);
    331       if(reader.IsStartElement() && reader.Name == "FunctionTemplate") {
     331      if(reader.Name == "FunctionTemplate") {
     332        reader.Read();
    332333        metaObject = (FunctionBase)PersistenceManager.Restore(reader, restoredObjects);
     334        reader.Read();
     335        reader.ReadEndElement();
    333336      } else {
    334337        metaObject = this;
     
    337340
    338341      // load local variables
    339       reader.ReadToDescendant("LocalVariables");
     342      if(reader.Name!="LocalVariables") throw new XmlException("Expected: \"LocalVariables\", found: \""+reader.Name+"\"");
    340343      // remove the variables that have been added in a constructor
    341344      variables.Clear();
    342345      // load the persisted variables
    343       while(reader.IsStartElement())
    344         variables.Add((IVariable)PersistenceManager.Restore(reader, restoredObjects));
    345       reader.ReadEndElement();
     346      if(!reader.IsEmptyElement) {
     347        reader.Read();
     348        while(reader.IsStartElement()) {
     349          variables.Add((IVariable)PersistenceManager.Restore(reader, restoredObjects));
     350          reader.Skip();
     351        }
     352        reader.ReadEndElement();
     353      } else {
     354        reader.Read();
     355      }
    346356    }
    347357
  • branches/XmlTextReaderBranch/HeuristicLab.Functions/Variable.cs

    r121 r123  
    104104    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    105105      base.Populate(reader, restoredObjects);
    106 
    107106      variable = (ConstrainedIntData)GetVariable("Variable").Value;
    108107      weight = (ConstrainedDoubleData)GetVariable("Weight").Value;
  • branches/XmlTextReaderBranch/HeuristicLab.Grid/ProcessingEngine.cs

    r121 r123  
    5858    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    5959      base.Populate(reader, restoredObjects);
     60      reader.Read();
    6061      initialOperation = (AtomicOperation)PersistenceManager.Restore(reader, "InitialOperation", restoredObjects);
     62      reader.Read();
    6163    }
    6264
  • branches/XmlTextReaderBranch/HeuristicLab.Logging/Linechart.cs

    r121 r123  
    9696    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    9797      base.Populate(reader, restoredObjects);
     98      reader.Read();
    9899      myNumberOfLines = (IntData)PersistenceManager.Restore(reader, "NumberOfLines", restoredObjects);
     100      reader.Skip();
    99101      myValues = (ItemList)PersistenceManager.Restore(reader, "Values", restoredObjects);
     102      reader.Read();
    100103    }
    101104    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Logging/Log.cs

    r121 r123  
    7070    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    7171      base.Populate(reader, restoredObjects);
     72      reader.Read();
    7273      myItems = (ItemList)PersistenceManager.Restore(reader, "Items", restoredObjects);
     74      reader.Read();
    7375    }
    7476    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs

    r122 r123  
    211211    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    212212      base.Populate(reader, restoredObjects);
    213       reader.ReadToDescendant("Description");
    214       myDescription = reader.ReadString();
    215       reader.ReadEndElement();
    216       reader.ReadToDescendant("Code");
    217       myCode = reader.ReadString();
    218       reader.ReadEndElement();
     213      myDescription = reader.ReadElementString("Description");
     214      myCode = reader.ReadElementString("Code");
    219215    }
    220216    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Operators/CombinedOperator.cs

    r122 r123  
    106106      myDescription = reader.ReadElementString("Description");
    107107      myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects);
     108      reader.Read();
    108109    }
    109110    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Random/MersenneTwister.cs

    r122 r123  
    142142    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    143143      base.Populate(reader, restoredObjects);
    144 
    145       reader.ReadToDescendant("State");
    146       string stateString = reader.ReadString();
    147       reader.ReadEndElement();
     144      reader.Read();
     145      string stateString = reader.ReadElementString("State");
    148146      string[] tokens = stateString.Split(';');
    149147      for(int i = 0; i < tokens.Length; i++)
    150148        state[i] = uint.Parse(tokens[i]);
    151       reader.ReadToDescendant("P");
    152       p = int.Parse(reader.ReadString());
    153       reader.ReadEndElement();
    154       reader.ReadToDescendant("Init");
    155       init = bool.Parse(reader.ReadString());
    156       reader.ReadEndElement();
     149      p = int.Parse(reader.ReadElementString("P"));
     150      init = bool.Parse(reader.ReadElementString("Init"));
    157151    }
    158152    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Random/NormalDistributedRandom.cs

    r122 r123  
    538538    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    539539      base.Populate(reader, restoredObjects);
    540       reader.ReadToDescendant("Mu");
    541       mu = double.Parse(reader.ReadString());
    542       reader.ReadEndElement();
    543       reader.ReadToDescendant("Sigma");
    544       sigma = double.Parse(reader.ReadString());
    545       reader.ReadEndElement();
     540      mu = double.Parse(reader.ReadElementString("Mu"));
     541      sigma = double.Parse(reader.ReadElementString("Sigma"));
    546542      uniform = (IRandom)PersistenceManager.Restore(reader, "UniformRandom", restoredObjects);
     543      reader.Read();
    547544    }
    548545
  • branches/XmlTextReaderBranch/HeuristicLab.Routing.TSP/TSPTour.cs

    r121 r123  
    8585    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8686      base.Populate(reader, restoredObjects);
     87      reader.Read();
    8788      myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(reader, "Coordinates", restoredObjects);
     89      reader.Skip();
    8890      myTour = (Permutation.Permutation)PersistenceManager.Restore(reader, "Tour", restoredObjects);
     91      reader.Read();
    8992    }
    9093    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.SGA/SGA.cs

    r121 r123  
    518518    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    519519      base.Populate(reader, restoredObjects);
     520      reader.Read();
    520521      myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects);
    521522      SetReferences();
     523      reader.Read();
    522524    }
    523525    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs

    r121 r123  
    9696    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    9797      base.Populate(reader, restoredObjects);
     98      reader.Read();
    9899      operations = (ItemList)PersistenceManager.Restore(reader, "Operations", restoredObjects);
     100      reader.Skip();
    99101      jobs = (IntData)PersistenceManager.Restore(reader, "Jobs", restoredObjects);
     102      reader.Skip();
    100103      machines = (IntData)PersistenceManager.Restore(reader, "Machines", restoredObjects);
     104      reader.Read();
    101105    }
    102106    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/Operation.cs

    r121 r123  
    161161    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    162162      base.Populate(reader, restoredObjects);
     163      reader.Read();
    163164      job = (IntData)PersistenceManager.Restore(reader, "Job", restoredObjects);
     165      reader.Skip();
    164166      operationIndex = (IntData)PersistenceManager.Restore(reader, "OperationIndex", restoredObjects);
     167      reader.Skip();
    165168      start = (IntData)PersistenceManager.Restore(reader, "Start", restoredObjects);
     169      reader.Skip();
    166170      duration = (IntData)PersistenceManager.Restore(reader, "Duration", restoredObjects);
     171      reader.Skip();
    167172      predecessors = (ItemList)PersistenceManager.Restore(reader, "Predecessors", restoredObjects);
     173      reader.Skip();
    168174      machines = (IntArrayData)PersistenceManager.Restore(reader, "Machines", restoredObjects);
     175      reader.Read();
    169176    }
    170177
  • branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs

    r122 r123  
    9191      for(int i = 0; i < machines; i++) {
    9292        schedule[i] = (ScheduleTree)PersistenceManager.Restore(reader, "Machine" + i.ToString(), restoredObjects);
     93        reader.Skip();
    9394      }
    9495    }
  • branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs

    r121 r123  
    8080    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8181      base.Populate(reader, restoredObjects);
    82       if(reader.IsStartElement())
     82
     83      if(reader.Name == "Schedule") {
    8384        schedule = (Schedule)PersistenceManager.Restore(reader, "Schedule", restoredObjects);
     85        reader.Read();
     86      }
    8487    }
    8588    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs

    r122 r123  
    225225    //}
    226226    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     227      base.Populate(reader, restoredObjects);
    227228      string[] tokens = reader.ReadString().Split(';');
    228       base.Populate(reader, restoredObjects);
    229229      for(int i = 0; i < tokens.Length - 1; i++) {
    230230        TimeSlot t = new TimeSlot(tokens[i]);
  • branches/XmlTextReaderBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs

    r121 r123  
    7979    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    8080      base.Populate(reader, restoredObjects);
     81      reader.Read();
    8182      group = (GPOperatorGroup)PersistenceManager.Restore(reader, "Group", restoredObjects);
     83      reader.Read();
    8284    }
    8385    #endregion
Note: See TracChangeset for help on using the changeset viewer.