Index: /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs	(revision 398)
@@ -66,5 +66,5 @@
       agent.Status = ProcessStatus.Unknown;
       agent.Database = database;
-      long id = database.InsertAgent(null, agent.Name, true, DbPersistenceManager.Save(agent));
+      long id = database.InsertAgent(null, agent.Name, DbPersistenceManager.Save(agent));
       agent.Id = id;
       agentList.Add(agent);
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs	(revision 398)
@@ -41,6 +41,4 @@
     public ProcessStatus Status { get; set; }
     [DataMember]
-    public bool ControllerAgent { get; set; }
-    [DataMember]
     public byte[] RawData { get; set; }
   }
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs	(revision 398)
@@ -31,5 +31,5 @@
   public interface IDatabase {
     [OperationContract]
-    long InsertAgent(long? parentAgentId, string name, bool controllerAgent, byte[] rawData);
+    long InsertAgent(long? parentAgentId, string name, byte[] rawData);
 
     [OperationContract(Name = "UpdateAgentName")]
Index: /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 398)
@@ -55,5 +55,5 @@
             }
             using(DbCommand cmd = cnn.CreateCommand()) {
-              cmd.CommandText = "CREATE TABLE Agent (ID integer primary key autoincrement, ProjectId integer, ParentAgentId integer, Name text, Status text default "+ProcessStatus.Unknown+", ControllerAgent integer, CreationTime DateTime, RawData Blob)";
+              cmd.CommandText = "CREATE TABLE Agent (ID integer primary key autoincrement, ProjectId integer, ParentAgentId integer, Name text, Status text default "+ProcessStatus.Unknown+", CreationTime DateTime, RawData Blob)";
               cmd.Transaction = t;
               cmd.ExecuteNonQuery();
@@ -73,6 +73,6 @@
     #endregion
 
-    #region insert agent/run/result/sub-result
-    public long InsertAgent(long? parentAgentId, string name, bool controllerAgent, byte[] rawData) {
+    #region insert agent/result/sub-result
+    public long InsertAgent(long? parentAgentId, string name, byte[] rawData) {
       rwLock.EnterWriteLock();
       try {
@@ -83,5 +83,5 @@
             using(DbCommand c = cnn.CreateCommand()) {
               c.Transaction = t;
-              c.CommandText = "Insert into Agent (Name, ParentAgentId, ControllerAgent, CreationTime, RawData) values (@Name, @ParentAgentId, @ControllerAgent, @CreationTime, @RawData); select last_insert_rowid()";
+              c.CommandText = "Insert into Agent (Name, ParentAgentId, CreationTime, RawData) values (@Name, @ParentAgentId, @CreationTime, @RawData); select last_insert_rowid()";
               DbParameter nameParam = c.CreateParameter();
               nameParam.ParameterName = "@Name";
@@ -92,8 +92,4 @@
               parentParam.Value = parentAgentId;
               c.Parameters.Add(parentParam);
-              DbParameter controllerParam = c.CreateParameter();
-              controllerParam.ParameterName = "@ControllerAgent";
-              controllerParam.Value = controllerAgent;
-              c.Parameters.Add(controllerParam);
               DbParameter creationTimeParam = c.CreateParameter();
               creationTimeParam.ParameterName = "@CreationTime";
@@ -284,5 +280,5 @@
     #endregion
 
-    #region get agent/run/result/sub-result
+    #region get agent/result/sub-result
 
     public ICollection<AgentEntry> GetAgents(ProcessStatus status) {
@@ -293,5 +289,5 @@
           cnn.Open();
           SQLiteCommand c = cnn.CreateCommand();
-          c.CommandText = "Select id, name, ControllerAgent, rawdata from Agent where Status=@Status";
+          c.CommandText = "Select id, name, rawdata from Agent where Status=@Status";
           DbParameter statusParameter = c.CreateParameter();
           statusParameter.ParameterName = "@Status";
@@ -305,6 +301,5 @@
             agent.Id = r.GetInt32(0);
             agent.Name = r.IsDBNull(1)?"":r.GetString(1);
-            agent.ControllerAgent = r.GetBoolean(2);
-            agent.RawData = (byte[])r.GetValue(3);
+            agent.RawData = (byte[])r.GetValue(2);
             agents.Add(agent);
           }
@@ -323,5 +318,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select id, name, status, ControllerAgent, rawdata from Agent where ParentAgentId isnull";
+            c.CommandText = "Select id, name, status, rawdata from Agent where ParentAgentId isnull";
             using(DbDataReader r = c.ExecuteReader()) {
               while(r.Read()) {
@@ -331,6 +326,5 @@
                 agent.Name = r.IsDBNull(1)?"-":r.GetString(1);
                 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2));
-                agent.ControllerAgent = r.GetBoolean(3);
-                agent.RawData = (byte[])r.GetValue(4);
+                agent.RawData = (byte[])r.GetValue(3);
                 agents.Add(agent);
               }
@@ -351,5 +345,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select id, name, status, controllerAgent, rawdata from Agent where ParentAgentId=@ParentAgentId";
+            c.CommandText = "Select id, name, status, rawdata from Agent where ParentAgentId=@ParentAgentId";
             DbParameter parentParameter = c.CreateParameter();
             parentParameter.ParameterName = "@ParentAgentId";
@@ -364,6 +358,5 @@
                 agent.Name = r.IsDBNull(1)?"-":r.GetString(1);
                 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2));
-                agent.ControllerAgent = r.GetBoolean(3);
-                agent.RawData = (byte[])r.GetValue(4);
+                agent.RawData = (byte[])r.GetValue(3);
                 agents.Add(agent);
               }
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs	(revision 398)
@@ -61,5 +61,5 @@
       using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) {
         IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl));
-        long id = database.InsertAgent(agentId, null, false, DbPersistenceManager.Save(agent));
+        long id = database.InsertAgent(agentId, null, DbPersistenceManager.Save(agent));
         database.UpdateAgent(id, ProcessStatus.Waiting);
       }
Index: unk/sources/HeuristicLab.CEDMA.Server/AgentScheduler.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/AgentScheduler.cs	(revision 397)
+++ 	(revision )
@@ -1,98 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.CEDMA.DB;
-using HeuristicLab.CEDMA.DB.Interfaces;
-using HeuristicLab.Core;
-using System.Threading;
-using HeuristicLab.CEDMA.Core;
-using HeuristicLab.Data;
-
-namespace HeuristicLab.CEDMA.Server {
-  public class AgentScheduler {
-    private Database database;
-    private List<IEngine> engines;
-    private Dictionary<IEngine, AgentEntry> agent;
-    private string serverUri;
-
-    public AgentScheduler(Database database, string serverUri) {
-      this.database = database;
-      this.serverUri = serverUri;
-      engines = new List<IEngine>();
-      agent = new Dictionary<IEngine, AgentEntry>();
-    }
-
-    public void Run() {
-      while(true) {
-        ClearFinishedEngines();
-        CreateNewEngines();
-        if(engines.Count == 0) Thread.Sleep(10000);
-        else StepAllEngines();
-      }
-    }
-    private void ClearFinishedEngines() {
-      List<IEngine> finishedEngines = new List<IEngine>();
-      foreach(IEngine e in engines) {
-        if(e.Terminated) {
-          finishedEngines.Add(e);
-        }
-      }
-      foreach(IEngine e in finishedEngines) {
-        engines.Remove(e);
-        AgentEntry entry = agent[e];
-        entry.Status = ProcessStatus.Finished;
-        database.UpdateAgent(entry.Id, entry.Status);
-      }
-    }
-    private void CreateNewEngines() {
-      IEnumerable<AgentEntry> agents = database.GetAgents(ProcessStatus.Waiting).Where(a=>a.ControllerAgent);
-      foreach(AgentEntry a in agents) {
-        SequentialEngine.SequentialEngine engine = new HeuristicLab.SequentialEngine.SequentialEngine();
-        Agent newAgent = (Agent)DbPersistenceManager.Restore(a.RawData);
-        engine.OperatorGraph.Clear();
-        foreach(IOperator op in newAgent.OperatorGraph.Operators) engine.OperatorGraph.AddOperator(op);
-        engine.OperatorGraph.InitialOperator = newAgent.OperatorGraph.InitialOperator;
-        engine.Reset();
-
-        // initialize CEDMA variables for the execution of the agent
-        engine.GlobalScope.AddVariable(new Variable("AgentId", new IntData((int)a.Id)));
-        engine.GlobalScope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri)));
-
-        agent[engine] = a;
-        engines.Add(engine);
-        a.Status = ProcessStatus.Active;
-        database.UpdateAgent(a.Id, a.Status);
-      }
-    }
-    private void StepAllEngines() {
-      for(int steps = 0; steps < 100; steps++) {
-        foreach(IEngine engine in engines) {
-          engine.ExecuteStep();
-        }
-        Thread.Sleep(100); // prevent overload
-      }
-    }
-  }
-}
Index: /trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj	(revision 398)
@@ -59,5 +59,4 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AgentScheduler.cs" />
     <Compile Include="RunScheduler.cs" />
     <Compile Include="DbPersistenceManager.cs" />
Index: /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs	(revision 398)
@@ -64,7 +64,7 @@
     }
     private void ReleaseWaitingRuns() {
-      IEnumerable<AgentEntry> agents;
+      ICollection<AgentEntry> agents;
       lock(remoteCommLock) {
-        agents = database.GetAgents(ProcessStatus.Waiting).Where(a=>!a.ControllerAgent);
+        agents = database.GetAgents(ProcessStatus.Waiting);
       }
       foreach(AgentEntry entry in agents) {
Index: /trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs	(revision 397)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/ServerForm.cs	(revision 398)
@@ -54,10 +54,4 @@
     }
 
-    private void InitAgentScheduler() {
-      AgentScheduler scheduler = new AgentScheduler(database, addressTextBox.Text);
-      Thread agentSchedulerThread = new Thread(scheduler.Run);
-      agentSchedulerThread.Start();
-    }
-
     private void InitRunScheduler() {
       JobManager jobManager = new JobManager(gridAddress.Text);
@@ -81,5 +75,4 @@
     private void Start() {
       InitDatabase();
-      InitAgentScheduler();
       InitRunScheduler();
 
