Giter VIP home page Giter VIP logo

algencan_adolc's Introduction

algencan_adolc

Algencan 3.1.1 using Automatic Differenciation library ADOL-C 2.7.3

In this file we present the complete instalation of Algencan 3.1.1 and ADOL-C 2.7.3 and how to use those libraries together in Linux Ubuntu.

Algencan 3.1.1 is a nonlinear programming solver and ADOL-C 2.7.3 is used to evaluate sparses Hessians in Algencan methods.

INSTALLATION

Before installing ADOL-C, we first need to install two libraries: 1. Boost 1.75.0; 2. Colpack 1.0.10.

ADOL-C 2.7.3 INSTALLATION

Boost 1.75.0 INSTALLATION

1 Download boost_1_75_0.tar.bz2 in (https://www.boost.org/users/download/)

2 Extract the file in the desired directory

tar --bzip2 -xf /path/to/boost_1_75_0.tar.bz2

3 Open boost directory

cd path/to/boost_1_75_0

4 Run bootstrap.sh

./bootstrap.sh --prefix=path/to/installation/prefix

5 Run b2 to generate external libraries in \lib\

./b2 install

Colpack 1.0.10 INSTALLATION

Colpack is used by ADOL-C to treat sparse matrices.

1 Download Colpack in (https://github.com/CSCsw/ColPack/releases)

2 Extract the file

3 Run the following commands in Colpack directory:

> autoreconf -vif

> ./configure --prefix=/path/to/install/

> make

> make install

ADOL-C INSTALLATION

If Boost and Colpack are installed successfully, we may now install ADOL 2.7.3

1 Download ADOL-C in (https://github.com/coin-or/ADOL-C)

2 Extract the file

3 Run the following commands in ADOL-C directory:

> autoreconf -fi

> ./configure --enable-sparse --with-boost=PATHTOBOOST --with-colpack=PATHCOLPACK

> make

> make install

where PATHTOBOOST and PATHCOLPACK is the path to Boost and Colpack directories, respectively.

If the installation is successfull, ADOL-C external libraries are generated in /home/USER/adolc_base, where /home/USER is the user directory.

ALGENCAN 3.1.1 INSTALLATION

1 Download ALGENCAN 3.1.1 in (https://www.ime.usp.br/~egbirgin/tango/codes.php)

2 Extract the file

3 Run in ALGENCAN directory

make

If the installation is succeed, external library libalgencan.a is generated in PATHTOALGENCAN/lib/

Linking and compiling

Compiling codade via terminal

To compile an ADOL-C code main.cpp use the following command:

g++ -w -I/home/USER/adolc_base/include -o main main.cpp -Wl,--rpath -Wl,/home/USER/adolc_base/lib64 -L/home/USER/adolc_base/lib64 -ladolc}

To compile an ALGENCAN-C code main.c use the following command:

gcc -O3 main.c -L$ALGENCAN/lib -lalgencan -lgfortran -lm -o algencan}

To compile an ALGENCAN-C code algencan.c together with ADOL-C code adolc.cpp use the following commands:

g++ -w -c -I/home/USER/adolc_base/include adolc.cpp \ -Wl,--rpath -Wl,/home/USER/adolc_base/lib64 \ -L/home/USER/adolc_base/lib64/ -ladolc

gcc -w -c algencan.c \ -L/$ALGENCAN/lib/ -lalgencan -lm \ -L/usr/lib/gcc/x86_64-linux-gnu/5/ -lstdc++ -lgfortran

g++ -O3 -Wall -I/home/USER/adolc_base/include -o main algencan.o adolc.o \ -Wl,--rpath -Wl,/home/USER/adolc_base/lib64 \ -L/home/USER/adolc_base/lib64/ -ladolc \ -L/$ALGENCAN/lib/ -lalgencan -lm \ -L/usr/lib/gcc/x86_64-linux-gnu/5/ -lstdc++ -lgfortran

Run the main program:

./main

Linking and compiling using Codeblocks 20.03

1 Create C/C++ Console Application project.

2 In Build Options >> Linker Settings, add the following libraries:

adolc.so

libColPack.so

libalgencan.a

gfortran

3 In Build Options >> Search Directories, add paths:

/home/USER/adolc_base/include

/home/USER/adolc_base/lib64

in Compiler, Linker, and Resource compiler

  1. Now we can run the project with files algencan.c and adolc.cpp

Computional Experiments

We present some results with tests in order to compare ALGENCAN performance with automatic differentiation with ADOL-C and with analytic differentiation with Example 1. We vary nite value from 50 to 500.

       nite	|      ADOL-C/C (s)	|       Analytic/Fortran (s)
--------------------------------------------------------------------------
	 50	|	  0.38		|		0.01
	100	|	  2.51		|		0.04
	150	|	 10.94		|		0.06
	200	|	 19.61		|		0.05
	250	|	 37.09		|		0.06
	300	|	 52.94		|		0.10
	350	|	116.70		|		0.15
	400	|	182.63		|		0.21
	450	|	261.79		|		0.28
	500	|	380.35		|		0.37

We show that analytic differentiation is faster than ADOL-C, although calculate the analytic differentiation can be a complicated task with complex functions.

algencan_adolc's People

Contributors

kennedy94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.