Skip to content

Make solver paths customization through environment variables #31

@ryanjoneil

Description

@ryanjoneil

lib/solvers/cbc.rb contains this code for constructing a solver command:

      def solver_command(model_path, solution_path, args)
        ['coin.cbc', model_path] + args + ['printingOptions', 'all', 'solve', 'solution', solution_path]
      end

The 'coin.cbc' part may be different on different platforms. Similarly, lib/solvers/scip.rb uses this code:

      def solver_command(model_path, _solution_path, args)
        ['scip', '-c', "read #{model_path}"] + args +
          ['-c', 'optimize', '-c', 'display solution', '-c', 'display dualsolution', '-c', 'quit']
      end

scip might be in a custom location.

We should use an environment variable to override these default command names. For example,

  • CBC defaults to 'coin.cbc', unless the RAMS_SOLVER_PATH_CBC env var is set to override it.
  • CLP defaults to 'clp', unless the RAMS_SOLVER_PATH_CLP env var is set to override it.
  • etc.

Let's do this for each solver we support.

🤔 Open question: What is the best env var structure?

  • RAMS_SOLVER_PATH_<SOLVER>
  • RAMS_<SOLVER>_SOLVER_PATH

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions