December 14, 2016

Overview

  • Softball Manager's Problem
    Project 8.5 (Modeling Using Graph Theory) pg.338

  • A Harbor System
    Project 5.5 (Simulation Modeling) pg. 222

Softball Manager's Problem

  • A manager has a team of 15 players from which he has to pick a starting team, which consists of 11 players.

Table 1:Positions Players can play

Problem

  • Express the softball manager's problem as a linear or interger program, and solve it with computer software.

Solution

  • Express the softball manager's problem as a maximum flow problem.

  • Define Flow Varaiables

\[sh, sn, sm, sl, sk, sj, si, sh, sg, sf, se, sd, sc, sb, sa, etc.\]

  • Capacity Constraints

\[sp <= 1; sn <= 1; sm <= 1; sl<= 1; sk <= 1; etc. \]

  • Objective Function

The objective is to maximize the flow from the source node s to sink node t.

The objective function of the Linear Program is the total flow (over the artificial feedback link)

\[ max: sp + sn + sm + sl + sk + sj + si + sh + sg + sf + se + sd + sc + sb + sa \]

  • Define lpSolve Input File

  • Solve using lpSolve
# read in lpSolve Input file
graph <- read.lp("softballproblem.txt",type = "lp")

Now we can solve the model and retrieve some results.

solve(graph)
## [1] 0

A return value of 0 indicates that the model was successfully solved.

# Get the value of the objective function
get.objective(graph)
## [1] 7

Result

The softball manager's problem has a maximum flow of 7 . A maximum flow of 7 means the manager would not fill the 11 spots requred to form his team. Therefore there is no feasible solution to this problem.

A Harbor System

Consider a small harbor with unloading facilities for ships. Only one ship can be unloaded at any one time. Ships arrive for unloading of cargo at the harbor, and the time between the arrival of successive ships varies from 15 to 145 min. The unloading time required for a ship depends on the type and amount of cargo and varies from 45 to 90 min. We seek answers to the following questions:

  1. What are the average and maximum times per ship in the harbor?

  2. If the waiting time for a ship is the time between its arrival and the start of unloading, what are the average and maximum waiting times per ship?

  3. What percentage of the time are the unloading facilities idle?

  4. What is the length of the longest queue?

Problem

Write a computer simulation to implement the ship harbor algorithm.

Algorithm

Implementation

Average time per ship in the harbor

hartime/5
## [1] 17.6

Average waiting time per ship before unloading

waitTime/5
## [1] 0

Percentage of total simulation time unloading facilities are idle

idletime / fin[5]
## [1] 0.4205426

Thank You