Showing posts with label freeware. Show all posts
Showing posts with label freeware. Show all posts

October 30, 2009

Mini-project: Basic Systolic Algorithms

Here are two very basic simulation applications for two systolic algorithms (aka. Instruction Systolic Arrays). Their main purpose is to illustrate how such systolic algorithms work on a given data set. Both simulators have been designed for the Systolic Algorithms course I've attended at my university. 

Application no.1: Systolic Array Sorting 

The first algorithm I have implemented aims to solve the simple problem of Systolic Array Sorting. The idea of the problem is the following: given an uni-dimensional systolic system large enough to store the entire contents of an arbitrary array, devise a method of sorting the array in linear time (i.e. algorithm complexity of O(n)).
The systolic system that solves this problem is extremely simple:

1.Each systolic cell can store at most two values (a base value and an auxiliary transport value).
2.Each cell communicates with its left and right neighbors (it can receive a value from the left neighbor and can pass a value to its right neighbor = data flow model). When a cell receives a value from the left it stores it as a transport value.
3.At each step (system tact) each systolic cell (that holds both a base and a transport value) takes a simple decision: it passes to its left neighbor the lowest value between the base value and the transport value and stores the highest of the two.If the cell holds only a base value then it does not take any action.
The systolic system is initialized by loading the initial unsorted array (each array element is loaded as the base value of a cell cell). The output of the system (i.e. the right-most cell) should be connected to a data structure where we wish to store the sorted array. 
.
At each step we simply input into the systolic system a predefined maximal value (i.e. a value greater than any value in the unsorted array) by "communicating" it to the left-most cell of the systolic system.
.
The entire key (and idea behind any systolic algorithm) is that the "communication" process is parallel.
. 
If we have an array of size n the sorting process will take exactly 2*n steps which translates into a complexity of O(n). 


Application no.2: Systolic Matrix Multiplication

The second application simulates systolic matrix multiplication. The systolic architecture needed to solve this problem is a bit more complicated than the one used in the first example. The cells are organized as a matrix (the size of which is equal to the one of the expected result matrix). Each cell can communicate with its 4 neighbors (receives values from the cells to the left and above and sends them to the cells to the right and below). Also, the individual organization of each cell is more complicated, as each cell can hold 3 values and execute 2 operations (addition and multiplication). For a detailed explanation of the systolic matrix multiplication algorithm please see this page.
.
The complexity of this systolic algorithm is O(n) as it would take 3*n steps to multiply two matrices of size nxn. In order to simplify the observation of the process, in the simulation application, each step is further divided into 3 sub-operations.


Although fairly simple, these two examples can easily show the power of systolic architectures as they offer linear solutions to problems which normally have a higher complexity (O(n*log(n)) for sorting and O(n^2.376) for matrix multiplication)).
.
You can download these two simulators by clicking here or from the Downloads box (SystolicSimulators.zip).  

Application platform: WinNT

June 14, 2009

Mini-project: DCrypt

DCrypt is a small program I wrote for my network security class. It features 2 encryption ciphers and the DES algorithm. It was written in Delphi and allows for text to hexadecimal encryption and hexadecimal to text decryption.
.
The first cipher I included in DCrypt is the Viginere cipher. You can find out detailed information about this encryption method here. In this implementation, the cipher can process full ASCII text but only encodes the letters (A-Z). It also converts small letters to capital letters.
.
The second cipher I implemented is the Bifid cipher. In the current implementation this cipher can only process text containing: A-Z letters and a few special characters. It too converts small letters to capital leters.
.
Finally, the DES implementation encodes full ASCII text using 64 bit blocks and a 64 bit key and does not perform any conversions on the text. The code for this part of the application is largely based on a Delphi unit written by Francoise PIETTE.
.
You cand download a fully working version of the application (source code included) by clicking here or from the Downloads box (DCrypt.zip). Here are two screenshots:



Application platform: WinNT

February 1, 2009

Mini-Project: Shutdown Timer

Lately I got used to falling asleep while watching TV on my laptop and as my TV-tuner software is quite primitive and doesn't have the option to shutdown the computer after a predefined period of time, I started to search the web for a simple shutdown timer application. I didn't want a fancy application with a lot of options just a basic program that will enable me to select a period of time after which the system would shutdown and that, if needed, could cancel the shutdown command.
.
As the first two applications found by Google that met my over demanding request were not free I decided to write my own program. I remembered a nice and useful piece of code I once stumbled upon on Torry's Delphi Pages that enables a process to aquire privileges on WinNT platforms. I used it to aquire the 'SeShutdownPrivilege' and after that, the rest of the program was done in no more than 15 minutes.
.
You cand download a fully working version of Shutdown Timer (source code included) by clicking here or from the Downloads box (ShutdownTimer.zip). Ohh ... and here is a screenshot of my latest mesmerizing achievement in the field of computer software:


Application platform: WinNT

Edit: Application now supports one command line parameter: a numeric value indicating the number of minutes till shutdown. 

January 19, 2009

Project: Bandwidth reduction

This post is a follow-up to the problem of bandwidth reduction presented earlier. I've done a small Delphi application that can generate sparse matrices of various sizes and densities (the density of a sparse matrix is the percent of non-zero elements is contains) and that features 3 (well, actually more like 2) bandwidth reduction algorithms. The first algorithm is the original Cuthill-McKee algorithm, the second one is the Reverse Cuthill-Mckee algorithm (both of which have been covered in detail) and the third algorithm I've decided to implement is a genetic algorithm.
.
I must say that I was very curious to see how a genetic algorithm would perform on this problem as the bandwidth reduction problem is basically a combinatorial problem. As it turns out there is a really nice study performed by A. Lim, B. Rodrigues and F. Xiao that covers this exact topic. The three researchers carry on the work of R. Marti and V. Campos in trying to use a metaheurisc approach in order to obtain better results than the classic bandwidth reduction algorithms (RCM and GPS).
.
Although genetic algorithms perform very well in global search, some researchers argue that they are less suitable for highly tuned search. As such, Lim, Rodrigues and Xiao combined their genetic algorithm with a hill climbing approach. The resulting hybrid (memetic) algorithm performs very well and generally produces solutions of better quality than the Reverse Cuthill-McKee algorithm.
.
My implementations of the CutHill-McKee algorithm and of the genetic algorithm are by no means optimal! (the genetic algorithm is also slightly modified). Hence, both algorithms perform relatively poor (in terms of speed) compared with their creators' estimations. However, the main purpose of this project was to show that in the field of NP-complete problem solving, metaheuristic approaches, although considered rather slow, can be expected to produce very high quality results.
.
You cand download a fully working version of the application (source code included) by clicking here or from the Downloads box (BandwidthReduction.zip). Here are two screenshots
:


And here is an example of how RCM and the hybrid metaheuristics-based algorithm performed on a 150x150 randomly generated simetric sparse matrix with a density of 3.5% (788 non-zero elements):

1. The initial sparse matrix. (bandwidth = 142)

 
2. The solution obtained using RCM. (bandwidth = 81)

 
3. The solution obtaind using the hybrid genetic + hill climbing algorithm. (bandwidth = 65). This solution was obtained after 15 generations using a mutation rate of 40%.


Application platform: Win32

November 17, 2008

Project: AutomatedTimetable

This project is the result of a university team-assignment me and my colleagues signed up for in the spring of 2008. The goal was to build an automated timetabling solution that would aid in the generation of our department's timetable.
.
The application had to implement the following features:
- it should allow the user to specify the general planning context (the number of professors, the student groups, the number of lectures, the type of a given lecture, available classrooms, etc.);
- it should enable the user to specify a certain constraints (some lectures are to be held in a particular classroom, some professors are available only in some time periods, etc.);
- it should automatically generate in a reasonable amount of time "the best" timetable in accordance to the given planning context and the constraints that must be enforced (given that a solution to the planning problem exists);
- it must export timetables for each student group, professor and classroom in both a .pdf and .xml format;
As the problem at hand was fairly complex, the workload for this project was clearly divided between the 4 team members:
- Andrei Niciu was in charge of developing the main Delphi application which, besides integrating all other parts of the project, offers custom made, smart and extremly user friendly tools for manipulating planning contexts and related constraints;
- Alexandra Kulcsar developed the Java export module that generates the beautifully looking .pdf files that represent the solution of the given timetabling problem;
- Mihaela Radescu worked on the comunication protocol between the different modules of the application, providing valuable means of data conversion and storage.
- I worked on finding adapting and implementing the automated timetabling algorithm employed in the project. This type of scheduling problem has been proved to be NP-complete so the search for a good heuristic or metaheuristic was on.

This scheduling algorithm is derived from the one proposed by M. Chiarandini, M Birattari, K. Socha and O. Rossi-Doria in their 2006 article in the Springer Journal of Scheduling. It is based on construction heuristics and metaheuristics (local search, tabu search, simulated annealing). The proposed algorithm also tries to divide the general timetabling problem into two smaller ones that are resolved sequentially:
1. an existential problem (try to find a scheduling configuration that doesn't break any hard constraints);
2. an optimization problem (take a solution to the existential problem and improve it so that it breaks the fewest number of soft constraints);

After finishing my work on the AutomatedTimetable application, I've continued experimenting with various scheduling methods and my Bachelor's Thesis presents my version of a lightweight scheduling algorithm inspired by the works of M. Chiarandini & Co. I've also rewritten the original Delphi Component used by the AutomatedTimetable such as to employ the new algorithm and thus benefit from its improvements (new structure for the soft constraint optimizer, multithreading and thread trimming stages).

You can download a fully working version of the AutomatedTimetable application by clicking here or from the Downloads box (AutomatedTimetable.zip). Unfortunately, for now, the application does not have any help files. If you have any questions regarding how to use it, please don't hesitate to ask. Here are some screenshots:
 


Application platform: Win32 + Java (JRE)

November 9, 2008

Project: DOthello

DOthello is my implementation of the classic Othello (aka Reversi) board game. The starting point of the project was an AI lab assignment regarding game trees (minmax, alpha-beta pruning, etc). I've decided not only to implement these algorithms but also incorporate them into a fun and easy to use application. DOthello has a quick in-game save and load mechanism and the position of the game board can be adjusted by selecting its margin and dragging it.
.
The program was written in Delphi and for the graphics part I've used OpenGL. For DOthello, I've also designed my own meshes and textures.
The game features the following AI players:
1. Dazzy - a random player;
2. Jabba - an alpha-beta player with a mainly greedy evaluation function
3. Bugzy - an alpha-beta player with a mainly very basic mobility based evaluation function;
4. BOB - an alpha-beta player with with a mobility function that combines basic mobility with piece count and weighted positions;
5. Dexter - an alpha-beta player with a slightly more advance mobility limiting evaluation function that also relies on piece count and weighted positions; 

All AI's perform searches to a depth of 5 ply in early and midgame and 13 ply in endgame. Here are two snapshots from the application:
 

I don't think that any experienced Othello player would have a problem in defeating all of these AI's easily as they are fairly basic, but for a novice the game should be rather interesting.
.
I submitted DOthello to FDAC on delphi.about a few months back. You can download a fully working version of DOthello (source code and resources included) by clicking here or from my Downloads box (DOthello.zip).

Application platform: Win32 + OpenGL support

November 7, 2008

Project: AFN to AFD

AFN to AFD is one of my very first programs written in C (in 2005). I just came across it as I was cleaning up one of my old project folders. The main objective of the program is to convert a non-deterministic finite automata (AFN) into a deterministic finite automata (AFD) and to display, using C style graphics, the two types of automata. Here are two screenshots (in the left one, we have the AFN and in the other one, the resulting AFD):



You can download a fully working version of this project (source code included) by clicking here or from the Downloads box (AFNtoAFD.zip). The file help.txt contains detailed information about the format of the input file.

Application platform: Win32, MS-DOS

November 4, 2008

Project: Ground Attack

Ground Attack is an arcade game that I wrote in Delphi (OpenGL API) during my 2005 spring break for a private customer. The game itself is very simple and not very original (in fact I had to design the whole gameplay in order to imitate a demo previously released by Garage Games). The challenging thing about this project was the fact that I had to develop an easy to change and general design and the fact that I had to make my own textures as well.
.
You can download a fully working version of Ground Attack by clicking here or from the Downloads box (GroundAttack.zip).





Application platform: Win32 + OpenGL support