Computer Implementation of Genetic Programming

Computer Implementation of Genetic Programming

DOI: 10.4018/978-1-5225-6005-0.ch004

Abstract

This chapter presents the computer implementation of the tree-based genetic programming in C# programming language. Since C# is a common object-oriented programming language, with little modification the source code presented in the chapter can be easily transformed into Java or C++ programming languages. The chapter covers all aspects of the implementation: node, chromosome, population, function set, and terminal set class implementations. The chapter is carefully structured, so at the end of the chapter fully working GP computer program will be implemented which can solve regression and multiclass classification problems. The reader should not worry about specific operating system, or development environment, since all code implementations are based on cross-OS and open source integrated development environment visual studio code which can run on Windows, Mac, or Linux.
Chapter Preview
Top

Preparation Steps

In order to start with the GP implementation, the following preparation steps must be completed:

  • Operating System selection,

  • Installation of .NET Core platform and Visual Studio Code,

  • Creating starting project for GP implementation.

Operating Systems Selection

In order to implement GP in the C# programming language the reader should not worry about Operating System, nor license for the Code editor and debugger. Whole chapter can be realized with open source based Operating System like Ubuntu or Fedora, as well as open source and cross operating system platform .NET Core and Visual Studio Code. Besides the Linux based distribution, reader can also use the Windows or MAC operating systems.

Installation of IDE

Source code editor and debugger used in this chapter is Visual Studio Code or short VS Code. VS Code is open source code editor and debugger developed by Microsoft which supports many programming languages e.g. C++, Java, JavaScript, C#, etc. Besides the code editor, VS Code supports many other features like: debugging, embedded GIT source code version control, syntax highlighting, intelligent code completion (IntelliSense), code snippets and code refactoring. The VS Code provides rich set of documentation for installation, code editing and debugging for all supported programming languages. Every supported feature is unique on all operating systems, so the user can start working on the project on Windows, then can switch to Linux or Mac and continue working on it. All information and documentation can be found at http://code.visualstudio.com.

Figure 1.

VS Code download web page

978-1-5225-6005-0.ch004.f01

After installation process, VS Code has basic features such as: source code capability, GIT support and support for different theme and colors.

Installing VS Code on Linux

Supported Linux distribution for running VS Code are: Ubuntu, Debian, RHEL, Fedora and CentOS, openSUSE and SLE. Depending on certain distribution, the different installation instruction can be found.

All installation instructions can be found at: http://code.visualstudio.com/docs/setup/linux.

In order to install VS Code on openSUSE the following commands should be run in the Terminal Window:

sudo sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e “[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc” > /etc/zypp/repos.d/vscode.repo'
sudo zypper refresh
sudo zypper install code

Installing VS Code on Mac

VS Code installation process on Mac is very easy. After downloading appropriate installation package which can be found at http://code.visualstudio.com/download, downloaded directory should be opened and the zip file should be extracted. The extracted application file should be copied to Applications directory. Once the VS Code application file is copied into Application directory, VS Code is installed and ready for run.

Complete Chapter List

Search this Book:
Reset