You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: optimizer.rb
    path of file: ./repos/activecube/lib/activecube/processor
    
    the code of the file until where you have to start completion: module Activecube::Processor
  class Optimizer
    UNLIM_COST = 9999
    MAX_ITERATIONS = 3

    attr_reader :tables_count, :metrics_count, :cost_matrix

    def initialize(cost_matrix)
      @cost_matrix = cost_matrix
     
    
    def gen_reduced_variants
      # reduce size of cost_matrix deleting duplicates
      uniq_rows = []
      rows_indices = {}
      possible_tables = {}
      cost_matrix.each_with_index do |row, i|
        flag = false

        uniq_rows.each_with_index do |u_row, j|
          if u_row.eql? row
            flag = true
            rows_indices[i] = j
          end
        end

        next if flag

        rows_indices[i] = uniq_rows.length
        possible_tables[uniq_rows.length] = row.map.with_index { |c, index| [index, true] if c }.compact.to_h
        uniq_rows.push(row)
      end