A permutation-based algorithm to optimally reschedule trains in a

railway traffic network
In this paper we discuss dynamic traffic management of railway traffic networks at an
operational level. We design a model predictive controller based on measurements of the actual
train positions. The core of the model predictive control approach is the railway traffic model, for
which a switching max-plus linear system is proposed. If the model is affine in the controls, the
optimisation problem can be recast as a mixed-integer linear programming problem. To this end
we present a permutation-based algorithm to model the rescheduling of trains running on the
same track. We apply the algorithm to a simple railway traffic network simulation model and
show a significant reduction of delays compared to the uncontrolled case.

Current practice in the operational-level management of railway traffic networks is
mostly based on predefined rules and on the ability of traffic controllers and train dispatchers to
detect and avoid conflicting situations. Delays caused by technical failures, fluctuation of
passenger volumes, and/or weather conditions can be partly absorbed by a stable and robust
timetable (Goverde, 2007).In the case of large delays, network managers might be forced to reroute or to change the order of trains, break connections, or even cancel a scheduled service to
prevent the accumulation of delays in the network. In this paper we design a predictive feedback
controller that computes the most effective actions, based on measurements of the actual train
positions. The control measures are restricted to changing the order of trains running on the same
track. A railway network with rigid connection constraints and a fixed routing schedule can be
modeled using max-plus linear (MPL) models (Heidergott and de Vries, 2001). An MPL model is
linear in the max-plus algebra (Baccelliet al., 1992), which has maximisation and addition as its
basic operations. Max-plus-linear systems can be characterized as discrete event systems in
which only synchronization and no concurrency or choice occurs (Baccelli et al.,1992). In the
railway context, synchronization means that some trains should give predefined connections to
other trains, and a fixed routing schedule means that the order of departure is fixed. In this paper
we model a controlled railway system using the switching max-plus-linear system description of
van den Boom and De Schutter (2006). In this description we use a number of MPL models, each
model corresponding to a specific mode, describing the network by a different set ofconnection
and order constraints. We control the system by switching between different modes, allowing us
to change the order of trains to minimise the delays of all trains in the network while considering
the cost of the control actions.

 Simulation

Trains movement shown by map

 Train Status

Current station



Status of train(Running,stopped,queued)

 Parameter Initialization

Number of trains

Simulation speed


Minimum train insertion time

Maximum train insertion time

Current practice in the operational-level management of railway traffic networks is
mostly based on predefined rules and on the ability of traffic controllers and train dispatchers to
detect and avoid conflicting situations. Delays caused by technical failures, fluctuation of
passenger volumes, and/or weather conditions can be partly absorbed by a stable and robust
timetable. In the case of large delays, network managers might beforced to re-route or to change
the order of trains, break connections, or even cancel a scheduled service to prevent the
accumulation of delays in the network.

In this paper we design a predictive feedback controller that computes the most effective
actions, based on measurements of the actual train positions. The control measures are restricted
to changing the order of trains running on the same track.

Hardware Requirements:
 Processor


Pentium IV




 Hard Disk



Software Requirements:
 Operating system


Windows XP

 Language used


Java 1.6

A feasibility study is a test of the system proposal regarding to its work ability, impact on
the organization, ability to meet user needs, and effective use of resources. Thus when a new
application is proposed, it normally goes through a feasibility study before it’s is approved for
An important outcome of the preliminary investigation is the determination that the
system requested is feasible.


Evaluating the technical feasibility is the trickiest part of a feasibility study. This is
because , at this point in time, not too many detailed design of the system, making it difficult to
access issues like performance, costs on ( account of the kind of technology to be deployed) etc.
A number of issues have to be considered while doing a technical analysis.

Understand the different technologies involved in the proposed system :
Before commencing the project, we have to be very clear about what are the technologies
that are to be required for the development of the new system.


Find out whether the organization currently possesses the required technologies:
o Is the required technology available with the organization?
o If so is the capacity sufficient?
For instance –
“Will the current printer be able to handle the new reports and forms required for the new


Economic feasibility attempts 2 weigh the costs of developing and implementing a new
system, against the benefits that would accrue from having the new system in place. This
feasibility study gives the top management the economic justification for the new system.
A simple economic analysis which gives the actual comparison of costs and benefits are
much more meaningful in this case. In addition, this proves to be a useful point of reference to
compare actual costs as the project progresses. There could be various types of intangible
benefits on account of automation. These could include increased customer satisfaction,
improvement in product quality better decision making timeliness of information, expediting
activities, improved accuracy of operations, better documentation and record keeping, faster
retrieval of information, better employee morale.

Proposed projects are beneficial only if they can be turned into information systems that will
meet the organizations operating requirements. Simply stated, this test of feasibility asks if the
system will work when it is developed and installed. Are there major barriers to Implementation?
Here are questions that will help test the operational feasibility of a project:

Is there sufficient support for the project from management from users? If the current
system is well liked and used to the extent that persons will not be able to see reasons for
change, there may be resistance.

Are the current business methods acceptable to the user? If they are not, Users may
welcome a change that will bring about a more operational and useful systems.

Have the user been involved in the planning and development of the project?

Early involvement reduces the chances of resistance to the system and in

General and increases the likelihood of successful project.

Since the proposed system was to help reduce the hardships encountered. In the existing manual
system, the new system was considered to be operational feasible.

Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank and Mike
Sheridan at SUN Microsystems Incorporation in the year 1991.It took 18 months to develop the 1 st
working version. This language was initially called “OAK”, but was renamed “JAVA” in 1995, many
more contributed to the design and evolution of the language.

Java is a powerful but lean object-oriented programming language. It has generated a lot of
excitement because it makes it possible to program for Internet by creating Applets. Programs that can be
embedded in web page. The context of an applet can be an animation with sound, an interactive game or a
ticker tape. With constantly updated stock prices. Applets can be just little decorations to liven up web
page, or they can be serious applications like Word processor or Spreadsheet.

But Java is more than a programming language for writing Applets. It is being used more and
more for writing standalone applications as well. It is becoming so popular that many people believe it
will become standard language for both general purpose and Internet programming.

There are many buzzwords associated with Java, but because of its spectacular growth in
popularity, a new buzzword has appeared ubiquitous. Indeed, all indications are that it will soon be

Java builds on the strength of C++. It has taken the best features of C++ and discarded the more
problematic and error prone parts. To this lean core, it has added garbage collection (automatic memory
management), multithreading (the capacity for one program to do more than one thing at a time), security
capabilities. This result is that Java is simple, elegant, and powerful and easy-to-use.
Java is actually a platform consisting of 3 components:
1. Java Programming Language.
2. Java Library of Classes and Interfaces.
3. Java Virtual Machine

The following sections will say more about these components.

Java is a programming language originally developed by Sun Microsystems and released in
1995 as a core component of Sun Microsystems' Java platform. The language derives much of its
syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java
applications are typically compiled to bytecode that can run on any Java virtual machine (JVM)
regardless of computer architecture.
One characteristic of Java is portability, which means that computer programs written in the Java
language must run similarly on any supported hardware/operating-system platform. One should
be able to write a program once, compile it once, and run it anywhere.
This is achieved by compiling the Java language code, not to machine code but to Java bytecode
– instructions analogous to machine code but intended to be interpreted by a virtual machine
(VM) written specifically for the host hardware. End-users commonly use a JRE installed on
their own machine, or in a Web browser.
Standardized libraries provide a generic way to access host specific features such as graphics,
threading and networking. In some JVM versions, bytecode can be compiled to native code,
either before or during program execution, resulting in faster execution.
A major benefit of using bytecode is porting. However, the overhead of interpretation means that
interpreted programs almost always run more slowly than programs compiled to native
executables would, and Java suffered a reputation for poor performance. This gap has been
narrowed by a number of optimization techniques introduced in the more recent JVM
One such technique, known as (just-in-time compilation) JIT, translates Java bytecode into native
code the first time that code is executed, then caches it. This result in a program that starts and
executes faster than pure interpreted code can, at the cost of introducing occasional compilation
overhead during execution. More sophisticated VMs also use dynamic recompilation, in which
the VM analyzes the behavior of the running program and selectively recompiles and optimizes

parts of the program. Dynamic recompilation can achieve optimizations superior to static
compilation because the dynamic compiler can base optimizations on knowledge about the
runtime environment and the set of loaded classes, and can identify hot spots - parts of the
program, often inner loops, that take up the most execution time. JIT compilation and dynamic
recompilation allow Java programs to approach the speed of native code without losing
Another technique, commonly known as static compilation, or ahead-of-time (AOT)
compilation, is to compile directly into native code like a more traditional compiler. Static Java
compilers translate the Java source or bytecode to native object code. This achieves good
performance compared to interpretation, at the expense of portability; the output of these
compilers can only be run on a single architecture. AOT could give Java something like
performance, yet it is still not portable since there are no compiler directives, and all the pointers
are indirect with no way to micro manage garbage collection.
Java's performance has improved substantially since the early versions, and performance of JIT
compilers relative to native compilers has in some tests been shown to be quite similar. The
performance of the compilers does not necessarily indicate the performance of the compiled
code; only careful testing can reveal the true performance issues in any system.
One of the unique advantages of the concept of a runtime engine is that errors (exceptions)
should not 'crash' the system. Moreover, in runtime engine environments such as Java there exist
tools that attach to the runtime engine and every time that an exception of interest occurs they
record debugging information that existed in memory at the time the exception was thrown
(stack and heap values). These Automated Exception Handling tools provide 'root-cause'
information for exceptions in Java programs that run in production, testing or development

Features of java:

Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and
FTP Java applications can open and access across the Net via URLs with the same ease as when

accessing local file system.
We have found the networking capabilities of Java to be both strong and easy to use.
Anyone who has tries to do Internet programming using another language will revel. How simple
Java makes onerous tasks will like opening a socket connection.

Java is intended for writing programs that must be readable in a Variety ways. Java puts a
lot of emphasis on early checking for possible problems, later dynamic checking, and eliminating
situations that are error prone. The single biggest difference between Java has a pointer model
that eliminates the possibility of overwriting memory and corrupting data.
The Java compiler detects many problems that in other languages would only show up at
runtime. As for the second point, anyone who has spent hours chasing a memory leak cost by a
printer bug will be very happy with this feature of Java.
Java gives you the best of both worlds. You need not pointers for everyday constructs like
string and arrays. You have the power of pointers if you need it, for example, for like lists. And
you have always-complete safety, since you can never access a bad pointer or make memory
allocation errors.

Java is intended to be used in networked/distributed environment toward that end; a lot of
emphasis has been placed on security. Java enables the contraction of virus-free, temper-free
Here is a sample of what Java’s security features are supposed to keep a Java programming
from doing:
1. Overrunning the runtime stack.
2. Corrupting memory outside its own process space.
3. Reading or writing local files when invoked through a securityConscious class loaders like Web browser.

Architecture Neutral
The compiler generates an architecture neutral object file format- the compiled code is
executable on many processors, given the presence of Java runtime system...The Java compiler
does this by generating byte code instructions which have nothing to do with a particular
computer architecture. Rather they ere designed to be both easy to any machine and easily
translated into native machine code on the fly.

Twenty years ago, the UCSD Pascal system did the same thing in a commercial product
and, even before that, Nicholas Worth’s original implementation of Pascal used the same
approach. By using bytecode, performance takes major hit. The designers of Java did an excellent
job developing a byte code instruction set those workers well on today’s most common computer
architectures. And the codes have been designed to translate easily into actual machine

Unlike C and C++, they are no "implementation dependent" aspects of the specifications.
The sizes of the primitive’s data types are specified, as is the behavior of arithmetic on them.
For example, an int in Java is always a 32-bit integer. In C/C++, int can mean a 16-bit
integer, a 32-bit integer, or any size the compiler vendor likes. The only restriction is that it
must have at least as many bytes int and cannot have more bytes than a long int.
The libraries that are a part of the system define portable interfaces. For example, there
is an abstract window class and implementations of it UNIX, Windows, and the Macintosh.

The Java interpreters can execute Java byte codes directly on any machine to which the
interpreter has been ported. Since linking is a more incremental and lightweight process, the
development process can be much more rapid and explanatory.
One problem is that the JDK is fairly slow at compiling your source code to the bytecode
that will, ultimately, be interpreted in the current version.

High Performance
While the performance of interpreted bytecode is usually more than adequate, there are
situations higher performance is required. The bytecode can be translated on fly into machine
code for the particular CPU the application is running on.
Native code compilers for Java are not yet generally available. Instead there are just-intime (JIT) compilers. These work by compiling the byte codes into native code once, caching
the results, and then calling them again, if needed. This speeds up code once, catching the
results, and calling them again, if needed. This speed up the loop tremendously since once has
to do the interpretation only once. Although still slightly slower than a true native code
compiler, just-in-time compilers can give you a 10-or even 20-fold speedup for some programs
and will almost always be significantly faster than the Java Interpreter.

 Multithreaded
In a number of ways, Java is more dynamic language than C or C++. It was designed to
adapt to an evolving environment. Libraries can freely add new methods and instance variables
without any effect on their clients.... In Java, finding out run time type information is

This is an important feature in those situations where code needs to be added to a running
program. A prime example is code that is downloaded from the Internet to run in browser.

Servlets provides a Java-Based solution used to address the problems currently associated
with doing server side programming, including inextensible scripting solutions, platform specific
APIs, and incomplete interfaces. Servlets are objects conform to a specific interface that can be
plugged into a Java-based server. Servlets are to the server-side what applets are to the clientside-object byte codes that can be dynamically loaded off the net. They differ from applets in that
they are faceless objects (without graphics or a GUI component). They serve as platform
independent, dynamically loadable, plug gable helper byte code objects on the server side that
can be used to dynamically extend server-side functionality.

For example, an HTTP servlet can be used to generate dynamic HTML content. When
you use servlets to do dynamic content you get the following advantages:
They’re faster and cleaner than CGI scripts.
They use a standard API (the Servlet API)
They provide all the advantages of Java (run on a variety of servers without
needing to be rewritten)

There are many features of servlets that make them easy and attractive to

Easily configured using the GUI-based Admin Tool.

use. These include:

Can be loaded and invoked from a local disk or remotely across the network.

Can be linked together, or chained, so that one servlet can call another servlets, or several servlets in

Can be called dynamically from within HTML pages, using server-side include tags

To invoke a servlet you call it by creating a URL with “/servlet/” pretended to the servlet name.
Then enter this URL in your favorite browser to see the output of the Servlet.
After installing according to the directions above, access the HelloServlet by entering the following
URL in your favorite browser:


The Java Server servlet architecture is very flexible and the server takes advantage of this
by dividing up its work among several internal servlets. These are
File Servlet
Invoker Servlet
Server side include servlet
Admin Servlet
CGI Servlet
Image map servlet


The file servlet provides the standard document serving capabilities of java server. This servlet
includes a caching mechanism to speed up response times of frequently accesses files. In addition it
recognizes files that are to be parsed for server side includes and passes them on to the SSInclude Servlet.
Servlets are an effective substitute for CGI scripts and provide a faster and cleaner way to
generate dynamic documents.
The java server is both flexible and extensible. Using the java serer APIs you can write your own
servlet and incorporate it into the server. To do this follows these three steps
1. Write the servlet
2. Configure the servlet
3. Invoke the servlet
Unless they are used with the http protocol, servlets subclass the servlet. GenericServlet class and
override the service (ServletRequest, ServletResonse) method.
Servlets use with the HTTP protocol should subclass the javax.servlet.HttpServlet class override
one or both of the doGet (HttpServletRequest, HttpServletResonse) and
doPost (HttpServletRequest, HttpServletResonse) methods

Servlets class may choose to override the default implementations of the servlet
“lifecycle” servlet methods, init (ServletConfig) and destroy ().
The real beauty of the java server is that it is extensible. But, before you can use a Servlet to add
an extended functionality to the JavaServer.You have to use the Java Server administration applet to
install the Servlet and specify the default parameters and arguments.
Display the Administration Applet by connecting to:
Are secure-even when downloading across the network, the servlets security model and the Servlet
sandbox to protect your system from unfriendly behavior.
One of the great advantages of the Servlet API is protocol independence. It assumes nothing
The protocol being used to transmit on the net.

How it is loaded.
The server environment it will be running in.

These qualities are important, because it allows the Servlet API to be embedded in many
different kinds of Servers. There are other advantages to the servlet API as well.

The Java Server provides several important Servlet features. These include:
Loading & Invoking Servlets.
Servlets can be loaded both locally and remotely.
Filters and Servlets change.
The Java Server uses MIME types to call Servlets sequentially.
Server size includes:
Servlets can be invoked from dynamic HTML documents using Server side include tags.

Java server Pages is a simple, yet powerful technology for creating and maintaining dynamiccontent web pages. Based on the Java programming language, Java Server Pages offers
proven portability, open standards, and a mature re-usable component model .The Java
Server Pages architecture enables the separation of content generation from content
presentation. This separation not eases maintenance headaches; it also allows web team
members to focus on their areas of expertise. Now, web page designer can concentrate on
layout, and web application designers on programming, with minimal concern about
impacting each other’s work.

Features of JSP:

Java Server Pages files can be run on any web server or web-enabled application server that
provides support for them. Dubbed the JSP engine, this support involves recognition,
translation, and management of the Java Server Page lifecycle and its interaction
Components :
It was mentioned earlier that the Java Server Pages architecture can include reusable Java
components. The architecture also allows for the embedding of a scripting language directly
into the Java Server Pages file. The components current supported include Java Beans, and
A Java Server Pages file is essentially an HTML document with JSP scripting or tags. The
Java Server Pages file has a JSP extension to the server as a Java Server Pages file. Before
the page is served, the Java Server Pages syntax is parsed and processed into a Servlet on the
server side. The Servlet that is generated outputs real content in straight HTML for
responding to the client.
Access Models:
A Java Server Pages file may be accessed in at least two different ways. A client’s request
comes directly into a Java Server Page. In this scenario, suppose the page accesses reusable
Java Bean components that perform particular well-defined computations like accessing a
database. The result of the Beans computations, called result sets is stored within the Bean as
properties. The page uses such Beans to generate dynamic content and present it back to the
In both of the above cases, the page could also contain any valid Java code. Java Server
Pages architecture encourages separation of content from presentation.

Steps in the execution of a JSP Application:
1. The client sends a request to the web server for a JSP file by giving the name of the JSP
file within the form tag of a HTML page.
2. This request is transferred to the JavaWebServer. At the server side JavaWebServer receives the
request and if it is a request for a jsp file server gives this request to the JSP engine.


JSP engine is program which can under stands the tags of the jsp and then it converts
those tags into a Servlet program and it is stored at the server side. This Servlet is loaded
in the memory and then it is executed and the result is given back to the JavaWebServer
and then it is transferred back to the result is given back to the JavaWebServer and then it
is transferred back to the client.


JDBC (Java Database connectivity) is a front-end tool for connecting to a server to
ODBC in that respect, however JDBC can connect only java client and it uses ODBC for the
connectivity. JDBC is essentially a low-level API since any data manipulation, storage and
retrieval has to be done by the program itself. Some tools, which provide a higher-level
abstraction, are expected shortly.
The next question that needs to be answered is why we need JDBC, once we have ODBC on
hand. We can use the same ODBC to connect the entire database and ODBC is a proven technology.
Problem for doing this is ODBC gives a ‘c’ language API, which uses pointers extensively. Since
java does not have any pointes and is object-oriented sun Microsystems, inventor of java developed to
suit its needs.
To use JDBC you need a basic knowledge of databases and SQL.A part from this you need the
jdk1.1 (Java Development Kit1.1 available javasoft’s website) or a version of Java since jdk1.1 and above
come bundled with JDBC software.

After that you need to have a back-end database engine for which a JDBC driver is
available. When JDBC drivers are not available JDBC-ODBC bridge drivers are used to access
the database through ODBC.Back-end is not needed when JDBC driver is capable of storing and
retrieving the data itself, or if JDBC-ODBC Bridge and the ODBC driver can be used to store
and retrieve the information.

JDBC and accessing the database through applets and JDBC.API via an intermediate server
resulted server resulted in a new type of database model which is different from the client-server model.
Based on number of intermediate server through the request should go it is named as single tire, two tire
and multi tire architecture
In a single tier the server and client are the same in the sense that a client program that needs
information (client) and the source of this type of architecture is also possible in java, in case flat files are
used to store the data. However this is useful only in case of small applications. The advantage with this is
the simplicity and portability of the application developed.

In two architecture the database resides in one machine the network. In this type of architecture a
database management takes control of the database and provides access to clients in a network. This
software bundle is also called as the server. Software in different machines, requesting for information are
called as the clients.


In the three-tier architecture, any number servers can access the database that resides on
server. Which in turn serve clients in a network. For example, you want to access the database
using java applets, the applet running in some other machine, can send request only to the server
from which it is down loaded. For this reason we will need to have a intermediate server which
will accept the requests from applets and them to the actual database server. This intermediate
server acts as a two-way communication channel also. This is the information or data from the
database is passed on to the applet that is requesting it. This can be extended to make n tiers of
servers, each server carrying to specific type of request from clients, however in practice only 3
tiers architecture is popular.

The JDBC drivers that we are aware of at this time fit into one of four categories

The java soft bridge product provides JDBC access via ODBC drivers. Note that ODBC
binary code end in many cases database client code must be loaded on each client machine that
uses this driver. As a result, this kind of driver is most appropriate on a corporate network where
client installations are not major problem, or for application server code written in java in a 3-tier


This kind of driver converts JDBC calls into calls on the client API for oracle Sybase,
Informix, DB2, or other DBMS. Note that, like the bridge driver, this style of driver requires that
some binary code be loaded on each client machine.


This driver translates JDBC calls into a DBMS independent net protocol, which is then
translated, to a DBMS protocol by a server. This net server middle-ware is able to connect its all
java clients to many different databases. The Specific protocol used depends on the vendor. In
general, this most flexible JDBC alternative. It is likely that all vendors of this solution will
provide products suitable for intranet use. In order for these products to also support Internet
access, they must handle the additional requirements for security, access through firewalls, etc
that the web imposes. Several vendors are adding JDBC drivers to their existing database
middleware products.


This kind of driver converts JDBC calls into the network protocol used by DBMS
directory. This allows a direct call from the client machine to the DBMS server that is practical
solution for intranet access. Since many of these protocols are proprietary, the database vendors
themselves will be the primary source. Several database vendors have these in progress.
Eventually, we expect that driver categories 3 and 4 will be the preferred way to access databases
from JDBC.Driver categories one and two are interim solutions where direct all java drivers are
not yet available. Category 4 is in some sense the ideal; however, there are many cases where
category 3 may be preferable: eg: -where a thin DBMS-independent client is desired, or if a
DBMS –independent protocol is standardized and implemented directly by many DBMS

Oracle is a relational database management system, which organizes data in the form of tables.
Oracle is one of many databases servers based on RDBMS model, which manages a seer of data that
attends three specific things-data structures, data integrity and data manipulation. With oracle cooperative
server technology we can realize the benefits of open, relational systems for all the applications. Oracle
makes efficient use of all systems resources, on all hardware architecture; to deliver unmatched
performance, price performance and scaleability.Any DBMS to be called as RDBMS has to satisfy
Dr.E.F.Codd’s rules.


The Oracle RDBMS is available on wide range of platforms ranging from PCs to super
computers and as a multi user loadable module for Novel NetWare, if you develop
application on system you can run the same application on other systems without any


Oracle commands can be used for communicating with IBM DB2 mainframe RDBMS
that is different from Oracle , that is Oracle compatible with DB2 .Oracle RDBMS is a high
performance fault

tolerant DBMS , which is specially designed for online transaction

processing and for handling large database applications.


Oracle adaptable multithreaded server architecture delivers scalable high performance for
very large number of users on all hardware architecture including symmetric multiprocessors
(sumps) and loosely coupled multiprocessors. Performance is achieved by eliminating CPU,
I/O, memory and operating system bottlenecks and by optimizing the Oracle DBMS server
code to eliminate all internal bottlenecks.

Most popular RDBMS in the market because of its ease of use

Client/server architecture.

Data independence.

Ensuring data integrity and data security.

Managing data concurrency.

Parallel processing support for speed up data entry and online transaction processing used for

DB procedures, functions and packages.

These rules are used for valuating a product to be called as relational database management
systems. Out of 12 rules, a RDBMS product should satisfy at least 8 rules +rule called rule 0 that
must be satisfied.
For any system that is to be advertised as ,or claimed to be relational DBMS.That system should
manage database with in self, with out using an external language.

All information in relational database is represented at logical level in only one way as values in
Each and every data in a relational database is guaranteed to be logically accessibility by using to
a combination of table name, primary key value and column name
Null values are supported for representing missing information and inapplicable information.
They must be handled in systematic way, independent of data types.
The database description is represented at the logical level in the same way as ordinary data so
that authorized users can apply the same relational language to its interrogation as they do to the
regular data.

A relational system may support several languages and various models of terminal use. However
there must be one language whose statement can express all of the following:
Data Definitions, View Definitions, Data Manipulations, Integrity, Constraints, Authorization and
transaction boundaries.
Any view that is theoretically that updatable if changes can be made to the tables that effect the
desired changes in the view.
The capability of handling a base relational or derived relational as a single operand applies not
only retrieval of data also to its insertion, updating, and deletion.
Application program and terminal activities remain logically unimpaired whenever any changes
are made in either storage representation or access method.
Application programs and terminal activities remain logically unimpaired whenever any changes
are made in either storage repres3entation or access methods.
Integrity constraints specific to particular database must be definable in the relational data stored
in the catalog, not in application program.
Weather or not a system support data base distribution, it must have a data sub-language that can
support distributed databases without changing the application program.
If a relational system has low level language, that low language cannot use
to subversion or by pass the integrity rules and constraints expressed in the
higher level relational language.
 Rule 1: Information Rule (Representation of information)-YES.
 Rule 2: Guaranteed Access-YES.
 Rule 3: Systematic treatment of Null values-YES.

 Rule 4: Dynamic on-line catalog-based Relational Model-YES.
 Rule 5: Comprehensive data sub language-YES.
 Rule 6: View Updating-PARTIAL.
 Rule 7: High-level Update, Insert and Delete-YES.
 Rule 8: Physical data Independence-PARTIAL.
 Rule 9: Logical data Independence-PARTIAL.
 Rule 10: Integrity Independence-PARTIAL.
 Rule 11: Distributed Independence-YES.
 Rule 12: Non-subversion-YES.

It is a process of planning the new or modified system. Analysis specifies what a new or
modified system does. Design specifies how to accomplish the same. Design is essentially a
bridge between requirements specification and the final solution satisfying the requirements.
The design of a system is essentially a blue print or a plan for a solution for the system.
The Design process for software systems has two levels. At the first level the focus is on
depending which modules are needed for the system, the specifications of the of these
modules and how the modules should be interconnected. This is what is called system design
or top-level design. In the second level, the internal design of the modules, or how the
specifications of the module can be satisfied is described upon. This design level is often
called detailed design or logic design. The First level produces the system design, which
defines the components needed for the system, how the components interact with each other.
It focus is on depending which modules are needed for the system, the specifications of these
modules and how the modules should be interconnected.

Use case diagram:

set parameters

start simulation

Division Head

simulation started by parameters

train status

Sequence diagram:
Division head


Train Status


1: view trains movement by map

2: can view current station info,direction,platform

3: can intialize trains count,speed,direction,min & max insertion time

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class CTS { //implements ActionListener, MouseListener
// variables
private CTSParameters ctsp;
private CTSScreen ctsScreen;
private CTSEngine ctsEngine;
private CTSStats stats;
* Constructor of this class.
public CTS() {
ctsp = new CTSParameters();
stats = new CTSStats(ctsp);
ctsScreen = new CTSScreen(ctsp,this,stats);
ctsEngine = new CTSEngine(ctsp,ctsScreen,stats);
* Starts the simulation.
public void start() {
* Restarts the simulation.
public void restart() {
* Pause the simulation.
public void pause() {
* Sets the station status to be true or false.
* @param st: The station number.
* @param status: The status.

public void setStationStatus(int st,boolean status) {
* The main method of this class.
* @param: The arguments.
public static void main(String args[]){
try {
CTS Obj = new CTS();
} catch(Exception e) {
} // end of main method.
} // end of class CTS.

import java.util.*;
import java.lang.Thread.*;
import java.awt.event.*;
import javax.swing.Timer;
public class CTSEngine implements ActionListener {
private int simSecs, prevSecs, countTrains, nextTrIns, totalTrains;
private long startTime;
private boolean trIns;
private Timer timer;
private ArrayList trains;
private Random rnd;
private Date date;
private CTSStation[] stations;
private int[][] pathLocks;
private int[][][] platLocks;
private int[][][] waitingQueue;
private int[][][] exitStatPos;
private CTSTrain[][][] map;
private ThreadGroup thrGroup;
private CTSScreen ctsScreen;
private CTSStats ctsStats;
private CTSParameters ctsp;
* Constructor
* @param ctsP: An object of class CTSParameters
* @param ctsScr: An object of class CTSScreen.It will be used for updating info on screens.
* @param sts: An object of class CTSStats. It will be used for updating stats.
public CTSEngine(CTSParameters ctsP,CTSScreen ctsScr, CTSStats sts) {

date = new Date();
rnd = new Random();
trains = new ArrayList();
ctsStats = sts;
ctsScreen = ctsScr;
trIns = false;
startTime = System.currentTimeMillis();
thrGroup = new ThreadGroup("Stations");
timer = new Timer(ctsp.DELAY,this);
stations = new CTSStation[4];
pathLocks = new int[2][6];
platLocks = new int[2][4][2];
waitingQueue = new int[2][4][2];
exitStatPos = new int[2][4][2];
map = new CTSTrain[2][3][370];
* Sets some extra action when we start the simulation.<br>
* e.g : updates the correct parameters in stats and screen objects.
public void start() {
// update arrays in stats obj according to parameters.
for(int i=0; i<stations.length; i++) {
* This is the main method of this class and this simulation.<br>
* Controls the cycles and define the main logic in this simulation.
synchronized private void simulate() {
CTSTrain train;
for(int i=0; i<trains.size(); i++) {
train = (CTSTrain)trains.get(i);
// if time to insert a train;
if(trIns && simSecs>=nextTrIns) {
boolean safeInsertion=false;
switch(ctsp.DIRECTION) {
case 0:
if((getPathLock((1-ctsp.DIRECTION),1)==0) &&
getSafeMove(ctsp.DIRECTION,0,-1)) {
case 1:

if((getPathLock((1-ctsp.DIRECTION),5)==0) &&
getSafeMove(ctsp.DIRECTION,0,-1)) {
// if it is safe to insert train, insert one.
if(safeInsertion) {
ctsScreen.updateScreens(trains, simSecs);
// update timer if changed.
* Inserts a new train on the map.
synchronized public void insertTrain() {
if(totalTrains <ctsp.NUM_OF_TRAINS) {
int rndDir=ctsp.DIRECTION;
int sYpos=0;
switch(rndDir) {
case 0: sYpos=137; break;
case 1: sYpos=427; break;
// add a new express train.
if(countTrains == 4){
CTSTrain train = new CTSTrain("images/expTr.gif",'x',rndDir, trains.size(),
this,stations,50, sYpos);
map[0][0][0] = train;
countTrains = 0;
} else {
CTSTrain train = new CTSTrain("images/T"+
(rnd.nextInt(6)+1)+".gif",'n',rndDir, trains.size(), this,stations,50, sYpos);
map[0][0][0] = train;
* Sets correctly the arrays when we start the application.
private void setArrays() {
stations[0] = new CTSStation(this,ctsStats,thrGroup,"Station-A",0);
stations[1] = new CTSStation(this,ctsStats,thrGroup,"Station-B",1);
stations[2] = new CTSStation(this,ctsStats,thrGroup,"Station-C",2);
stations[3] = new CTSStation(this,ctsStats,thrGroup,"Station-D",3);

// set station exit point
* Keeps track of trains position in the map.
* @param train: The current train.
* @param odir: The old direction.
* @param ndir: The new direction.
* @param opos: The old position
* @param npos: The new position
* @param oloc: The old location
* @param nloc: The new location
synchronized public void setMapInfo(CTSTrain train, int odir,int ndir ,int opos, int npos, int oloc,int nloc)
map[odir][oloc][opos] = null;
map[ndir][nloc][npos] = train;
* Sets the total running time for this simulation.
synchronized public void setTime() {
Long l = new Long(System.currentTimeMillis() - startTime);
simSecs = (l.intValue() / 1000)+prevSecs;
if(!trIns) {
int min = ctsp.MIN_INSERTION_TIME;
int max = ctsp.MAX_INSERTION_TIME;
nextTrIns = simSecs+rnd.nextInt(max-min+1)+min;
* Sets the locks on the platforms.

* @param dir: The current direction.
* @param station: The station to set the lock.
* @param plat: The plat to set the lock.
* @param status: The action on those locks.
synchronized public void setPlatLock (int dir, int station, int plat, int status) {
platLocks[dir][station][plat] += status;
//System.out.println(" SetPlatLock: movDir/station/plat/status: "+dir+" / "+station+" / "+plat+" /
* Sets the locks on the paths.
* @param dir: The current direction.
* @param path: The path to set the lock.
* @param status: The action on those locks.
synchronized public void setPathLock(int dir,int path, int status) {
pathLocks[dir][path-1] += status;
* Sets the locks on the paths.
* @param action: The action on this timer.<br>
- case's': start timer <br>
- case'p': stop timer
synchronized public void setTimer(char action) {
switch (action) {
case 's':
startTime = System.currentTimeMillis();
timer = new Timer(ctsp.DELAY,this);
startTime = System.currentTimeMillis();
case 'p':
* Keeps track of waitingTimes on platforms for trains.
* @param moveDir: The current direction.
* @param station: The current station.
* @param plat:
The current plat.
* @param status: The action.
synchronized public void setQueue(int moveDir,int station, int plat, int status) {

waitingQueue[moveDir][station][plat] = status;
* Activate or deactivate stations.
* @param st: The current station.
* @param status: False to deactivate, true to activate.
synchronized public void setStationStatus(int st, boolean status) {
* Returns information about the queue of trains.
* @param moveDir: The current direction.
* @param station: The current station.
* @param plat:
The current plat.
* @return an integer specifying the number of cycles that the train in this position waits.
synchronized public int getQueue(int moveDir, int station, int plat) {
return waitingQueue[moveDir][station][plat];
* Returns information about locks on platforms.
* @param dir: The current direction.
* @param station: The current station.
* @param plat:
The current plat.
* @return an integer specifying the number of trains on that platform.
synchronized public int getPlatLock(int dir, int station, int plat) {
return platLocks[dir][station][plat];
* Returns information about locks on paths.
* @param dir: The current direction.
* @param path:
The current path.
* @return an integer specifying the number of trains on that path.
synchronized public int getPathLock(int dir,int path) {
return pathLocks[dir][path-1];
* Returns information about exit positions on the map.

* @param dir: The current direction.
* @param station: The current station.
* @param plat:
The current plat.
* @return an integer specifying the value of the exit position.
synchronized public int getExitPos(int dir, int station, int plat) {
return exitStatPos[dir][station][plat];
* Returns information about exit positions on the map.
* @param dir: The current direction.
* @param loc: The current location.
* @param pos:
The current position of the train.
* @return a boolean specifying true for safe move or false for unsafe move.
synchronized public boolean getSafeMove(int dir,int loc, int pos) {
if (map[dir][loc][pos+1] == null & map[dir][loc][pos+2] == null)
return true;
return false;
* Returns information about the total runing time of the simulation.
* @return an integer of the current seconds specifying the total simulation time.
synchronized public int getTime() {
return simSecs;
* Haddles actionevents thrown by the timer of this class.
public void actionPerformed(ActionEvent evt) {
String command = evt.getActionCommand();
if (command == null) {
} // end of class CTSEngine.

import java.util.*;

public class CTSStation extends Thread {
private int stationNo, curTrP0, curTrP1, sleepTime,test;
private CTSEngine ctsEngine;
private CTSStats stats;
private boolean active;
* Constructor
* @param ctsEng: The engine of this application
* @param st An object of class CTSStats. It will be used for updating stats.
* @param thGroup The group of this thread object.
* @param name The name of this Object.
* @param stNo The number of this station.
public CTSStation(CTSEngine ctsEng, CTSStats st, ThreadGroup thGroup, String name, int stNo) {
super(thGroup, name);
ctsEngine = ctsEng;
* Sets the status of this station to be active or disabled.
* @param status True to activate station, false to deactivate.
public synchronized void setStatus(boolean status) {
* Sets the actions related to a train arrival.
* @param plat The current plat.
* @param train The current train.
public synchronized void setArrival(int plat, CTSTrain train) {
switch(plat) {
case 0:
case 1:
/* update stats on CTSStats */
// 1: stationStats.
if(train.getType() == 'x') {

* Sets the actions related to a train departure.
* @param plat The current plat.
* @param train The current train.
public synchronized void setDeparture(int plat, CTSTrain train) {
switch(plat) {
case 0:
case 1:
/* update stats on CTSStats */
* Sets the actions related to a train departure.
* @return a boolean indicating the status of this station.
public synchronized boolean getStatus() {
return active;
} // end of class Station.



Testing is the process of detecting errors. Testing performs a very critical role for quality
assurance and for ensuring the reliability of software. The results of testing are used later on
during maintenance also.
The aim of testing is often to demonstrate that a program works by showing that it has no
errors. The basic purpose of testing phase is to detect the errors that may be present in the
program. Hence one should not start testing with the intent of showing that a program works, but
the intent should be to show that a program doesn’t work. Testing is the process of executing a
program with the intent of finding errors.
Testing Objectives

The main objective of testing is to uncover a host of errors, systematically and with
minimum effort and time. Stating formally, we can say,

Testing is a process of executing a program with the intent of finding an error.

A successful test is one that uncovers an as yet undiscovered error.

A good test case is one that has a high probability of finding error, if it exists.

The tests are inadequate to detect possibly present errors.

Levels of Testing
In order to uncover the errors present in different phases we have the concept of levels of
testing. The basic levels of testing are as shown below…

Client Needs




System Testing

Integration Testing

Unit Testing


A strategy for software testing integrates software test case design methods into a wellplanned series of steps that result in the successful construction of software.
Unit Testing
Unit testing focuses verification effort on the smallest unit of software i.e. the module.
Using the detailed design and the process specifications testing is done to uncover errors within
the boundary of the module. All modules must be successful in the unit test before the start of the
integration testing begins.

White Box Testing
White Box Testing mainly focuses on the internal performance of the product. Here a
part will be taken at a time and tested thoroughly at a statement level to find the maximum
possible errors. Also construct a loop in such a way that the part will be tested with in a range.
That means the part is execute at its boundary values and within bounds for the purpose of

Black Box Testing
This testing method considers a module as a single unit and checks the unit at interface
and communication with other modules rather getting into details at statement level. Here the
module will be treated as a block box that will take some input and generate output. Output for a
given set of input combinations are forwarded to other modules.

Integration Testing

After the unit testing we have to perform integration testing. The goal here is to see if
modules can be integrated properly or not. This testing activity can be considered as testing the
design and hence the emphasis on testing module interactions. It also helps to uncover a set of
errors associated with interfacing. Here the input to these modules will be the unit tested
Integration testing is classifies in two types…
1. Top-Down Integration Testing.
2. Bottom-Up Integration Testing.
In Top-Down Integration Testing modules are integrated by moving downward through
the control hierarchy, beginning with the main control module.
In Bottom-Up Integration Testing each sub module is tested separately and then the full
system is tested.

System Testing
Project testing is an important phase without which the system can’t be released to the
end users. It is aimed at ensuring that all the processes are according to the specification
Alpha Testing
This refers to the system testing that is carried out by the test team with the organization.

Beta Testing
This refers to the system testing that is performed by a select group of friendly customers.

Acceptance Testing

Acceptance Test is performed with realistic data of the client to demonstrate that the
software is working satisfactorily. Testing here is focused on external behavior of the system; the
internal logic of program is not emphasized.


We have presented an approach to optimally reschedule trains on a railway network based
on a permutation method.We have modeled the system based on the switching max-plus
framework and showed how the control problem can be recast as a mixed-integer linear
programming problem. Compared to previous results we have extended the control actions to
change the departure and arrival order of non-subsequent trains. For a simple railway network
we have shown that by optimally rescheduling trains using the proposed approach delays can be
substantially reduced. Further research will concentrate on reducing the complexity of the
mixed-integer linear programming problem by considering only a reduced number of relevant
decision variables based for example on the delay propagation algorithm proposed in (Goverde,

Baccelli, F., Cohen, G., Olsder, G., and Quadrat, J. (1992). Synchronization and Linearity: An
Algebra for Discrete
Event Systems. Wiley.
Goverde, R.M.P. (2007). Railway timetable stability analysis using max-plus system theory.
Transportation Research Part B, 41(2), 179–201.
Goverde, R. (2010). A delay propagation algorithm for large-scale railway traffic networks.
Transportation Research Part C: Emerging Technologies, 18(3), 269–287. Heidergott, B. and de
Vries, R. (2001). Towards a (max,+) control theory for public transportation networks. Discrete

Event Systems: Theory and Applications, 11(4), 371–398. van den Boom, T. and De Schutter, B.
(2006). Modelling and control of discrete event systems using switching max-plus-linear
systems. Control Engineering Practice, 14(10), 1199–1211.