The software for the course, including roughly the week it is first used, consists of:

  • python3 (3.10): week 2
  • PuLP (2.6) + cbc (2.10): week 2

The School of Computing (SoCo) Linux image is running the above software versions. We will only be testing your assignment code on these versions, so if you are using your own installation, make sure you test your code also runs correctly on the SoCo Linux environment prior to submission.

Environments

Your options include:

  • The SoCo Linux Labs in the CSIT and Hanna Neumann buildings.
  • Remote SoCo Linux access via the Virtual Desktop Infrastructure (VDI).
  • A locally run Virtual Machine (VM) running the SoCo Linux image.
  • SSH to the partch student server running SoCo Linux image.
  • Installing required software natively on your computer.

For those that can’t access the campus in person, the VDI and VM options, while taking a little to get up and running, will ensure you have consistent packages and versions installed. We strongly recommend you at least get the VDI up and running as a backup, in case you have problems close to a deadline. A native install will likely be the most convenient for many. However, we can’t help troubleshoot bespoke setups so consider using one of the other options if you run into trouble with a native setup.

Virtual Machine

This option is to locally run a virtual machine of the current SoCo Ubuntu image. Unlike the VDI, once you get set up you don’t need a persistent internet connection. However, it is generally more resource intensive, in particular it requires significant amounts of RAM (if you plan on running anything else on host your machine at the same time as this VM, I recommend at least 8GB of RAM).

The easiest option is to install virtualbox on your host machine, download the image, boot it up inside virtualbox, and then run the following command to get the software required for the course:

sudo apt-get update
sudo apt-get install comp4691

SSH to Partch

Students can remotely SSH into partch.anu.edu.au which is a server running the SoCo Linux image.

One tip is to add the following to your ~/.ssh/config file on your local machine:

Host partch
    User uXXXXXXX
    HostName partch.anu.edu.au

You can then simply SSH with:

ssh partch

If your host OS supports it, you can use the -X option to tunnel an X-session, enabling you to run software with a GUI (although expect lag).

One easy way to transfer / synchronise files between your local machine and a remote over SSH is to use rsync, e.g.:

rsync local-file-to-copy partch:path/to/put/file/

I recommend using a terminal multiplexer such as tmux (which is available on partch) if you plan on spending any significant time working through a terminal over SSH.

Native

PuLP

Follow the PuLP installation instructions for your operating system. We only need the provided cbc backend solver, follow the directions to enable it.

There are some alternatives approaches if the official ones don’t work for your setup. My recommendation is to use poetry, but I’ll also list a few others.

Poetry

Finally a good tool for managing dependencies in python.

A quick tutorial on Linux for setting up a project in a new directory:

mkdir project
cd project
poetry init          # intialising directory, answer questions
poetry add pulp      # adding and installing pulp dependecy 
poetry run pulptest  # running the tests to see installed solvers
poetry run python    # start an interactive python prompt
>>> import pulp      # attempting to import pulp

If you then create another project, you can just copy over the pyproject.toml file to get the same dependencies. Then run:

poetry install

If you want to use a different version of python from what you have installed, you can try out pyenv.

Anaconda

Install PuLP from terminal:

conda install -c conda-forge pulp

Then to test, go to your python console (like python console in codium or Anaconda), type:

import pulp

Warning: I’ve had reports that the conda pulp doesn’t include cbc built-in and so will default to the glpk solver. If you independently have cbc installed and the binary on your path it should be OK, otherwise this might not be a solution for this course.

Ubuntu

Ubuntu has some apt packages we can utilise:

sudo apt-get update
sudo apt-get install coinor-cbc python3-pulp

This version of pulp is a bit out of date so it might lack some of the features you might see us use, but mostly it should work (remember to make sure your code runs on the VDI or partch before submitting anything).

Basic Usage

PuLP

The SoCo Linux image has PuLP installed in the system-wide python 3 environment. You can edit your python scripts using gedit, vim or emacs, and then run it from the command line using python3. If you prefer an IDE then codium (open source VSCode) is installed on the system. There may be various other IDEs suitable for python on the SoCo Linux image (e.g., spyder, PyCharm). If you want to use them, you’ll likely need to configure them so that they point to the /usr/bin/python3 environment (under which PuLP is setup) rather than the Anaconda or some other environment.

Codium

If it is your first time using it, you will likely want to install the python extension. After installing the extension, open up a python file and check that the python interpreter is /usr/bin/python3 by hovering the mouse over the bottom left corner of the window where it says Python.

Command line usage

Run file:

python3 file-to-run-that-imports-pulp.py

Updated:    23 Jul 2024 / Responsible Officer:    Director, School of Computing / Page Contact:    Felipe Trevizan