Index: src/mainwindow.cpp
===================================================================
--- src/mainwindow.cpp	(revision fc9f661ded922aa881ab28ec5bb69bf20802af05)
+++ src/mainwindow.cpp	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -25,5 +25,5 @@
 #include "mainwindow.h"
 
-// TODO: Saving window state on close.
+// TODO: Saving window state on close
 
 MainWindow::MainWindow(QWidget *parent)
@@ -83,5 +83,5 @@
 //		tableTask->setColumnWidth(k,tableTask->viewport()->width() / n);
 	// If number of cities increased we need to reset headers and set
-	// appropriate sizes for new column and row.
+	// appropriate sizes for new column and row
 	if (increased) {
 QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ") + QVariant(n).toString());
@@ -130,5 +130,7 @@
 void MainWindow::Solve()
 {
-	tabWidget->setCurrentIndex(1);
+	// tabWidget->setCurrentIndex(1);
+CTSPSolver solver;
+	solver.solve(spinCities->value(),NULL);
 	// TODO: Task solving goes here :-)
 }
Index: src/mainwindow.h
===================================================================
--- src/mainwindow.h	(revision fc9f661ded922aa881ab28ec5bb69bf20802af05)
+++ src/mainwindow.h	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -28,4 +28,5 @@
 #include "ui_mainwindow.h"
 #include "settingsdialog.h"
+#include "tspsolver.h"
 
 class MainWindow: public QMainWindow, Ui::MainWindow
Index: src/settingsdialog.h
===================================================================
--- src/settingsdialog.h	(revision fc9f661ded922aa881ab28ec5bb69bf20802af05)
+++ src/settingsdialog.h	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -41,4 +41,4 @@
 };
 
-#endif //  SETTINGSDIALOG_H
+#endif // SETTINGSDIALOG_H
 
Index: src/tspsolver.cpp
===================================================================
--- src/tspsolver.cpp	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
+++ src/tspsolver.cpp	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -0,0 +1,54 @@
+/*
+ *  TSPSG - TSP Solver and Generator
+ *  Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
+ *
+ *  $Id$
+ *  $URL$
+ *
+ *  This file is part of TSPSG.
+ *
+ *  TSPSG 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.
+ *
+ *  TSPSG 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 TSPSG.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tspsolver.h"
+
+// Temoporary matrix for testing algorithm
+double testmatrix[] = {
+		infinity, 6, 7, 3, 4,
+		9, infinity, 6, 9, 10,
+		6, 9, infinity, 5, 3,
+		3, 10, 4, infinity, 2,
+		5, 1, 1, 9, infinity
+	};
+
+
+CTSPSolver::CTSPSolver()
+{
+}
+
+sStep *CTSPSolver::solve(int numCities, double *task)
+{
+	if (numCities <= 1)
+		return NULL;
+// Temporary debug code :-)
+	task = &testmatrix[0];
+	numCities = 5;
+//*/
+sStep step;
+	step.matrix = new double(numCities * numCities);
+	memcpy(step.matrix,task,sizeof(double) * numCities * numCities);
+
+	return NULL;
+}
+
Index: src/tspsolver.h
===================================================================
--- src/tspsolver.h	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
+++ src/tspsolver.h	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -0,0 +1,50 @@
+/*
+ *  TSPSG - TSP Solver and Generator
+ *  Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
+ *
+ *  $Id$
+ *  $URL$
+ *
+ *  This file is part of TSPSG.
+ *
+ *  TSPSG 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.
+ *
+ *  TSPSG 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 TSPSG.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TSPSOLVER_H
+#define TSPSOLVER_H
+
+#include <QtCore>
+
+const double infinity = 1.7E+308;
+
+// Structure represent one step of solving
+// The tree of such elements will represent the solving process
+struct sStep {
+	double *matrix;
+	double price;
+	struct {unsigned int x; unsigned int y;} pos;
+	sStep *pLeft, *pRight;
+	sStep() { matrix = NULL; price = pos.x = pos.y = 0; pLeft = pRight = NULL;}
+};
+
+// TSP Solver class
+class CTSPSolver
+{
+public:
+	CTSPSolver();
+	sStep *solve(int, double *);
+};
+
+#endif // TSPSOLVER_H
+
Index: tspsg.pro
===================================================================
--- tspsg.pro	(revision fc9f661ded922aa881ab28ec5bb69bf20802af05)
+++ tspsg.pro	(revision 67e53c96d7b707b7721db0b646943b711c48d649)
@@ -1,4 +1,4 @@
 ######################################################################
-# Automatically generated by qmake (2.01a) ?? 13. ??? 03:18:10 2007
+# Automatically generated by qmake (2.01a) ?? 20. ??? 18:37:06 2007
 ######################################################################
 
@@ -9,7 +9,10 @@
 
 # Input
-HEADERS += src/mainwindow.h src/settingsdialog.h
+HEADERS += src/mainwindow.h src/settingsdialog.h src/tspsolver.h
 FORMS += ui/mainwindow.ui ui/settingsdialog.ui
-SOURCES += src/main.cpp src/mainwindow.cpp src/settingsdialog.cpp
+SOURCES += src/main.cpp \
+           src/mainwindow.cpp \
+           src/settingsdialog.cpp \
+           src/tspsolver.cpp
 RESOURCES += resources/tspsg.qrc
 TRANSLATIONS += i18n/English.ts i18n/Ukrainian.ts
