Skip to content

Commit 03748f8

Browse files
committed
Upgrade to 3.0. Bugfixing still needed, but a number of things do work.
git-svn-id: http://encog-cs.googlecode.com/svn/trunk/encog-core@636 0d3f3ea6-ac51-0410-a1de-edb5cd2a854a
1 parent 8768778 commit 03748f8

File tree

657 files changed

+125753
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

657 files changed

+125753
-0
lines changed

ConsoleExamples/ConsoleExamples.cs

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
// Encog(tm) Artificial Intelligence Framework v2.5
2+
// .Net Version
3+
// http://www.heatonresearch.com/encog/
4+
// http://code.google.com/p/encog-java/
5+
//
6+
// Copyright 2008-2010 by Heaton Research Inc.
7+
//
8+
// Released under the LGPL.
9+
//
10+
// This is free software; you can redistribute it and/or modify it
11+
// under the terms of the GNU Lesser General Public License as
12+
// published by the Free Software Foundation; either version 2.1 of
13+
// the License, or (at your option) any later version.
14+
//
15+
// This software is distributed in the hope that it will be useful,
16+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+
// Lesser General Public License for more details.
19+
//
20+
// You should have received a copy of the GNU Lesser General Public
21+
// License along with this software; if not, write to the Free
22+
// Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23+
// 02110-1301 USA, or see the FSF site: http://www.fsf.org.
24+
//
25+
// Encog and Heaton Research are Trademarks of Heaton Research, Inc.
26+
// For information on Heaton Research trademarks, visit:
27+
//
28+
// http://www.heatonresearch.com/copyright.html
29+
30+
using System;
31+
using System.Collections.Generic;
32+
using System.Linq;
33+
using System.Text;
34+
using ConsoleExamples.Examples;
35+
using Encog.Examples;
36+
37+
namespace ConsoleExamples
38+
{
39+
/// <summary>
40+
/// Console examples
41+
///
42+
/// For example, to run the xor-rprop example, with a pause, use the
43+
/// following command.
44+
///
45+
/// -pause xor-rprop
46+
/// </summary>
47+
public class ConsoleExamples
48+
{
49+
private List<ExampleInfo> examples = new List<ExampleInfo>();
50+
51+
public ConsoleExamples()
52+
{
53+
examples.Add(Encog.Examples.Adaline.AdalineDigits.Info);
54+
examples.Add(Encog.Examples.AnnealTSP.SolveTSP.Info);
55+
examples.Add(Encog.Examples.ARTExample.ClassifyART1.Info);
56+
examples.Add(Encog.Examples.BAM.BidirectionalAssociativeMemory.Info);
57+
examples.Add(Encog.Examples.Benchmark.EncogBenchmarkExample.Info);
58+
examples.Add(Encog.Examples.Boltzmann.BoltzTSP.Info);
59+
examples.Add(Encog.Examples.CPN.RocketCPN.Info);
60+
examples.Add(Encog.Examples.ElmanNetwork.ElmanExample.Info);
61+
examples.Add(Encog.Examples.GeneticTSP.GeneticSolveTSP.Info);
62+
examples.Add(Encog.Examples.Hopfield.Simple.HopfieldSimple.Info);
63+
examples.Add(Encog.Examples.Hopfield.Associate.HopfieldAssociate.Info);
64+
examples.Add(Encog.Examples.JordanNetwork.JordanExample.Info);
65+
examples.Add(Encog.Examples.MultiBench.MultiThreadBenchmark.Info);
66+
examples.Add(Encog.Examples.Image.ImageNeuralNetwork.Info);
67+
examples.Add(Encog.Examples.Persist.PersistEncog.Info);
68+
examples.Add(Encog.Examples.Persist.PersistSerial.Info);
69+
examples.Add(Encog.Examples.Benchmark.WeightInitialization.Info);
70+
examples.Add(Encog.Examples.Benchmark.ThreadCount.Info);
71+
examples.Add(Encog.Examples.Benchmark.SimpleBenchmark.Info);
72+
examples.Add(Encog.Examples.XOR.XORFactory.Info);
73+
examples.Add(Encog.Examples.XOR.XORHelloWorld.Info);
74+
examples.Add(Encog.Examples.XOR.XORFlat.Info);
75+
examples.Add(Encog.Examples.XOR.XORDisplay.Info);
76+
}
77+
78+
public void ListCommands()
79+
{
80+
List<String> commands = new List<string>();
81+
82+
Console.WriteLine(@"The following commands are available:");
83+
84+
85+
foreach (ExampleInfo info in examples)
86+
{
87+
commands.Add(info.Command.PadRight(20) + ": " + info.Title);
88+
}
89+
90+
commands.Sort();
91+
92+
foreach (String str in commands)
93+
{
94+
Console.WriteLine(str);
95+
}
96+
}
97+
98+
public void Execute(String[] args)
99+
{
100+
int index = 0;
101+
bool pause = false;
102+
bool success = false;
103+
104+
// process any options
105+
106+
while (index < args.Length && args[index][0] == '-')
107+
{
108+
String option = args[index].Substring(1).ToLower();
109+
if ("pause".Equals(option))
110+
pause = true;
111+
index++;
112+
}
113+
114+
if (index >= args.Length )
115+
{
116+
Console.WriteLine(@"Must specify the example to run as the first argument");
117+
ListCommands();
118+
if (pause)
119+
{
120+
Pause();
121+
}
122+
return;
123+
}
124+
125+
String command = args[index++];
126+
127+
// get any arguments
128+
String[] pargs = new String[args.Length - index];
129+
for (int i = 0; i < pargs.Length; i++)
130+
{
131+
pargs[i] = args[index + i];
132+
}
133+
134+
foreach(ExampleInfo info in examples)
135+
{
136+
if (String.Compare(command, info.Command, true) == 0)
137+
{
138+
IExample example = info.CreateInstance();
139+
example.Execute(new ConsoleInterface(pargs));
140+
success = true;
141+
break;
142+
}
143+
}
144+
145+
if (!success)
146+
{
147+
Console.WriteLine("Unknown command: " + command);
148+
ListCommands();
149+
}
150+
151+
if (pause)
152+
{
153+
Pause();
154+
}
155+
}
156+
157+
public void Pause()
158+
{
159+
Console.Write("\n\nPress ENTER to continue.");
160+
Console.ReadLine();
161+
}
162+
163+
static void Main(string[] args)
164+
{
165+
ConsoleExamples app = new ConsoleExamples();
166+
app.Execute(args);
167+
}
168+
}
169+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>9.0.30729</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{A65A5878-6336-4ACF-9C40-540F8FAF2CC7}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Encog</RootNamespace>
12+
<AssemblyName>ConsoleExamples</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<FileUpgradeFlags>
16+
</FileUpgradeFlags>
17+
<OldToolsVersion>3.5</OldToolsVersion>
18+
<UpgradeBackupLocation />
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Core">
40+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
41+
</Reference>
42+
<Reference Include="System.Drawing" />
43+
<Reference Include="System.Xml.Linq">
44+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
45+
</Reference>
46+
<Reference Include="System.Data.DataSetExtensions">
47+
<RequiredTargetFramework>3.5</RequiredTargetFramework>
48+
</Reference>
49+
<Reference Include="System.Data" />
50+
<Reference Include="System.Xml" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<Compile Include="ConsoleExamples.cs" />
54+
<Compile Include="Examples\Adaline\AdalineDigits.cs" />
55+
<Compile Include="Examples\Benchmark\SimpleBenchmark.cs" />
56+
<Compile Include="Examples\Benchmark\ThreadCount.cs" />
57+
<Compile Include="Examples\Benchmark\WeightInitialization.cs" />
58+
<Compile Include="Examples\GeneticTSP\GeneticSolveTSP.cs" />
59+
<Compile Include="Examples\GeneticTSP\ICalculateGenomeScore.cs" />
60+
<Compile Include="Examples\GeneticTSP\TSPGenome.cs" />
61+
<Compile Include="Examples\GeneticTSP\TSPScore.cs" />
62+
<Compile Include="Examples\Hopfield\Associate\HopfieldAssociate.cs" />
63+
<Compile Include="Examples\Hopfield\Simple\HopfieldSimple.cs" />
64+
<Compile Include="Examples\Image\ImageNeuralNetwork.cs" />
65+
<Compile Include="Examples\Image\ImagePair.cs" />
66+
<Compile Include="Examples\JordanNetwork\JordanExample.cs" />
67+
<Compile Include="Examples\MultiBench\MultiThreadBenchmark.cs" />
68+
<Compile Include="Examples\Persist\PersistEncog.cs" />
69+
<Compile Include="Examples\Persist\PersistSerial.cs" />
70+
<Compile Include="Examples\Util\City.cs" />
71+
<Compile Include="Examples\AnnealTSP\SolveTSP.cs" />
72+
<Compile Include="Examples\AnnealTSP\TSPSimulatedAnnealing.cs" />
73+
<Compile Include="Examples\ARTExample\ClassifyART1.cs" />
74+
<Compile Include="Examples\BAM\BidirectionalAssociativeMemory.cs" />
75+
<Compile Include="Examples\Benchmark\EncogBenchmarkExample.cs" />
76+
<Compile Include="Examples\Boltzmann\BoltzTSP.cs" />
77+
<Compile Include="Examples\ConsoleInterface.cs" />
78+
<Compile Include="Examples\CPN\RocketCPN.cs" />
79+
<Compile Include="Examples\ElmanNetwork\ElmanExample.cs" />
80+
<Compile Include="Examples\ExampleArgument.cs" />
81+
<Compile Include="Examples\ExampleInfo.cs" />
82+
<Compile Include="Examples\IExample.cs" />
83+
<Compile Include="Examples\IExampleInterface.cs" />
84+
<Compile Include="Examples\Util\TemporalXOR.cs" />
85+
<Compile Include="Examples\XOR\XORDisplay.cs" />
86+
<Compile Include="Examples\XOR\XORFactory.cs" />
87+
<Compile Include="Examples\XOR\XORFlat.cs" />
88+
<Compile Include="Examples\XOR\XORHelloWorld.cs" />
89+
<Compile Include="Properties\AssemblyInfo.cs" />
90+
</ItemGroup>
91+
<ItemGroup>
92+
<ProjectReference Include="..\encog-core-cs\encog-core-cs.csproj">
93+
<Project>{AC6FADF9-0904-4EBD-B22C-1C787C7E7A95}</Project>
94+
<Name>encog-core-cs</Name>
95+
</ProjectReference>
96+
</ItemGroup>
97+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
98+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
99+
Other similar extension points exist, see Microsoft.Common.targets.
100+
<Target Name="BeforeBuild">
101+
</Target>
102+
<Target Name="AfterBuild">
103+
</Target>
104+
-->
105+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4+
<StartArguments>-pause xor-display</StartArguments>
5+
</PropertyGroup>
6+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
7+
<StartArguments>-pause forest evaluate</StartArguments>
8+
</PropertyGroup>
9+
</Project>

0 commit comments

Comments
 (0)