cudd  3.0.0
The University of Colorado Decision Diagram Package
Macros | Functions | Variables
main.c File Reference

Main program for the nanotrav program. More...

#include "cuddInt.h"
#include "ntr.h"
Include dependency graph for main.c:

Macros

#define NTR_VERSION   "Nanotrav Version #0.13, Release date 2015/7/15"
 
#define BUFLENGTH   8192
 

Functions

int main (int argc, char **argv)
 Main program for ntr. More...
 
static NtrOptionsmainInit ()
 Allocates the option structure and initializes it. More...
 
static void ntrReadOptions (int argc, char **argv, NtrOptions *option)
 Reads the command line options. More...
 
static void ntrReadOptionsFile (char *name, char ***argv, int *argc)
 Reads the program options from a file. More...
 
static char * readLine (FILE *fp)
 Reads a line from the option file. More...
 
static FILE * open_file (char *filename, const char *mode)
 Opens a file. More...
 
static int reorder (BnetNetwork *net, DdManager *dd, NtrOptions *option)
 Explicitly applies reordering to the DDs. More...
 
static void freeOption (NtrOptions *option)
 Frees the option structure and its appendages. More...
 
static DdManagerstartCudd (NtrOptions *option, int nvars)
 Starts the CUDD manager with the desired options. More...
 
static int ntrReadTree (DdManager *dd, char *treefile, int nvars)
 Reads the variable group tree from a file. More...
 

Variables

static char buffer [8192]
 

Detailed Description

Main program for the nanotrav program.

Author
Fabio Somenzi

Function Documentation

◆ freeOption()

static void freeOption ( NtrOptions option)
static

Frees the option structure and its appendages.

Side effects None

◆ main()

int main ( int  argc,
char **  argv 
)

Main program for ntr.

Performs initialization. Reads command line options and network(s). Builds BDDs with reordering, and optionally does reachability analysis. Prints stats.

Side effects None

◆ mainInit()

static NtrOptions* mainInit ( )
static

Allocates the option structure and initializes it.

Side effects none
See also
ntrReadOptions

◆ ntrReadOptions()

static void ntrReadOptions ( int  argc,
char **  argv,
NtrOptions option 
)
static

Reads the command line options.

Scans the command line one argument at a time and performs a switch on each arguement it hits. Some arguemnts also read in the following arg from the list (i.e., -f also gets the filename which should folow.) Gives a usage message and exits if any unrecognized args are found.

Side effects May initialize the random number generator.
See also
mainInit ntrReadOptionsFile

◆ ntrReadOptionsFile()

static void ntrReadOptionsFile ( char *  name,
char ***  argv,
int *  argc 
)
static

Reads the program options from a file.

Opens file. Reads the command line from the otpions file using the read_line func. Scans the line looking for spaces, each space is a searator and demarks a new option. When a space is found, it is changed to a \0 to terminate that string; then the next value of slot points to the next non-space character. There is a limit of 1024 options. Should produce an error (presently doesn't) on overrun of options, but this is very unlikely to happen.

Side effects none

◆ ntrReadTree()

static int ntrReadTree ( DdManager dd,
char *  treefile,
int  nvars 
)
static

Reads the variable group tree from a file.

Returns
1 if successful; 0 otherwise.
Side effects None

◆ open_file()

static FILE* open_file ( char *  filename,
const char *  mode 
)
static

Opens a file.

Opens a file, or fails with an error message and exits. Allows '-' as a synonym for standard input.

Side effects None

◆ readLine()

static char* readLine ( FILE *  fp)
static

Reads a line from the option file.

Side effects none

◆ reorder()

static int reorder ( BnetNetwork net,
DdManager dd,
NtrOptions option 
)
static

Explicitly applies reordering to the DDs.

Returns
1 if successful; 0 otherwise.
Side effects None

◆ startCudd()

static DdManager* startCudd ( NtrOptions option,
int  nvars 
)
static

Starts the CUDD manager with the desired options.

Starts with 0 variables, because Ntr_buildDDs will create new variables rather than using whatever already exists.

Side effects None