Christos M Delivorias

Archive for the ‘Java’ Category

Multicommodity network flow in Java

In Java, OR on 27 December, 2011 at 12:50 am

Problem Statement

In a previous post I presented an approach to solve the shortest path problem using different implementations of algorithms. The shortest path problem is a classic and important combinatorial optimisation problem. It often appears as a subproblem when solving difficult combinatorial problems like the multicommodity network flow (MCNF) problems.

The problem is to route a set of demands (commodities) through a network1 with limited arc capacities. The inherent assumption with the following implementation is that the commodities can be shipped in fractions, hence are divisible. Read the rest of this entry »

Discrete-time bank queue simulation in JAVA

In Προγραμματισμος, Java on 6 February, 2011 at 4:48 pm

As part of the MSc course I’m currently undertaking, there’s a great need to understand optimality of processes and operations. One of them is the problem of queues while serving customers. The following is my submission for the assignment of the Simulation (MATH110281) course.

The deliverable of this course was to simulate a simple bank queue with three scenarios. The first scenario was single server (employee serving customers) and an exponential random time of arrival and an Erland random number of completion. Both these numbers were derived from Java’s Random class. The myRandom class, included in the public Git repository2, and it was created by my lecturer Andreas Grothey. It is basically an implementation of generating an erlang variate Erl(λ, μ) and en exponential one Exp(μ), from a uniformly distributed Gaussian distribution3.

For this assignment, different scenarios for managing a bank queue were requested from the bank manager. The first scenario involved a queue with single server with an exponential distribution for arrival. The average of customers arriving was 19 per hour. The completion times were given by an Erlang distribution. The number of customers served per hour were 20. The day in all simulations was taken to last 8 work-hours. The result of this scenario was that out of 164 arrivals, all customers were served with 85.4% (140 customers) having waited more than 6 minutes in the queue.

The second scenario  involved extending the queue to multiple servers.  An ArrayList was used to keep track of servers’ status and time of completion.  This scenario produced non optimal results, since there ware 22.8% of customers waiting more than 6 minutes. The maximum queue for this scenario was 17 customers.

The third and final scenario was to implement different average numbers of customers for each of the 8 hours in the work day. The additional decision was to implement a strategy of opening and closing server positions when demand increases.  The demand criterion was selected to be the length of the queue at any given time. There were different scenarios to try out, but the sole setting that met the constraint was when the queue did not exceed 6 customers.

Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.

Join 224 other followers