BNS is a SAT-based program for searching for cycles of states (attractors) in Boolean Networks with Synchronous update (https://people.kth.se/~dubrova/bns.html).

Folder structure of the bns package:
====================================
Pre-compiled executables	- If you only need an executable to run bns, here you find pre-compiled executables for Windows, Mac and Linux(Ubuntu). 
							  This folder and may be examples is all what you need. Other folders are for those who whant to compile bns.
examples					- Contains examples of bns networks.
src							- Source code of BNS.
MiniSat_v1.14				- Source code of SAT solver used in BNS.
MS Visual Studio project	- For those who want to compile BNS in Windows using Visual Studio.

Prerequisites to compile bns:
============================
-C++ compiler.
-MiniSat (http://minisat.se/MiniSat.html), the latest tested version is MiniSat_v1.14 (http://minisat.se/downloads/MiniSat_v1.14.2006-Aug-29.src.zip). For your convenience we include the source of code of Minisat in ./MiniSat_v1.14 folder.
-Source code of BNS. It is located in ./src folder of this package.

How to compile in POSIX enviroment (Linux, Mac OS, Cygwin for Windows):
=======================================================================
1) First you should have a compiled version of MiniSAT. To do so 
	cd ./MiniSat_v1.14/
	make

2) Compile BNS assuming MiniSAT is in ./MiniSat_v1.14/ folder and g++ is installed C++ compiler. To do so 
	cd ./src
        g++ ../MiniSat_v1.14/Solver.o -I../MiniSat_v1.14 bns.c -o bns
		
After successful compilation executable bns will be located in ./src folder.

How to compile in Windows using Visual Studio:
==============================================
If you have Visual Studio installed on your PC you can simply double click on 
provided .\MS Visual Studio\bns13\bns13.vcxproj file and preconfigured project would load to Visual Studio.
To compile press F7 and executable bns.exe will be created in Debug or Release folder. 
If you need faster performance use Release version. 
		
		
		
Test the programm
=================
To test provided pre-compiled versions or your own compilation, try one of the provided examples, e.g. assuming bns executable is in root folder.
Linux,Mac:
 	./bns ../examples/arabidopsis.cnet
Windows:
	bns.exe ..\examples\arabidopsis.cnet

The correct output should look like:

Start searching for all atractors.
001100110111011
Attractor number:1 The size of atractor:1
000110110011001
Attractor number:2 The size of atractor:1 
000001000011100
Attractor number:3 The size of atractor:1
000001001011100
Attractor number:4 The size of atractor:1
010001000011100
Attractor number:5 The size of atractor:1
010001001011100
Attractor number:6 The size of atractor:1
100110110011011
Attractor number:7 The size of atractor:1
101100110111011
Attractor number:8 The size of atractor:1
110110110011011
Attractor number:9 The size of atractor:1
111100110111011
Attractor number:10 The size of atractor:1
10 attractors of average length 1.00

Run options:
===========
 Usage: bns [-l N|-u N] file 

 -l N     restricts the search for atractors of lenght N and its factors.   
          For example "bns -l 6" searches only for atractors of           
          length 6 and its factors 3,2, and 1. Atractors of length 4,5 and  
          any other of length larger than 6 will not be found.              
          Limiting the search space might drastically reduce runtime and can
          be an option to try when unrestricted search does not finish.     
 -u N     set initial unfolding of transition relation to N levels instead  
          of the default value which is equal to number of variables in     
          Boolean network. This option does not impact the result but might 
          increase or reduce total runtime. It is should not be used        
          together with -l option.                                          
 file     the file name describing Boolean network for which atractors are  
          searched for.

For example to find all atractors of lengthes 15, 5, 3 and 1:
./bns -l 15 ../examples/arabidopsis.cnet



