Submitting a MiniZinc Coursera assignment

Date: 2020-09-27

I’m taking a Basic Modeling for Discrete Optimization course through Coursera, and the first assignment is due today. It was a challenge to run MiniZinc and also submit the assignment.

To summarize the problems:

Installing MiniZinc

MiniZinc couldn’t build from source, so I installed the binary AppImage. Since it’s untrusted, I set it up to run as separate user named grencez-for-games, which was created in a previous article. The username does make some sense as MiniZinc will be solving puzzles.

Installation was fairly straightforward. I placed the AppImage in an Applications directory, and the installation step just creates some symlinks to it.

sudo -u grencez-for-games -- bash
cd ~/
mkdir -p Applications
wget -P Applications/
chmod u=rwx,go= Applications/MiniZincIDE-2.4.3-x86_64.AppImage
mkdir -p bin
BIN_LOCATION=$HOME/bin ./Applications/MiniZincIDE-2.4.3-x86_64.AppImage install

To quickly run minizinc as my normal user, I made a script /home/grencez/bin/minizinc:


exec sudo -u grencez-for-games -- /home/grencez-for-games/bin/minizinc "$@"

Running MiniZincIDE with OpenSSL 1.0.2 library

I built the shared library for OpenSSL in /home/grencez-for-games/local/opt/openssl-1.0.2/:

sudo -u grencez-for-games -- bash
# Download and put in ~/local/opt/.
wget -O - |
tar -x -z -f - -C ~/local/opt/

cd ~/local/opt/openssl-1.0.2/
make clean
# Configure to build shared libraries.
./config shared

Now we can invoke MiniZincIDE with LD_LIBRARY_PATH set so it finds the OpenSSL shared library. Here is my /home/grencez/bin/MiniZincIDE script:



exec sudo -u "$role" \
  LD_LIBRARY_PATH="/home/$role/local/opt/openssl-1.0.2" \
  -- "/home/$role/bin/MiniZincIDE" "$@"