{"id":539,"date":"2020-11-16T01:55:18","date_gmt":"2020-11-16T01:55:18","guid":{"rendered":"http:\/\/eventos.cmm.uchile.cl\/vrpsolver\/?page_id=539"},"modified":"2020-11-19T02:47:36","modified_gmt":"2020-11-19T02:47:36","slug":"lab-setup","status":"publish","type":"page","link":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/lab-setup\/","title":{"rendered":"Lab setup"},"content":{"rendered":"<style><span style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" data-mce-type=\"bookmark\" class=\"mce_SELRES_start\">\ufeff<\/span><br \/>\ncode {font-family: Consolas,\"courier new\"; color: crimson; background-color: #f1f1f1; padding: 2px; font-size: 75%;}<\/p>\n<\/style>\n<table style=\"boder: 0px;\">\n<tbody>\n<tr style=\"boder: 0px;\">\n<td style=\"boder: 0px;\"><b>Requirements:<\/b><\/p>\n<p>The software is for <b>academic use only<\/b>. Is it distributed as a docker image in order to facilitate installation and usage. To install and run the solver, you need:<\/p>\n<ol style=\"margin-top: -2em;\">\n<li>Docker free software for <a href=\"https:\/\/docs.docker.com\/docker-for-mac\/install\/\">MacOS<\/a> or <a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\">Ubuntu<\/a> or <a href=\"https:\/\/docs.docker.com\/docker-for-windows\/install\/\">Windows<\/a>\n<ul style=\"margin-top: -0.5em;\">\n<li>Users of MacOS and Windows systems which do not meet the Docker requirements can use the <a href=\"https:\/\/docs.docker.com\/toolbox\/\">Docker Toolbox<\/a>.<\/li>\n<\/ul>\n<\/li>\n<li>Version 12.9 or 12.10 of <a href=\"https:\/\/www.ibm.com\/products\/ilog-cplex-optimization-studio\">IBM ILOG CPLEX<\/a> for 64-bit Linux (even for non-Linux users), which is free for academic use.<\/li>\n<\/ol>\n<p>VRPSolver uses <a href=\"https:\/\/realopt.bordeaux.inria.fr\/?page_id=2\">BaPCod<\/a>, a C++ library implementing generic Branch-Cut-and-Price. You will need to download the file bapdock.img and request a free license for academic purposes. In order to do so,\u00a0 fill the form available <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\/#download\">here<\/a>, you will then receive and email with a dowload link.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>These notes explain how to set up and run the VRPSolver on <a href=\"#linux\">Linux<\/a> and <a href=\"#winmac\">Windows\/MacOS<\/a> systems. While assuming the use of Cplex 12.10, this tutorial can be used in an equivalent way for installation with Cplex 12.9.<\/p>\n<div id=\"linux\">\n<h3>Linux<\/h3>\n<p>First, follow the <a href=\"https:\/\/docs.docker.com\/install\/linux\/linux-postinstall\/\">instructions<\/a> to manage Docker as a non-root user (without sudo).<\/p>\n<h4>Installation of bapdock.img<\/h4>\n<p>Import and run the Docker image:<br \/>\n<code>docker import -c \"ENTRYPOINT [\\\"\/julia\\\"]\" bapdock.img bapdock-init<br \/>\ndocker run -it -d --name bapdock-cont bapdock-init<\/code><\/p>\n<p>Run this command to get the container-ID:<br \/>\n<code>docker ps<\/code><\/p>\n<p>Enter the subdirectory of your cplex installation which contains the shared libraries (e.g. <code>\/opt\/ibm\/ILOG\/CPLEX_Studio1210\/cplex\/bin\/x86-64_linux<\/code>) and create a copy of <i>libcplex12100.so<\/i> with the name <i>libcplex12x.so<\/i><\/p>\n<p>Copy your cplex folder to inside the container:<br \/>\n<code>docker cp \/ABSOLUTE_PATH_TO_CPLEX_ROOT\/cplex bapdock-cont:\/cplex<\/code><\/p>\n<p>For example, if your CPLEX 12.10 is installed at <i>\/opt\/ibm\/ILOG\/CPLEX_Studio1210<\/i> this command should be:<br \/>\n<code>docker cp \/opt\/ibm\/ILOG\/CPLEX_Studio1210\/cplex bapdock-cont:\/cplex<\/code><\/p>\n<p>Commit the modified container as an image named bapdock<br \/>\n<code>docker commit container-ID bapdock<\/code><\/p>\n<p>Stop and remove the bapdock-init container:<br \/>\n<code>docker stop container-ID<br \/>\ndocker rm container-ID<\/code><\/p>\n<h4>Running a Julia VRPSolver application through the docker<\/h4>\n<p>To run the application from your local machine command line, you must mount (-v) the user julia VRPSolver application folder under any name and the last arguments must be the main script .jl of the application, followed by the application arguments:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_VRPSOLVER_APP:\/MyApp bapdock \/MyApp\/myapp.jl &amp;nbsp&amp;nbsp arg1 arg2 ... argn<\/code><\/p>\n<p>The VRPSolver application folder is mounted as <i>\/MyApp<\/i> in the Docker container filesystem.<br \/>\nFor example, for the <i>Capacitated Vehicle Routing Problem<\/i> (CVRP) demo (available <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\/cvrpdemo.zip\">here<\/a>), we can call:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock \/CVRP\/src\/run.jl \u00a0\u00a0\u00a0\u00a0  \u00a0\u00a0 \/CVRP\/data\/A\/A-n37-k6.vrp -m 6 -M 6 -u 950 -o \/CVRP\/sol\/A-n37-k6.sol<\/code><br \/>\nwhich solves the instance <i>A-n37-k6.vrp<\/i> using exactly 6 vehicles (-m and -M defines the minimum and maximum number of vehicles, respectively), an upper bound of 950 and writes the solution at <i>\/CVRP\/sol\/A-n37-k6.sol<\/i>. Note that for the arguments after <i>bapdock<\/i> we need to consider the container filesystem (<i>\/CVRP<\/i>) to access the application and I\/O arguments. All changes into <i>\/CVRP<\/i> and subdirectories will be reflected at <i>\/ABSOLUTE_PATH_TO_CVRP_APP<\/i>.<\/p>\n<p>When running from the local machine command line, Julia code will be compiled each time and thus building the model takes some time (like 30 seconds in a typical machine) even for small instances. The reported solution time, counted only after the code is compiled, is not affected.<\/p>\n<p>To decrease recompilation time while creating\/debugging the application, you can run the application in the interactive mode:<br \/>\n<code>docker run -it --rm -v \/ABSOLUTE_PATH_TO_VRPSOLVER_APP:\/MyApp bapdock<\/code><br \/>\n<!--\nTo run your application inside the Julia environment, type\n\n<code>\nARGS=[\"arg1\", \"arg2\", ..., \"argn\"] # if there exists application arguments\ninclude(\"\/MyApp\/myapp.jl\")\n<\/code>\n\n-->For example, for CVRP demo, we can call:<br \/>\n<code>docker run -it --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock<\/code><br \/>\nand to run the application inside the Julia environment, type (one at a time)<br \/>\n<code># load CVRP demo<br \/>\ninclude(\"\/CVRP\/src\/run.jl\")<br \/>\n# run CVRP demo<br \/>\nmain([\"\/CVRP\/data\/A\/A-n37-k6.vrp\",\"-m\",\"6\",\"-M\",\"6\",\"-u\",\"950\",\"-o\",\"\/CVRP\/sol\/A-n37-k6.sol\"])<br \/>\n# running another instance without writing the solution<br \/>\nmain([\"\/CVRP\/data\/A\/A-n37-k5.vrp\",\"-m\",\"5\",\"-M\",\"5\",\"-u\",\"670\"])<br \/>\n# defining arguments before<br \/>\nargs = [\"\/CVRP\/data\/A\/A-n37-k5.vrp\",\"-m\",\"5\",\"-M\",\"5\",\"-u\",\"671\"]\n# running with predefined arguments<br \/>\nmain(args)<\/code><\/p>\n<p>You can edit the application on your local machine and load inside Julia environment in the docker to test you changes, using &#8220;include&#8221;. In this case, recompilation time will be minimized.<\/p>\n<p>To quit the Julia environment, type<br \/>\n<code>exit()<\/code><\/p>\n<p>Other demos are available <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\">here<\/a>.<\/p>\n<h4>Easier way of running a Julia VRPSolver application<\/h4>\n<p>There is a bash script called <i>VRPSolver<\/i> available for each demo application to avoid call Docker directly.<br \/>\nFor example, for CVRP demo (see README.txt in the <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\/cvrpdemo.zip\">demo<\/a> for more details), we can call:<br \/>\n<code>.\/VRPSolver data\/A\/A-n37-k5.vrp -m 5 -M 5 -u 670<\/code><br \/>\ninstead of:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock \/CVRP\/src\/run.jl \u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 \/CVRP\/data\/A\/A-n37-k5.vrp -m 5 -M 5 -u 670<\/code><\/p>\n<\/div>\n<div id=\"winmac\">\n<h3>Windows or MacOS<\/h3>\n<p>First, make sure the Docker is in <i>running<\/i> status. If you are using Docker Toolbox, please use the <i>Docker QuickStart Terminal<\/i> to run Docker.<\/p>\n<h4>How to extract CPLEX<\/h4>\n<p>Create a folder named <i>cplexdocker.<\/i><br \/>\nGet CPLEX 12.10 installer file for Linux 64 from IBM ILOG (let&#8217;s assume the file name is <i>cplex_studio1210.linux-x86-64.bin<\/i>) and move it to the folder <i>cplexdocker.<\/i><br \/>\nAlso, move the <i>bapdock.img<\/i> to <i>cplexdocker.<\/i><br \/>\nCreate a text file named <i>Dockerfile_extract_cplex.txt<\/i> at <i>cplexdocker<\/i> folder with this content:<br \/>\n<code>FROM ubuntu<br \/>\nRUN apt-get update ; apt-get install -y openjdk-8-jre<br \/>\nCOPY cplex_studio1210.linux-x86-64.bin \/<br \/>\nRUN (echo 2 ; echo ; echo 1 ; echo \/ ; echo y ; echo ; echo; echo; echo 2; echo ) | bash .\/cplex_studio1210.linux-x86-64.bin<\/code><\/p>\n<p>Run these commands at the directory <i>cplexdocker<\/i>:<br \/>\n<code>docker build -t ubuntu_with_cplex -f Dockerfile_extract_cplex.txt .<br \/>\ndocker create --name ubuntu_with_cplex ubuntu_with_cplex<\/code><\/p>\n<p>Copy the installed cplex to <i>cplexdocker<\/i> folder:<br \/>\n<code>docker cp ubuntu_with_cplex:\/cplex .<\/code><\/p>\n<p>Enter the folder <code>cplex\/bin\/x86-64_linux\/<\/code> and rename <i>libcplex12100.so<\/i> to <i>libcplex12x.so<\/i><\/p>\n<h4>Installation of bapdock.img<\/h4>\n<p>Import and run the Docker image:<br \/>\n<code>docker import -c \"ENTRYPOINT [\\\"\/julia\\\"]\" bapdock.img bapdock-init<br \/>\ndocker run -it -d --name bapdock-cont bapdock-init<\/code><\/p>\n<p>Run this command to get the container-ID:<br \/>\n<code>docker ps<\/code><\/p>\n<p>Copy your cplex folder to inside the container:<br \/>\n<code>docker cp cplex bapdock-cont:\/cplex<\/code><\/p>\n<p>Commit the modified container as an image named bapdock<br \/>\n<code>docker commit container-ID bapdock<\/code><\/p>\n<p>Stop and remove the bapdock-init container:<br \/>\n<code>docker stop container-ID<br \/>\ndocker rm container-ID<\/code><\/p>\n<h4>Running a Julia VRPSolver application through the docker<\/h4>\n<p>To run the application from your local machine command line, you must mount (-v) the user julia VRPSolver application folder under any name and the last arguments must be the main script .jl of the application, followed by the application arguments:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_VRPSOLVER_APP:\/MyApp bapdock \/MyApp\/myapp.jl \u00a0\u00a0 arg1 arg2 ... argn<\/code><\/p>\n<p>The VRPSolver application folder is mounted as <i>\/MyApp<\/i> in the Docker container filesystem.<br \/>\nFor example, for the <i>Capacitated Vehicle Routing Problem<\/i> (CVRP) demo (available <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\/cvrpdemo.zip\">here<\/a>), we can call:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock \/CVRP\/src\/run.jl \u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 \/CVRP\/data\/A\/A-n37-k6.vrp -m 6 -M 6 -u 950 -o \/CVRP\/sol\/A-n37-k6.sol<\/code><br \/>\nwhich solves the instance <i>A-n37-k6.vrp<\/i> using exactly 6 vehicles (-m and -M defines the minimum and maximum number of vehicles, respectively), an upper bound of 950 and writes the solution at <i>\/CVRP\/sol\/A-n37-k6.sol<\/i>. Note that for the arguments after <i>bapdock<\/i> we need to consider the container filesystem (<i>\/CVRP<\/i>) to access the application and I\/O arguments. All changes into <i>\/CVRP<\/i> and subdirectories will be reflected at <i>\/ABSOLUTE_PATH_TO_CVRP_APP<\/i>.<\/p>\n<p>When running from the local machine command line, Julia code will be compiled each time and thus building the model takes some time (like 30 seconds in a typical machine) even for small instances. The reported solution time, counted only after the code is compiled, is not affected.<\/p>\n<p>To decrease recompilation time while creating\/debugging the application, you can run the application in the interactive mode:<br \/>\n<code>docker run -it --rm -v \/ABSOLUTE_PATH_TO_VRPSOLVER_APP:\/MyApp bapdock<\/code><\/p>\n<p>For example, for CVRP demo, we can call:<br \/>\n<code>docker run -it --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock<\/code><br \/>\nand to run the application inside the Julia environment, type (one at a time)<br \/>\n<code># load CVRP demo<br \/>\ninclude(\"\/CVRP\/src\/run.jl\")<br \/>\n# run CVRP demo<br \/>\nmain([\"\/CVRP\/data\/A\/A-n37-k6.vrp\",\"-m\",\"6\",\"-M\",\"6\",\"-u\",\"950\",\"-o\",\"\/CVRP\/sol\/A-n37-k6.sol\"])<br \/>\n# running another instance without writing the solution<br \/>\nmain([\"\/CVRP\/data\/A\/A-n37-k5.vrp\",\"-m\",\"5\",\"-M\",\"5\",\"-u\",\"670\"])<br \/>\n# defining arguments before<br \/>\nargs = [\"\/CVRP\/data\/A\/A-n37-k5.vrp\",\"-m\",\"5\",\"-M\",\"5\",\"-u\",\"671\"]\n# running with predefined arguments<br \/>\nmain(args)<\/code><\/p>\n<p>You can edit the application on your local machine and load inside Julia environment in the docker to test you changes, using &#8220;include&#8221;. In this case, recompilation time will be minimized.<\/p>\n<p>To quit the Julia environment, type<br \/>\n<code>exit()<\/code><\/p>\n<p>Other demos are available <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\">here<\/a>.<\/p>\n<h3>Easier way of running a Julia VRPSolver application<\/h3>\n<p>If you are using MacOS terminal or <i>Docker QuickStart Terminal<\/i> (available for Docker Toolbox on Windows and MacOS), it is possible to use the bash script <i>VRPSolver<\/i> available for each demo application to avoid call Docker directly.<br \/>\nFor example, for CVRP demo (see README.txt in the <a href=\"https:\/\/vrpsolver.math.u-bordeaux.fr\/cvrpdemo.zip\">demo<\/a> for more details), we can call:<br \/>\n<code>.\/VRPSolver data\/A\/A-n37-k5.vrp -m 5 -M 5 -u 670<\/code><br \/>\ninstead of:<br \/>\n<code>docker run --rm -v \/ABSOLUTE_PATH_TO_CVRP_APP:\/CVRP bapdock \/CVRP\/src\/run.jl \u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 \/CVRP\/data\/A\/A-n37-k5.vrp -m 5 -M 5 -u 670<\/code><\/p>\n<h4>Troubleshooting<\/h4>\n<p>If you got the message &#8220;libcplex12x.so: cannot open shared object file: No such file or directory \u00bb, it means that the cplex directory was not successfully mounted. Please verify:<\/p>\n<ol>\n<li>you created a copy of libcplex1210.so (or libcplex129.so) to libcplex12x.so<\/li>\n<li>that CPLEX version is 12.9 or 12.10<\/li>\n<li>that CPLEX 64-bit Linux distribution is used, even if you have MacOS or Windows<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Requirements: The software is for academic use only. Is it distributed as a docker image in order to facilitate installation and usage. To install and run the solver, you need: Docker free software for MacOS or Ubuntu or Windows Users of MacOS and Windows systems which do not meet the Docker requirements can use the &hellip; <a href=\"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/lab-setup\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lab setup<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":62,"featured_media":0,"parent":0,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"footnotes":""},"class_list":["post-539","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/pages\/539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/comments?post=539"}],"version-history":[{"count":37,"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/pages\/539\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/pages\/539\/revisions\/600"}],"wp:attachment":[{"href":"https:\/\/eventos.cmm.uchile.cl\/vrpsolver\/wp-json\/wp\/v2\/media?parent=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}