Class: Solver
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(filename, options) ⇒ Solver
Returns a new instance of Solver.
4
5
6
7
8
9
10
|
# File 'lib/solvers/solvers.rb', line 4
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
|
Instance Attribute Details
Returns the value of attribute options.
2
3
4
|
# File 'lib/solvers/solvers.rb', line 2
def options
@options
end
|
Returns the value of attribute outfile.
2
3
4
|
# File 'lib/solvers/solvers.rb', line 2
def outfile
@outfile
end
|
Class Method Details
.exists? ⇒ Boolean
28
29
30
|
# File 'lib/solvers/solvers.rb', line 28
def self.exists?
return `which #{self.executable}`.length != 0
end
|
Instance Method Details
#executable ⇒ Object
20
21
22
|
# File 'lib/solvers/solvers.rb', line 20
def executable
self.class.executable
end
|
#get_output_filename ⇒ Object
12
13
14
|
# File 'lib/solvers/solvers.rb', line 12
def get_output_filename
"/tmp/rulp-#{Random.rand(0..1000)}.sol"
end
|
#solver_exists? ⇒ Boolean
24
25
26
|
# File 'lib/solvers/solvers.rb', line 24
def solver_exists?
@solver_exists || false
end
|
#store_results(variables) ⇒ Object
16
17
18
|
# File 'lib/solvers/solvers.rb', line 16
def store_results(variables)
puts "Not yet implemented"
end
|