-
Notifications
You must be signed in to change notification settings - Fork 0
shobe98/cs382_cpp
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Andrei Stanciu
Abigail Ren
CMPU 382 - Description
Abigail: I would permit our code to be included in a public repository.
To run morris2006, type the following into the command line:
1. make main
2. ./main --verbose={true/false} testfile [testfiles...]
i.e. ./main --verbose=false tests/dc-2.stnu
For morris2014
1. make morris2014
2. ./morris2014 --verbose=false tests/magic-loop-2.stnu tests/magic-loop-3.stnu tests/dc-2.stnu tests/dc-3.stnu
Sample output:
tests/magic-loop-2.stnu Morris 2014: 0
tests/magic-loop-3.stnu Morris 2014: 0
tests/dc-2.stnu Morris 2014: 1
tests/dc-3.stnu Morris 2014: 1
Our code implementing the Morris 2006 algorithm is made up of five parts:
graph.h, graph.cpp, algos.h, algos.cpp, and main.cpp.
In graph.h, we defined the structures and objects used by the algorithm
to store data, with implementations of OrdEdges and CaseEdges, and
the definition of the STNU class, where we implemented the vectors and
matrices where we store these edges. The file graph.cpp defines
the functions in the STNU class that are used to add edges to the vectors
and matrix after parsing and creating new edges during the algorithm.
In algos.h, the file graph.h is included so we can access the data
structures defined, and we declare the functions for bellman_ford
and is_dynamically_controllable. In algos.cpp, we define the above
functions and add an implementation of dijkstra. The function
is_dynamically_controllable calls bellman_ford and dijkstra to check if
the STNU given is dynamically controllable. Finally, in main.cpp, we
include algos.h and define the function parse that reads the input data
files and stores the data in the data structures we defined in graph.h.
The main function then creates an empty STNU, calls the parse function,
and then calls is_dynamically_controllable to determine if the STNU is
dynamically controllable, returning "DC" if true, and
"Negative cycle found!" if not.
Log
------------------------------
4-9
Abigail: Worked on refactoring STNU class for the 2014 algorithm
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published