otoole icon indicating copy to clipboard operation
otoole copied to clipboard

Add HiGHS as a solver

Open trevorb1 opened this issue 1 year ago • 0 comments

Description

In this PR I add functionality to process HiGHS solution files. Specifically, I have:

  • Added a new ReadHighs class as a read strategy
  • Added tests for the ReadHighs class
  • Documented how to use HiGHS (both from the command line and python)

A couple other notes:

  • As described in the original issue, there are a few solution formats to choose from. I went with the one I called HiGHS Format in the ticket (solution style 1 in HiGHS docs). Motivation is that it only requires one file as an argument and has dual values in this file for if we eventually want to extract out these values.
  • Going with solution style 1 requires us to pass in an option file to the solver from the command line. A little cumbersome, but not a big deal (and this is documented!)
  • For processing a HiGHS solution into a wide format dataframe for otoole, I believe we can do most of the processing through highspy, but I chose not to. It is probably a little more efficient to use their package for bulk processing, but then that adds a dependency to otoole
  • Getting the CLI of HiGHS cant be done through a package manager - instead requires installing a binary and setting up environment variables. Therefore, I also provide an example on how to just use highspy and otoole's python API to process a solution file.
  • I strip out zeros from the solution file to be consistent with how we process CPLEX files; however, this is also an open issue! (see issue #214)

Issue Ticket Number

Closes #218

Documentation

I have updated the following pages:

  • Core Functionality with notes on otoole being able to process HiGHS now
  • Examples:
    • Provide instructions on how to install HiGHS CLI
    • Provide instructions on how to install highspy
    • Provide example on how to process HiGHS from command line
    • Provide example on how to process HiGHS from python

Instructions for setting up HiGHS to use from the command line may need to be improved a bit. For example, I had to add HiGHS executable to my .bashrc via the following command, that I did not include:

alias highs="/opt/highs/bin/./highs"
export PATH=$PATH:"/opt/highs/bin/"

I don't think the instructions should necessarily turn into a "how to setup solvers" guide; as there are better resources than otoole for that. However, it can be kinda tedious getting everything working. Additionally, I kinda glossed over install for Windows as I havent done that!

trevorb1 avatar May 03 '24 03:05 trevorb1