Changeset 6460
- Timestamp:
- 06/21/11 11:11:38 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.4/ExternalEvaluationSymbolicExpressionTreeStringFormatter.cs
r5809 r6460 28 28 using HeuristicLab.Problems.DataAnalysis.Symbolic; 29 29 using System; 30 using System.Globalization; 30 31 31 32 namespace HeuristicLab.Problems.ExternalEvaluation.GP { … … 57 58 StringBuilder strBuilder = new StringBuilder(); 58 59 if (Indent) strBuilder.Append(' ', indentLength); 59 strBuilder.Append("("); 60 // internal nodes or leaf nodes? 61 if (node.Subtrees.Count() > 0) { 62 // symbol on same line as '(' 60 if (node.Subtrees.Count() > 0) { // internal node 61 strBuilder.Append("("); 63 62 if (node.Symbol is Addition) { 64 63 strBuilder.AppendLine("+"); … … 98 97 // each subtree expression on a new line 99 98 // and closing ')' also on new line 100 101 99 foreach (var subtree in node.Subtrees) { 102 100 strBuilder.AppendLine(FormatRecursively(subtree, indentLength + 2)); … … 107 105 if (node is VariableTreeNode) { 108 106 var varNode = node as VariableTreeNode; 109 // symbol in the same line with as '(' and ')' 110 strBuilder.Append(";" + varNode.VariableName + ";" + varNode.Weight.ToString("E4")); 111 strBuilder.Append(")"); 107 strBuilder.AppendFormat("(* {0} {1})", varNode.VariableName, varNode.Weight.ToString("g17", CultureInfo.InvariantCulture)); 112 108 } else if (node is ConstantTreeNode) { 113 109 var constNode = node as ConstantTreeNode; 114 // symbol in the same line with as '(' and ')' 115 strBuilder.Append(";" + constNode.Value.ToString("E4")); 116 strBuilder.Append(")"); 110 strBuilder.Append(constNode.Value.ToString("g17", CultureInfo.InvariantCulture)); 117 111 } else { 118 112 throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for external evaluation."); -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
r6189 r6460 59 59 #region Fields 60 60 protected HashSet<IEvaluationServiceClient> activeClients = new HashSet<IEvaluationServiceClient>(); 61 protected object clientLock = new object(); 62 protected AutoResetEvent clientAvailable = new AutoResetEvent(false); 61 protected object clientLock = new object(); 63 62 #endregion 64 63 … … 109 108 client = Clients.CheckedItems.FirstOrDefault(c => !activeClients.Contains(c)); 110 109 while (client == null && Clients.Count > 0) { 111 Monitor.Exit(clientLock); 112 clientAvailable.WaitOne(); 113 Monitor.Enter(clientLock); 110 Monitor.Wait(clientLock); 114 111 client = Clients.CheckedItems.FirstOrDefault(c => !activeClients.Contains(c)); 115 112 } … … 122 119 lock (clientLock) { 123 120 activeClients.Remove(client); 124 clientAvailable.Set();121 Monitor.PulseAll(clientLock); 125 122 } 126 123 }
Note: See TracChangeset
for help on using the changeset viewer.