Module: Rulp
- Defined in:
- lib/helpers/log.rb,
lib/rulp/rulp.rb,
lib/rulp/rulp_bounds.rb,
lib/rulp/rulp_initializers.rb
Overview
Basic logger module. Allows logging in the format
“This is a string”.log(:debug) “Oh no!”.log(:error)
Log level is set as follows. Rulp::Logger::level = :debug
Defined Under Namespace
Modules: Bounds, Initializers, Logger
Classes: Problem
Constant Summary
collapse
- MIN =
"Minimize"
- MAX =
"Maximize"
- GLPK =
::GLPK
- GUROBI =
::GUROBI
- SCIP =
::SCIP
- CBC =
::CBC
- PSCIP =
::PSCIP
- PCBC =
::PCBC
- SOLVERS =
{
GLPK => Glpk,
SCIP => Scip,
PSCIP => PScip,
PCBC => PCbc,
CBC => Cbc,
GUROBI => Gurobi,
}
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Attribute Details
#expressions ⇒ Object
Returns the value of attribute expressions.
21
22
23
|
# File 'lib/rulp/rulp.rb', line 21
def expressions
@expressions
end
|
Class Method Details
.Cbc(lp, opts = {}) ⇒ Object
45
46
47
|
# File 'lib/rulp/rulp.rb', line 45
def self.Cbc(lp, opts={})
lp.solve_with(CBC, opts)
end
|
.Glpk(lp, opts = {}) ⇒ Object
41
42
43
|
# File 'lib/rulp/rulp.rb', line 41
def self.Glpk(lp, opts={})
lp.solve_with(GLPK, opts) rescue nil
end
|
.Gurobi(lp, opts = {}) ⇒ Object
65
66
67
|
# File 'lib/rulp/rulp.rb', line 65
def self.Gurobi(lp, opts={})
lp.solve_with(GUROBI, opts) rescue nil
end
|
.Max(objective_expression) ⇒ Object
69
70
71
72
|
# File 'lib/rulp/rulp.rb', line 69
def self.Max(objective_expression)
"Creating maximization problem".log :info
Problem.new(Rulp::MAX, objective_expression)
end
|
.Min(objective_expression) ⇒ Object
74
75
76
77
|
# File 'lib/rulp/rulp.rb', line 74
def self.Min(objective_expression)
"Creating minimization problem".log :info
Problem.new(Rulp::MIN, objective_expression)
end
|
.Pcbc(lp, opts = {}) ⇒ Object
53
54
55
|
# File 'lib/rulp/rulp.rb', line 53
def self.Pcbc(lp, opts={})
lp.solve_with(PCBC, opts) rescue nil
end
|
.Pscip(lp, opts = {}) ⇒ Object
57
58
59
|
# File 'lib/rulp/rulp.rb', line 57
def self.Pscip(lp, opts={})
lp.solve_with(PSCIP, opts) rescue nil
end
|
.Scip(lp, opts = {}) ⇒ Object
49
50
51
|
# File 'lib/rulp/rulp.rb', line 49
def self.Scip(lp, opts={})
lp.solve_with(SCIP, opts) rescue nil
end
|
.solver_exists?(solver_name) ⇒ Boolean
79
80
81
82
83
|
# File 'lib/rulp/rulp.rb', line 79
def self.solver_exists?(solver_name)
solver = solver_name[0].upcase + solver_name[1..-1].downcase
solver_class = ObjectSpace.const_defined?(solver) && ObjectSpace.const_get(solver)
solver_class.exists? if(solver_class)
end
|