Sha256: f81dcbc28c248aaf171f1c6ed7cf290f06bc6cd1bbdbe55d51c7790b6c584fc1

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

class Solver
  attr_reader :options, :outfile

  def initialize(filename, options)
    @options = options
    @filename = filename
    @outfile = get_output_filename
    raise StandardError.new("Couldn't find solver #{executable}!") if `which #{executable}`.length == 0
    @solver_exists = true
  end

  def get_output_filename
    "/tmp/rulp-#{Random.rand(0..1000)}.sol"
  end

  def store_results(variables)
    puts "Not yet implemented"
  end

  def executable
    self.class.executable
  end

  def solver_exists?
    @solver_exists || false
  end

  def self.exists?
    return `which #{self.executable}`.length != 0
  end
end

require_relative 'cbc'
require_relative 'scip'
require_relative 'glpk'
require_relative 'gurobi'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rulp-0.0.14 lib/solvers/solvers.rb