Code Monkey home page Code Monkey logo

concorde-easy-build's Introduction

Concorde

Concorde is likely the most famous solver for the Travelling Salesman Problem. It was developed by four legends in the Operational Research community: David Applegate, Robert Bixby, Vasek Chvatal, and William Cook. The solver is blazing fast, and is able to solve enormous instances.

However, as most of its users know, building Concorde can be painful. So painful that people have written technical reports, blog posts [1, 2, 3], stackoverflow questions [4, 5], (to link a few) dedicated to this topic.

Build Concorde like it's no longer 1997

This repository allows you to build concorde using modern toolchains.

License

In this repository, I store a copy of the 2003 version of Concorde, together with a minimal build system. Let me stress that this is a totally pirate version of the software. In no way any of the authors have authorised me to fork their solver and create this repository. Therefore, I have in no way any claim on authorship of this software. If you are using Concorde from this repository you have to agree to exactly the same license as if you had downloaded it from the official website. In short, this means that Concorde is free for you if and only if you use it for academic purposes. In all other cases you should contact William Cook to discuss licensing options.

For what concern my contribution, which is basically a CMakeLists.txt file, I release it to public domain under the unlicense.

Assumptions

I assumed that:

  • You are on Linux, with a recent version of GCC.
  • You use CMake as your build system.
  • You use a recent version of CPLEX as your LP solver.

Users not corresponding to this identikit might have to adapt this solution.

I also assume that you are interested in having the following, and nothing else, at the end of the build process:

  • The executable (concorde-bin).
  • A shared library (libconcorde_full.so), an archive file (libconcorde_full.a) and an include file (concorde.h) to use Concorde with your custom software.

Building

Assume that you have Cplex installed in /opt/ibm/CPLEX/my-cplex. Building Concorde, then, is as simple as:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCPLEX_ROOT_DIR=/opt/ibm/CPLEX/my-cplex ..
make -j5

This will create the four files: concorde-bin, libconcorde_full.so, libconcorde_full.a, and concorde.h.

concorde-easy-build's People

Contributors

alberto-santini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

concorde-easy-build's Issues

Compilation Error in Concorde Solver: Uninitialized Variable Description

Thank you for your contribution to helping easily build the concorde solver.

Issue: Compilation Error in Concorde Solver: Uninitialized Variable

Description

After resolving previous issues with CPLEX not being found, I have now encountered a compilation error while building the Concorde solver on my system. The error arises during the make -j5 command and appears to be related to the potential use of an uninitialized variable in the linkern.c source file.

System Specifications

Operating System: Ubuntu 22.04.3 LTS
CMake Version: 3.22.1
CPLEX Version: 22.1.1.0
Steps Leading to the Issue
Successfully configured the project with CMake, resolving previous CPLEX-related issues.
Proceeded to build the project using make -j5.
Compilation Error Details
The compiler raises an error regarding a potentially uninitialized variable winstack.stack used in the linkern.c file. The relevant part of the error message is as follows:

[  1%] Building C object CMakeFiles/concorde_lp.dir/src/LP/lpcplex8.c.o
[  2%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/allocrus.c.o
[  3%] Building C object CMakeFiles/concorde_bigguy.dir/src/BIGGUY/bigguy.c.o
[  5%] Building C object CMakeFiles/concorde_heldkarp.dir/src/HELDKARP/heldkarp.c.o
[  5%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/edgegen.c.o
[  6%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/util.c.o
[  7%] Linking C static library libconcorde_bigguy.a
[  8%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgelen.c.o
[  8%] Built target concorde_bigguy
[  9%] Building C object CMakeFiles/concorde_linkern.dir/src/LINKERN/linkern.c.o
[ 10%] Linking C static library libconcorde_heldkarp.a
[ 10%] Built target concorde_heldkarp
[ 11%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/first.c.o
[ 12%] Linking C static library libconcorde_lp.a
[ 13%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/zeit.c.o
[ 13%] Built target concorde_lp
[ 15%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/urandom.c.o
[ 16%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/localcut.c.o
[ 17%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/signal.c.o
[ 18%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/xnear.c.o
[ 19%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/delaunay.c.o
[ 20%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/getdata.c.o
[ 21%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/separate.c.o
[ 22%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/tsporacl.c.o
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
[ 23%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/chunks.c.o
[ 24%] Building C object CMakeFiles/concorde_linkern.dir/src/LINKERN/flip_two.c.o
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/concorde_linkern.dir/build.make:76: CMakeFiles/concorde_linkern.dir/src/LINKERN/linkern.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 25%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/lift.c.o
make[1]: *** [CMakeFiles/Makefile2:243: CMakeFiles/concorde_linkern.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 26%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/intmat.c.o
[ 27%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/mlinkern.c.o
[ 29%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgeutil.c.o
[ 30%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/bgetopt.c.o
[ 31%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/safe_io.c.o
[ 32%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/sortrus.c.o
[ 33%] Linking C static library libconcorde_edgegen.a
[ 34%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/genhash.c.o
[ 34%] Built target concorde_edgegen
[ 35%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgemap.c.o
[ 36%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/priority.c.o
[ 37%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/dheaps_i.c.o
[ 38%] Linking C static library libconcorde_localcut.a
[ 39%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/fastread.c.o
[ 39%] Built target concorde_localcut
[ 40%] Linking C static library libconcorde_utils.a
[ 40%] Built target concorde_utils
make: *** [Makefile:91: all] Error 2

Requested Help

I am looking for advice or guidance on how to address this compilation error. It seems to be a matter of ensuring a variable is initialized before use, but I am uncertain of the best approach to resolving this within the Concorde solver's codebase.

Thank you for your time and assistance.

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.