本文整理汇总了C#中Connection.send_data_set方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.send_data_set方法的具体用法?C# Connection.send_data_set怎么用?C# Connection.send_data_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.send_data_set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartProcessing
public bool StartProcessing()
{
using (DataSet data = new DataSet())
{
//clean data
string[] datas = File.ReadAllLines(srcFile);
string headLine = datas[0];
string newHeadlLine = headLine.Replace('"', ' ');
TextWriter tw = new StreamWriter(srcFile);
tw.WriteLine(newHeadlLine);
for (int i = 1; i < datas.Length; i++)
{
tw.WriteLine(datas[i]);
}
tw.Close();
if (!data.import_ascii(srcFile))
{
throw new ArgumentException("Unable to import this file");
}
Console.WriteLine("Data imported successfully");
Console.WriteLine(data.summary());
using (SearchOptions options = new SearchOptions(srcModel))
{
Console.WriteLine("> Setting the search options");
//options.building_blocks_.Remove("a-b");
for (int i = 0; i < options.building_blocks_.Count; i++)
{
Console.WriteLine(options.building_blocks_[i]);
}
using(Connection conn = new Connection()){
try
{
//140.113.88.194
Console.WriteLine("> Connecting to a eureqa server at " + srcIP);
if (!conn.connect(srcIP))
{
Console.WriteLine("Unable to connect to server at " + srcIP);
Console.WriteLine(@"Try running the eureqa_server binary provided with the Eureqa API (""server"" sub-directory) first.");
throw new ApplicationException("Unable to connect to server at " + srcIP);
}
else HandleLastResult(conn, "Connection made", "Connected to server");
Console.WriteLine("> Querying the server systems information");
using (ServerInfo serv = new ServerInfo())
{
if (!conn.query_server_info(serv))
{
Console.WriteLine("Unable to recieve the server information");
throw new ApplicationException("Unable to recieve the server information");
}
else
{
Console.WriteLine("Recieved server information successfully:");
Console.WriteLine(serv.summary());
}
}
Console.WriteLine("> Sending the data set to the server");
if (!conn.send_data_set(data))
{
Console.WriteLine("Unable to transfer the data set");
throw new ArgumentException("Unable to transfer the data set");
}
else HandleLastResult(conn, "Data set transferred");
Console.WriteLine("> Sending search options to the server");
if (!conn.send_options(options))
{
Console.WriteLine("Unable to transfer the search options");
}
else HandleLastResult(conn, "Search options transferred");
Console.WriteLine("> Telling server to start searching");
if (!conn.start_search())
{
Console.WriteLine("Unable to send the start command");
throw new ApplicationException("Unable to send the start command");
}
else HandleLastResult(conn, "Start command sent");
Console.WriteLine("> Monitoring the search progress");
Dictionary<float, Tuple<float, string>> fitSize = new Dictionary<float, Tuple<float, string>>();
ArrayList models = new ArrayList();
using (SearchProgress progress = new SearchProgress())
{
using (SolutionFrontier bestSolutions = new SolutionFrontier())
{
int c = 0;
//string output;
Console.WriteLine("Debug 1");
while (conn.query_progress(progress))
{
//.........这里部分代码省略.........
示例2: Run
public void Run(string srcFile, string srcModel, string srcIP)
{
using (DataSet data = new DataSet())
{
string sourcePath = srcFile;
//clean data
string[] datas = File.ReadAllLines(sourcePath);
string headLine = datas[0];
string newHeadlLine = headLine.Replace('"', ' ');
TextWriter tw = new StreamWriter(sourcePath);
tw.WriteLine(newHeadlLine);
for (int i = 1; i < datas.Length; i++)
{
tw.WriteLine(datas[i]);
}
tw.Close();
if (!data.import_ascii(sourcePath))
{
throw new ArgumentException("Unable to import this file");
}
Console.WriteLine("Data imported successfully");
Console.WriteLine(data.summary());
string model = srcModel;
using (SearchOptions options = new SearchOptions(model))
{
Console.WriteLine("> Setting the search options");
for (int i = 0; i < options.building_blocks_.Count; i++)
{
Console.WriteLine(options.building_blocks_[i]);
}
using (Connection conn = new Connection())
{
try
{
//140.113.88.194
string ipServer = srcIP;
Console.WriteLine("> Connecting to a eureqa server at " + ipServer);
if (!conn.connect(ipServer))
{
Console.WriteLine("Unable to connect to server");
Console.WriteLine(@"Try running the eureqa_server binary provided with the Eureqa API (""server"" sub-directory) first.");
throw new ApplicationException("Cannot connect to the local server.");
}
else HandleLastResult(conn, "Connection made", "Connected to server");
using (ServerInfo serv = new ServerInfo())
{
Console.WriteLine("> Querying the server systems information");
if (!conn.query_server_info(serv))
{
Console.WriteLine("Unable to recieve the server information");
throw new ApplicationException("No info");
}
else
{
Console.WriteLine("Recieved server information successfully:");
Console.WriteLine(serv.summary());
}
}
Console.WriteLine("> Sending the data set to the server");
if (!conn.send_data_set(data))
{
Console.WriteLine("Unable to transfer the data set");
throw new ArgumentException("Cannot send data set");
}
else HandleLastResult(conn, "Data set transferred");
Console.WriteLine("> Sending search options to the server");
if (!conn.send_options(options))
{
Console.WriteLine("Unable to transfer the search options");
}
else HandleLastResult(conn, "Search options transferred");
Console.WriteLine("> Telling server to start searching");
if (!conn.start_search())
{
Console.WriteLine("Unable to send the start command");
throw new ApplicationException("Unable to send the start command");
}
else HandleLastResult(conn, "Start command sent");
Console.WriteLine("> Monitoring the search progress");
Dictionary<float, float> fitSize = new Dictionary<float, float>();
ArrayList models = new ArrayList();
using (SearchProgress progress = new SearchProgress())
{
using (SolutionFrontier bestSolutions = new SolutionFrontier())
{
int c = 0;
while (conn.query_progress(progress))
{
Console.WriteLine("> " + progress.summary());
using (var solution = progress.solution_)
//.........这里部分代码省略.........