%===========================================================================%
%                                                                           %
% This file is part of the documentation for the SYMPHONY MILP Solver.      %
%                                                                           %
% SYMPHONY was jointly developed by Ted Ralphs (tkralphs@lehigh.edu) and    %
% Laci Ladanyi (ladanyi@us.ibm.com).                                        %
%                                                                           %
% (c) Copyright 2000-2008 Ted Ralphs. All Rights Reserved.                  %
%                                                                           %
% SYMPHONY is licensed under the Common Public License. Please see          %
% accompanying file for terms.                                              %
%                                                                           %
%===========================================================================%

This chapter is concerned with detailed instructions for building and
installing SYMPHONY, along with its associated libraries and applications.

\section{Installing the Binary Distribution}

For the users who only need the generic MILP solver or the SYMPHONY callable
library to be used in their custom applications, there are binary
distributions released for different compilers and platforms. Each
distribution consists of an executable and libraries built from the source
code of SYMPHONY version \VER. It is important to note, however, that the
pre-compiled binaries are missing some very useful functionality because of
the fact that we are unable to distribute code linked to libraries licensed
under the GNU General Public License (GPL). There are also a number of other
potentially useful configurations (such as the parallel version) that we do not
distribute in binary form. Building from source should be easy in most
environments and will give you more flexibility. See
Section~\ref{building_from_source} for more information on additional
functionality available when building from source.
 
You can obtain the SYMPHONY binary distribution by visiting 
\begin{center}
 \url{https://www.coin-or.org/download/binary/SYMPHONY}
\end{center}
The binaries are currently available for Linux and Windows. These binaries are
built with the following default options:
\begin{itemize}
\item The associated LP solver is the COIN LP solver (CLP).
\item Cut generation is done with COIN's Cut Generation Library (CGL).
\item All libraries are compiled statically.
%\item Library linked with = CLP, CGL, COINUTILS, OSI, OSICLP, OSISYM, 
\item The optimization level for Linux binaries is ``O2''. 
\item Only serial executables are included.
\end{itemize} 

\subsection{Installation in Unix-like environments}
\label{building-unix}

\begin{itemize}
\item Unpack the distribution with
{\color{Brown}
\begin{verbatim}
 tar xzvf symphony-\VER-XXX-bin.tgz
\end{verbatim}
}
where \code{XXX} indicates the platform and the version of 
compiler used to build the distribution. 
Switch into the root directory of the unpacked distribution. 

\item First, test the executable by going to the \code{bin} directory and
typing 
{\color{Brown}
\begin{verbatim}
 ./symphony -F ../examples/sample.mps
\end{verbatim}
}
\item To test the callable library, the distribution
includes sample files in \code{examples} directory:  \\ \\
\code{milp.c}: This sample code is an implementation of a basic MILP
solver using SYMPHONY's C callable functions with user defined input (see
Section
\ref{callable_library}). To test the code, go to the \code{examples} directory 
and type 
{\color{Brown}
\begin{verbatim}
 make milp 
 milp
 \end{verbatim}}
\code{milpOsi.c}: This sample code is an implementation of a basic MILP 
solver using SYMPHONY's C++ callable functions (through OsiSym interface)
with user defined input (see Section \ref{OSI}). To test the code, 
go to \code{examples} directory and type, 
{\color{Brown}
\begin{verbatim}
 make milpOsi
 milpOsi
 \end{verbatim}}
\end{itemize}

If everything is working properly, the libraries, executables and header files
can be installed in appropriate system directories if desired. This must be
done by hand. This step will be done automatically if building from source
using the automatic scripts provided (see below).

\subsection{Installation for Use With Microsoft Visual C++}

These instructions are for use with Microsoft Visual Studio 8. The procedure
for other version of Visual Studio should be similar. Download and unpack the
archive \code{symphony-\VER-win32-msvc6.zip}
\begin{itemize}
\item First, test the executable by opening Windows Explorer and double-click
on {\color{Brown}\texttt{symphony.exe}} in the {\color{Brown}\texttt{bin}}
directory in the folder in which the distribution was unpacked. This should
open a Window in which the interactive solver will appear. Type \code{help}
or \code{?} to see a list of available commands or see Chapter
\ref{API-overview} for instructions on using the interactive solver.

\item To test the callable library, the distribution includes sample codes
along with associated project files in the \code{examples} directory. \\ \\
\code{milp.c}: This sample code is an implementation of a basic MILP
solver using SYMPHONY's C callable functions with user defined input (see
Section \ref{callable_library}). To test the code, either

\begin{itemize}
\item open the solution file \code{milp.sln}, choose \code{Build milp.exe}
and then choose \code{Execute} from the \code{Build} menu, 
\end{itemize}
or
\begin{itemize}
\item open a command terminal (choose \code{Run} on the Start menu and type
\code{cmd} in the dialogue box) and type 
{\color{Brown}
\begin{verbatim}
 devenv milp.sln /make "all - debug"
 Debug/milp.exe
 \end{verbatim}
}
\end{itemize}
\code{milpOsi.c}: This sample code is an implementation of a basic MILP 
solver using SYMPHONY's C++ callable functions (through OsiSym interface)
with user defined input (see Section \ref{OSI}). To test the code, either 
\begin{itemize}
\item open the solution file \code{milpOsi.sln}, 
choose \code{Build milpOsi.exe} and then 
\code{Execute} commands from the \code{Build} menu, 
\end{itemize}
or
\begin{itemize}
\item open a command terminal (choose \code{Run} on the Start menu and type
\code{cmd} in the dialogue box) and type 
{\color{Brown}
\begin{verbatim}
 devenv milpOsi.slb /make "all - debug"
 Debug/milpOsi.exe
 \end{verbatim}
}
\end{itemize}
\end{itemize}

% Applications????

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Building From Source} 
\label{building_from_source}

SYMPHONY can now use the COIN-OR build system and the GNU autotools to
automate the build process. The build process should therefore be identical in
all Unix-like environments. It is even possible to use this system to build
COIN in Windows using the Microsoft Visual C++ compiler if you have MinGW
(\url{http://www.mingw.org}) installed (you need the GNU \code{make} command).
The instructions below will lead you through the steps required to compile
SYMPHONY as a generic MILP solver. This process will create (1) a generic
callable library that allows SYMPHONY to be called from a C or C++ code and
(2) an executable that can be used as a stand-alone application to solve MILPs
written in either MPS or GMPL file format. SYMPHONY can be further customized
by implementing one of more than 50 callback functions that change SYMPHONY's
default behavior. For information on customizing SYMPHONY using callbacks, a
quick start guide is provided below. More detailed information is provided in
Chapter~\ref{SYMPHONY-development}.

\subsection{External Dependencies}

\subsubsection{The LP Engine} SYMPHONY requires the use of a third-party
  callable library to solve the LP relaxations once they are formulated. The
LP solver is called through Open Solver Interface, also available from
\htmladdnormallink{COIN}{https://projects.coin-or.org/Osi}
\begin{latexonly} 
(\texttt{https://projects.coin-or.org/Osi})
\end{latexonly}.
The list of solvers with OSI interfaces currently numbers eight and includes
both commercial and open source alternatives. By default, SYMPHONY now uses
the COIN LP solver (Clp). However, if another LP solver is desired, this is
possible by changing the configuration settings.

\subsubsection{GMPL Parser} If you would like to be able to parse GMPL models
(GMPL is a subset of AMPL), you will need to install GLPK
(\url{http://www.gnu.org/software/glpk/}). To do so automatically, run the
\texttt{get.Glpk} script in the \texttt{ThirdParty/Glpk} directory. After
that, Glpk should be built and linked automatically, enabling the ability to
read GMPL files.

\subsubsection{COIN Libraries} SYMPHONY uses other COIN libraries for certain
functionality, such as parsing MPS files, solving linear programs, generating
valid inequalities, and for general matrix utilities. The libraries required
for this functionality are now included with the distribution.

\subsubsection{GNU Libraries} If the \code{readline} and \code{history} libraries
are available, the interactive solver will have command history and command
completion available. This functionality is only available in Unix-like
environments by configuring with the \code{--enable-gnu-packages} option (see
below).

\subsection{Building in Unix-like environments}
\label{getting_started_unix}

\subsubsection{Downloading}

You can obtain the SYMPHONY source code either via the subversion repository
or in the form of archived releases. The recommended method in Unix is to use
subversion because it makes it easier to obtain updates. In a Unix-like
environment (such as Linux or CYGWIN), the following command may be used to
obtain SYMPHONY from source using SVN in most cases: {\color{Brown}
\begin{verbatim}
 svn checkout https://projects.coin-or.org/svn/SYMPHONY/stable/5.1 SYMPHONY-5.1
\end{verbatim}
}
Alternatively, you can get point releases of the source code as a compressed
file by visiting
\begin{center}
 \url{https://www.coin-or.org/download/source/SYMPHONY}
\end{center}
The latest version of the source code is \VER, so you should download the file
{\color{Brown}\texttt{SYMPHONY-\VER.tgz}} and unpack the distribution with 
{\color{Brown}
\begin{verbatim}
 tar -xzf SYMPHONY-5.1.10.tgz
\end{verbatim}
} 
This will create a subdirectory called \code{SYMPHONY-\VER} containing
the distribution.

\subsubsection{Configuring}\label{configuring}

The first step is to run a configuration script that will allow the
compilation process to be customized for your environment. to perform this
step, switch into the root directory of the distribution and type
{\color{Brown}
\begin{verbatim}
 ./configure 
\end{verbatim}
} This will set up the default configuration files. If you want to override
the default settings, you can either run the configuration script with
command-line options or else modify the options in the file
{\color{Brown}\texttt{share/config.site}}. A complete list of options with
brief explanations can be seen both in the file
{\color{Brown}\texttt{share/config.site}} and by typing 
{\color{Brown}
\begin{verbatim}
 ./configure --help=recursive 
\end{verbatim}
}
See Figure \ref{conf_opts} for a list of options the user may want to set. 

\begin{figure}[htb]
\begin{tabular}{ll}
\hline
\texttt{--enable-debug} & compile all projects with debug options set \\
\texttt{--enable-debug-symphony} & compile only SYMPHONY project with debug options \\
\texttt{--enable-doscompile} & Under Cygwin, compile so that executables do
not depend on the CYGWIN DLL \\
\texttt{--enable-static} & build static libraries \\
\texttt{--enable-static-executable} &  create a complete static executable \\
\texttt{--enable-gnu-packages} & compile with GNU packages \\ 
& compile interactive optimizer with readline library \\
\hline
\texttt{--disable-cgl-cuts} & disable generic cut generation \\
\texttt{--enable-sensitivity-analysis} & compile in the sensitivity analysis features \\
\texttt{--enable-root-only} & process only the root node \\
\texttt{--enable-frac-branching} & compile in the fractional branching option \\
\texttt{--enable-tests}&  perform additional sanity checks (for debugging purposes) \\
\texttt{--enable-tm-tests }& perform more tests  \\
\texttt{--enable-trace-path}&  additional debugging options \\
\texttt{--enable-cut-check}& additional debugging options \\
\texttt{--enable-statistics}& additional statistics \\
\texttt{--enable-pseudo-costs}& enable some experimental pseudo-cost branching tools \\
\texttt{--enable-draw-graph} &  enable IGD graph drawing application \\
\hline
\texttt{ --with-XXX-incdir} &  specify the directory with the header files for the XXX package \\ 
&where XXX is one of LP solver packages: cplex, glpk, osl, soplex, \\ 
& xpress \\
\texttt{--with-XXX-lib} &  specify the flags to link with the library  
XXX package \\ 
&where XXX is one of LP solver packages: cplex, glpk, osl, soplex, \\ 
& xpress \\
\texttt{--with-lp-solver[=lpsolver]} &  specify the LP solver in small 
letters (default lpsolver=clp) \\
\texttt{--with-application} &  compile the application library \\
\hline
\texttt{--enable-openmp} &   compile in OpenMP features \\
\texttt{--with-pvm } &  compile in parallel architecture (assuming that pvm is \\ 
&installed and the variable PVM\_ROOT is defined.) \\
\texttt{--without-cg} &  compile without cut generator module \\
\texttt{--without-cp} &  compile without cut pool module \\
\texttt{--without-lp} &  compile without LP solver module \\
\texttt{--without-tm} &  compile without tree manager module
\end{tabular}
\caption{A list of useful configuration options \label{conf_opts}}
\end{figure}

In order to enable or disable an option, either modify the file
\code{share/config.site} or add the option as an argument to configuration
script. For instance, running 
{\color{Brown}
\begin{verbatim}
 ./configure --enable-debug
\end{verbatim}
}
will compile the source files with the debugging flag.

It is possible to use compilers oter than the default (which is \code{g++}).
For example, to perform at automated build of SYMPHONY using the MSVC++
compiler \code{cl} with GNU autotools in the CYGWIN environment configure with
{\color{Brown}
\begin{verbatim}
 ./configure --enable-doscompile=msvc
\end{verbatim}
}

\subsubsection{Building}\label{building}

After configuring, the code can be built by typing the commands
{\color{Brown}
\begin{verbatim}
 make
 make install
\end{verbatim}
} This will first create the required libraries and executables and then will
install them. By default, the library {\color{Brown}\texttt{libSym}} and the
executable {\color{Brown}\texttt{symphony}} will be installed to the
{\color{Brown}\texttt{lib/}} and {\color{Brown}\texttt{bin/}} directories. To
install in another directory, use the option
{\color{Brown}\texttt{--prefix=DIR}} to the {\color{Brown}\texttt{configure}}
command.

After compilation, the SYMPHONY library, together with the header files in the
subdirectory {\color{Brown}\texttt{include/}}, can then be used to call
SYMPHONY from any C/C++ code. The API for this is described in
Chapter~\ref{API-overview}. The executable can also be used for solving
generic MILP problems in MPS and GMPL format. In order to read GMPL files, you
will need to have GLPK (\url{http://www.gnu.org/software/glpk/}) installed. To
install it automatically, run the \texttt{get.Glpk} script in the
\texttt{ThirdParty/Glpk} directory. After that, Glpk should be built and
linked automatically, enabling the ability to read GMPL files.

For a more powerful modeling interface, FlopC++ can also be used to obtain a
capability similar to ILOG's Concert technology for building math programming
models (see SYMPHONY/Examples/FLOPC++). 

To test SYMPHONY after building, type
{\color{Brown}
\begin{verbatim}
 make test
\end{verbatim}
} to execute an automated unit test. To test out the optimizer manually. a
sample MPS file called \code{sample.mps} and a sample GMPL/AMPL file called
{\color{Brown}\texttt{sample.mod}} together with its data file
{\color{Brown}\texttt{sample.dat}} are included with the distribution. You can
use either the command-line or the interactive optimizer. To solve the sample
MPS model, type {\color{Brown}
\begin{verbatim}
 bin/symphony -F SYMPHONY/Datasets/sample.mps
\end{verbatim}
} To solve the GMPL model, use the \code{-F} switch to specify the file name
and the \code{-D} for the data file name if the input is in GMPL/AMPL format,
i.e., type 
{\color{Brown}
\begin{verbatim}
 bin/symphony -F SYMPHONY/Datasets/sample.mod -D SYMPHONY/Datasets/sample.dat
\end{verbatim}}
For more MPS data files for further testing, see the MIPLIB library in the
\code{Data/} subdirectory. To run the interactive optimizer, execute SYMPHONY
without any command-line arguments, i.e., type
{\color{Brown}
\begin{verbatim}
  bin/symphony 
\end{verbatim}}
and then type \code{help} or \code{?} to see a list of available commands.
After the SYMPHONY library and the executable are compiled and tested, you
can type
{\color{Brown}
\begin{verbatim}
 make clean 
\end{verbatim}}
if you want to save disk space. That's it! Now you are ready to use SYMPHONY
callable library or solve generic MILP problems through the executable.

\subsubsection{Building for parallel architectures}

\paragraph{Shared-memory architectures.}

To compile a shared memory version of SYMPHONY, simply use an OpenMP compliant
compiler. Version \VER\  has been tested with gcc 4.2, and should build by
configuring with
{\color{Brown}
\begin{verbatim}
 ./configure --enable-openmp
\end{verbatim}
} 
After configuring, follow the earlier instructions for building and testing.
To invoke SYMPHONY from the command-line with multiple threads, specify the
number of threads with the \code{-p} option, i.e., {\color{Brown}
\begin{verbatim}
 bin/symphony -p 2 -F SYMPHONY/Datasets/sample.mps
\end{verbatim}
}

\paragraph{Distributed-memory architectures}
\label{distributed-build}

%\paragraph{Installing PVM.}
\label{PVM}
To compile a distributed application, it is necessary that PVM be installed
either in the system path or in the directory pointed to by the environment
variable \code{PVM\_ROOT} (this can be your home directory if PVM is not
already installed on your network). To install PVM yourself, the current
version can be obtained at \texttt{
\htmladdnormallink{http://www.csm.ornl.gov/pvm/}
{http://www.csm.ornl.gov/pvm/}}. It should compile and install without
problems on most architectures. You will have to make a few modifications to
your \code{.cshrc} file, such as defining the \code{PVM\_ROOT} environment
variable, but this is all explained clearly in the PVM documentation. Note
that all executables (or at least a link to them) must reside in the
\code{\$PVM\_ROOT/bin/\$PVM\_ARCH} directory in order for parallel processes
to be spawned correctly. The environment variable \code{PVM\_ARCH} is set in
your \code{.cshrc} file and should contain a string representing the current
architecture type. To run a parallel application, you must first start up the
daemon on each of the machines you plan to use in the computation. How to do
this is also explained in the PVM documentation.

%\paragraph{Configuring.}

To configure for a parallel build with the default parallel configuration,
invoke the configuration script as follows: {\color{Brown}
\begin{verbatim}
 ./configure --with-pvm
\end{verbatim}
} 
Note that there are a number of different parallel configurations (see
Chapter \ref{SYMPHONY-modules} for an overview of SYMPHONY's parallel
modules). The default configuration is to build two parallel modules, the
first consisting of the master, tree management, and cut management modules,
while the second consisting of the node processing, and cut generation
modules. To build in another configuration, there are four configure flags
that control which modules run as separate executables and which are called
directly in serial fashion. The variables are as follows:
\begin{description}
        \item[] \code{--with-cg}: If set, then the cut generator function will
        be called directly from the LP in serial fashion, instead of running
        as a separate executable. This is desirable if cut generation is quick
        and running it in parallel is not worth the price of the communication
        overhead.
        \item[] \code{--with-cp}: If set, then the cut pool(s) will be
        maintained as a data structure auxiliary to the tree manager.
        \item[] \code{--with-lp}: If set, then the LP functions will be called
        directly from the tree manager. When running the distributed version,
        this necessarily implies that there will only be one active subproblem
        at a time, and hence the code will essentially be running serially. In
        the shared-memory version, however, the tree manager will be threaded
        in order to execute subproblems in parallel.
        \item[] \code{--with-tm}: If set, then the tree will be managed
        directly from the master process. This is only recommended if a single
        executable is desired (i.e.~the three other variables are also set to
        true). A single executable is extremely useful for debugging purposes.
\end{description}
These variables can be set in virtually any combination, though some
don't really make much sense. Note that in a few user functions that
involve process communication, there will be different versions for
serial and parallel computation. This is accomplished through the use
of \code{\#ifdef} statements in the source code. This is well documented
in the function descriptions and the in the source files containing
the function stubs.

%\paragraph{Building.}

Once configured, follow the build instructions in Section \ref{building-unix}
to build the code. Note that this will also compile the sequential version.
Make sure there are links from your \code{\$PVM\_ROOT/bin/\$PVM\_ARCH}
subdirectory to each of the executables in your \code{bin/} directory, as
required by PVM. In order to keep track of the various possible
configurations, executable and their corresponding libraries are named as
follows. The name of each executable is \code{symphony}, along with a
combination of the (abbreviated) names of the modules that were combined to
produce that executable joined by underscores: \code{m} for the master module,
\code{tm} for the tree management module, \code{lp} for the node processing
module, \code{cg} for the cut generation module, and \code{cp} for the cut
management module. For instance, in the default distributed configuration, the
executables produced are \code{symphony\_m\_tm\_cp} and
\code{symphony\_lp\_cg}.

To test the parallel version, first start the PVM daemon by typing \code{pvm}
on the command line and then typing \code{quit}. As above, invoke SYMPHONY
using the sample MPS file called \code{sample.mps} included with the
distribution. To specify the file name, use the \code{-F} command-line option,
i.e., in the root directory, type {\color{Brown}
\begin{verbatim}
 bin/symphony_m_EXT -F SYMPHONY/Datasets/sample.mps 
\end{verbatim}
} 

where \code{EXT} is the extension to be added according to the chosen
configuration of the modules.

\subsubsection{Building SYMPHONY Applications}
\label{build_appl_unix}

There are a number of sample applications available as examples of how to do
customized development with SYMPHONY. These include customized solvers for the
matching problem, the set partitioning problem (simple and advanced versions),
the vehicle routing and traveling salesman problems, the mixed postman
problem, the multi-criteria knapsack problem, and the capacitated network
routing problem. These applications are contained in the
\code{SYMPHONY/Applications/} subdirectory in the distribution. There is also
a white paper that guides the user through the development of the MATCH solver
in the \code{SYMPHONY/Doc/} directory. For detailed instructions on developing
your own application with SYMPHONY, see Chapter \ref{SYMPHONY-development}.

In order to compile SYMPHONY's applications in Unix-like environments, you
must first compile a version of the callable library with hooks for the
callback functions. {\color{Brown}
\begin{verbatim}
 ./configure --with-application
 make 
 make install
\end{verbatim}
} This will create the application library called \code{libSymAppl} to be used
while building custom applications. Note that that the generic sequential
library and executable will also be made and installed.

After building the library, go to one of the application subdirectories in the
\code{SYMPHONY/Applications/} directory and type \code{make} there to build
the corresponding application. For more information, including the parallel
configuration instructions, see the INSTALL file of the corresponding
application.

\subsection{Building Using Microsoft Visual C++}
\label{getting_started_windows}

Here is a sketch outline of how to compile SYMPHONY in MS Windows with the
MSVC++ compiler. These instructions will lead you through the steps required
to compile SYMPHONY as a generic MILP solver. Note that the Windows version
has some limitations. Detailed timing information is not currently provided.
Support is only provided for running in sequential mode at this time.

First, obtain the source code by downloading from
\url{https://www.coin-or.org/download/source/SYMPHONY/}. Unpack the archive to
create the directory \code{SYMPHONY-\VER}. You now have three options. You
can either build using the MSVC++ IDE, build on the command-line with MSVC++
compiler, or use the NMAKE utility.

\subsubsection{Building with the MSVC++ Graphical Interface}
\label{using_msvc}

These instructions are for MSVC++ Version 8. Instructions for other versions
should be similar.

\begin{itemize}

\item Go to \code{MSVisualStudio\bs v8} directory and open the solution file
\code{symphony.sln}. 

\item Note that there are a number of additional preprocessor definitions that
control the functionality of SYMPHONY. These definitions are described in
\code{sym.mak}, a Unix-style makefile included in the distribution. To 
enable the functionality associated with a particular definition, simply add 
it to the list of definitions of \code{libSymphony} project together with 
the required libraries and paths. For instance, if you 
want to enable GMPL reader option, you need to
\begin{itemize}
  \item add the directory of the header files of GLPK to the include 
files path
  \item add \code{USE\_GLPMPL} to the defines
  \item add the GLPK library to the solution
\end{itemize}
\item Make sure that the project \code{symphony} is set as the startup project
by choosing \code{Set as Startup Project} from the \code{Project} menu after
selecting the \code{symphony} project in the Solution Explorer. Choose
\code{Build Solution} from the Build menu. This should successfully build
the SYMPHONY library and the corresponding executable.

\item To test the executable, go to the \code{Debug} tab and choose
\code{Start Without Debugging}. This should open a Window in which the
interactive solver will appear. Type \code{help} or \code{?} to see a list of
available commands or see Chapter \ref{API-overview} for instructions on using
the interactive solver.

\end{itemize}

Note that there is some functionality missing from the Windows version. Most
prominently, the timing functions do not work. In addition, the Windows
version will only run in sequential mode for a variety of reasons. However, it
should be relatively easy to get it running in parallel if you can get PVM
working under Windows. 

\subsubsection{Building in a Windows Terminal}
\label{using_msdev}

These instructions are for MSVC++ Version 8. Instructions for other versions
should be similar.

\begin{itemize}
\item Open a command terminal (choose \code{Run} on the Start menu and type
\code{cmd} in the dialogue box). Go to the \code{MSVisualStudio\bs v8}
directory and type 
{\color{Brown}
\begin{verbatim}
 devenv symphony.sln /build all
\end{verbatim}
}
This will create both the debug and release versions of SYMPHONY. If you 
want to compile only one of them, type
{\color{Brown}
\begin{verbatim}
 devenv symphony.sln /build "all - debug"
\end{verbatim}
}
or 
{\color{Brown}
\begin{verbatim}
 devenv symphony.sln /build "all - release"
\end{verbatim}
}
For each command, the library \code{libSymphony.lib} and the executable 
\code{symphony} will be created in \code{Debug} and/or \code{Release}
directories.  The library, together with the header files in 
\code{SYMPHONY\bs include\bs}, can then be 
used to call SYMPHONY from any C/C++ code. The API for calling SYMPHONY is 
described in Section \ref{callable_library}.

\item Test the executable by opening Windows Explorer and double-clicking
on {\color{Brown}\texttt{symphony.exe}} in the
{\color{Brown}\texttt{Debug\bs}} subdirectory. This should open a Window in
which the interactive solver will appear. Type \code{help} or \code{?} to see
a list of available commands or see Chapter
\ref{API-overview} for instructions on using the interactive solver.

\item If you modify the source code of SYMPHONY, type 
{\color{Brown}
\begin{verbatim}
 devenv symphony.sln /make all /rebuild
\end{verbatim}
}
in order to clean and rebuild everything.
\end{itemize} 

\subsubsection{Building with the MSVC++ compiler in CYGWIN}

It is possible to perform at automated build of SYMPHONY using the MSVC++
compiler \code{cl} with GNU autotools in the CYGWIN environment. To do so,
follow the instuctions for building in Unix-like environments (see Section
\ref{getting_started_unix}), except when configuring, use the command

{\color{Brown}
\begin{verbatim}
 ./configure --enable-doscompile=msvc
\end{verbatim}}

\subsubsection{Building with the NMAKE Utility}
\label{using_nmake}

\begin{itemize}
\item Go to \code{MSVisualStudio} directory and edit the \code{sym.mak} 
makefile to reflect 
your environment. This involves specifying the LP solver to be used, 
assigning some variables and  setting various paths. Only minor edits 
should be required. An explanation of what has to be set is contained in the 
comments in the makefile.  Note that, you have to first create the COIN 
libraries \ptt{Cgl}, \ptt{Clp}, \ptt{Osi}, \ptt{OsiClp} and \ptt{CoinUtils}.

\item Once configuration is done, open a command line terminal and type 
{\color{Brown}
\begin{verbatim}
 nmake sym.mak
\end{verbatim}
}
This will make the SYMPHONY library \code{libSymphony.lib} and the executable 
\code{symphony} in \code{Debug} directory. The library, together with the 
header files in \code{SYMPHONY\bs include\bs}, can then be used to call 
SYMPHONY from any C/C++ code. The API for calling SYMPHONY is described in 
Section \ref{callable_library}.

\item Test the executable by opening Windows Explorer and double-clicking
on {\color{Brown}\texttt{symphony.exe}} in the
{\color{Brown}\texttt{Debug\bs}} subdirectory. This should open a Window in
which the interactive solver will appear. Type \code{help} or \code{?} to see
a list of available commands or see Chapter \ref{API-overview} for
instructions on using the interactive solver.

\end{itemize}

\subsection{Building SYMPHONY Applications}
\label{build_appl_msvc}

As mentioned above, there are a number of sample applications available as
examples of how to do development with SYMPHONY. These include solvers for the
matching problem, the set partitioning problem (simple and advanced versions),
the vehicle routing and traveling salesman problems, the mixed postman
problem, multi-criteria knapsack problem and, capacitated network routing
problem. These applications are contained in the \code{SYMPHONY/Applications/}
subdirectory in the distribution. There is also a white paper that guides the
user through the development of the MATCH solver in the \code{SYMPHONY/Doc/}
directory. For instructions on developing your own application with SYMPHONY,
see Chapter \ref{SYMPHONY-development}.

In order to compile SYMPHONY's applications in the Microsoft Visual C++
environment, obtain the source code as described earlier. As before, you then
have three options. You can either build using the MSVC++ IDE, build on the
command-line with MSVC++ executable, or use the NMAKE utility. The below
instructions are for MSVC++ Version 6, but building in other versions should
be similar. All of the following commands should be executed in the
\code{SYMPHONY-\VER\bs Applications\bs XXX\bs MSVisualStudio\bs v8} directory,
where \code{XXX} is the name of the application to be built.

\subsubsection{Building With the MSVC++ IDE}

\begin{itemize}

\item Open the solution file \code{xxx.sln}.

\item The configuration steps are exactly the same as that described in
  Section \ref{using_msvc}. The only difference is that you are using the
  \code{xxx} project instead of the \code{symphony} project. Go through the
  same steps to configure.

\item Once you have the proper settings, choose \code{Build
xxx.exe} from the \code{Build} menu. This should successfully 
build the executable.

\item
To test the executable, right click on the \code{xxx} project, go to the
\code{Debug\bs} tab and set the program arguments to 
\code{-F ..\bs ..\bs sample.xxx}. Note that command-line switches are 
Unix-style.

\item
Now choose \code{Execute} from the build menu and you have a working branch
and bound solver. 

\end{itemize}

\subsubsection{Building in a Windows Terminal}
\begin{itemize}
\item Open a command terminal (choose \code{Run} on the Start menu and type
\code{cmd} in the dialogue box) and type
{\color{Brown}
\begin{verbatim}
 devenv xxx.sln /make all
\end{verbatim}
} where \code{xxx} is the name of the application. This will create both the
debug and release versions of the application executable. If you want to
compile only one of them, type 
{\color{Brown}
\begin{verbatim}
 devenv xxx.sln /make "all - debug"
\end{verbatim}
}
or 
{\color{Brown}
\begin{verbatim}
 devenv xxx.sln /make "all - release"
\end{verbatim}
}
For each command, the executable \code{user} will be created in 
\code{Debug\bs} and/or \code{Release\bs}
directories. 

\item To test the executable, type 
{\color{Brown}
\begin{verbatim}
 Debug\xxx.exe -F ..\..\sample.xxx
\end{verbatim}
}
\item If the source files for the application are modified, type 
{\color{Brown}
\begin{verbatim}
 devenv user.sln /make all /rebuild
\end{verbatim}
}
in order to clean and rebuild everything.
\end{itemize} 

\subsubsection{Using the NMAKE Utility}

\begin{itemize}
\item 
Edit the file \code{xxx.mak}, where \code{xxx} is the name of the application,
to reflect your environment. Only minor edits should be required. An
explanation of what has to be set is contained in the comments in the
\code{xxx.mak} file. Also, see the related parts of Section \ref{using_nmake}
above.

\item Once configuration is done, type 
{\color{Brown}
\begin{verbatim}
  nmake /f xxx.mak
\end{verbatim}
}
The executable \code{xxx.exe} will be created in the \code{Debug/} directory.
\item To test the executable, type 
{\color{Brown}
\begin{verbatim}
 Debug\xxx.exe -F ..\..\sample.xxx
\end{verbatim}
}
\end{itemize}

