How can i install Google's CP solver OR-Tools in MiniZinc?
Asked Answered
P

1

9

I'm currently working on MiniZinc, and i have been running my models with the two solvers integrated in MiniZinc: Gecode and Chuffed. I've been running it in the IDE, but i am aware that it can be runned in bash too (using minizinc command).

But i would like to test how my models do with Google's CP solver, called OR-Tools. But i really don't know how. I got the MiniZinc snap installation in Ubuntu 18.04, but i can download a fresh directory of MiniZinc and run it locally, and configure the solver there (and not in snap installation since snap directories can not be modified).

I need a way to install OR-Tools and make it work at least in the terminal (but run it from the IDE would be perfect).

Psalmist answered 30/4, 2020 at 23:58 Comment(1)
You can get the flatzinc binaries of ortools here: github.com/google/or-tools/releasesBrakpan
U
13

MiniZinc uses solver configuration files to find the available solver. If, however, the solver does not provide a configuration file. The IDE can help you add a user configuration file for the solver in the following simple steps.

  1. Open the preferences window.
  2. In the solver selection, select "Add new..."

Add new solver

  1. Enter the details of the solver you want to add. Most importantly the location of the executable and the location of their MiniZinc library.

Enter Solver details

Edit/Addition: Obtaining the necessary executables

As mentioned by Stradivari in the comment above, releases are distributed at or-tools @ Github.

Pick the corresponding asset from one of those following the or-tools_{XXX}_{VERSION}.zip naming scheme.

Unhurried answered 1/5, 2020 at 0:57 Comment(7)
It supports -a, -n, -s, -v, -p, -f, -t. Not sure about -rKosak
By the way @Unhurried how can you do this in MiniZinc Command Line? I'm trying to build a docker container with MiniZinc + OR Tools solver installed by default.Psalmist
You can just copy the file created by the IDE (store in .minizinc/solvers) to you Docker imageUnhurried
I installed or-tools with pip in MacOS, but I don't find any bin folder in "/Users/my_name/Library/Python/3.8/lib/python/site-packages". Is it at somewhere else?Jebel
The full path is "/Users/my_name/Library/Python/3.8/lib/python/site-packages/ortools"Jebel
the minizinc interpreter is not a python package.Kosak
Starting with the 9.4 version, there is no flatzinc asset (or-tools_flatzinc_{XXX}_{VERSION}.zip) on github. Instead, one should use the cpp asset, e.g. or-tools_amd64_archlinux_cpp_v9.5.2237.tar.gz for version 9.5 for arch linux. Additional source on the topic: github.com/google/or-tools/issues/3457Purplish

© 2022 - 2025 — McMap. All rights reserved.