jack wrote:
Hi guys,
I am working on a project which requires an implementation of discrete
event simulation in C using linked lists. I would greatly appreciate if
someone could provide with some sources on how to approach DES. Please
help me out.
You don't have a C question (yet -- once you start on
the implementation, you may have C questions), but a question
about algorithms and/or data structures.
<off-topic>
The fundamental form of a discrete-event simulation is that
there's a queue of events scheduled for various times in the
simulated future. You remove the earliest of those events from
the queue, advance the global "clock" to the scheduled time
of that event, and do whatever event-specific processing the
event requires. This processing may add new events to the
queue (scheduled for times no earlier than the clock, of
course), may cancel scheduled events that have not yet happened,
and may change the scheduled time of some future events (which
can be regarded as a cancellation plus adding a new event, if
that's convenient). The event processing also modifies the
state of the simulated system in whatever ways are appropriate,
and may even cause the simulation to terminate.
So: The central data structure for the simulation framework
is a priority queue, ordered by the events' scheduled times.
Other data structures are usually problem-specific, keeping
track of the automobiles or mesons or whatever knick-knacks
circulate in the simulated system. There are *many* data
structures that implement such things; you need to choose a
few and then (if puzzled) come back here with the problems
you've encountered in writing the code for them.
(In my brief and inglorious career as "Lecturer in
Mathematics," I used to teach this stuff. At the time, it
went for 0.5 semester-hours' credit; nowadays, I understand
that merely learning a programming language or learning how
to operate a spreadsheet earns more. O tempora! O mores!)
</off-topic>
--
Eric Sosman
es*****@acm-dot-org.invalid