Class: Problem::FSP::Schedule
- Inherits:
-
Object
- Object
- Problem::FSP::Schedule
- Defined in:
- lib/opt_alg_framework/problem/fsp.rb
Overview
Inner class who represents the production schedule, that is, a matrix were the rows are the tasks and the columns the machines.
Instance Attribute Summary collapse
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
Instance Method Summary collapse
-
#build_from_file(path, transpose) ⇒ Object
Fill the schedule reading the an instance from a file.
-
#reorder_schedule(tasks_sequence) ⇒ Object
Given a sequence of tasks, reorder the schedule in this sequence.
Instance Attribute Details
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
10 11 12 |
# File 'lib/opt_alg_framework/problem/fsp.rb', line 10 def schedule @schedule end |
Instance Method Details
#build_from_file(path, transpose) ⇒ Object
Fill the schedule reading the an instance from a file
13 14 15 16 17 18 19 |
# File 'lib/opt_alg_framework/problem/fsp.rb', line 13 def build_from_file(path, transpose) rows = Array.new File.foreach(path).each do |line| rows << line.split(" ").collect{ |e| e.to_i } end @schedule = transpose ? Matrix.rows(rows).transpose : Matrix.rows(rows) end |
#reorder_schedule(tasks_sequence) ⇒ Object
Given a sequence of tasks, reorder the schedule in this sequence
22 23 24 25 26 27 28 |
# File 'lib/opt_alg_framework/problem/fsp.rb', line 22 def reorder_schedule(tasks_sequence) rows = Array.new tasks_sequence.each do |task| rows << @schedule.row(task) end Matrix.rows(rows) end |