diff --git a/UHyper_Compiler.rb b/UHyper_Compiler.rb index af342d5..c7d03b6 100644 --- a/UHyper_Compiler.rb +++ b/UHyper_Compiler.rb @@ -378,18 +378,18 @@ def compile_problem(domain_name, problem_name, operators, methods, predicates, s # Objects objects.uniq! objects.each {|i| problem_str << "_#{i} = '#{i}'\n" if i.instance_of?(String) and not i.match?(/^-?\d/)} - problem_str << "\n#{namespace = "#{domain_name.capitalize}."}problem(\n # Start\n {\n" + problem_str << "\n#{namespace = "#{domain_name.capitalize}."}problem(\n # Start\n {" # Start predicates.each_key {|i| state[i] ||= []} state.each_with_index {|(k,v),i| - problem_str << " '#{k}' => [" + problem_str << "\n '#{k}' => [" problem_str << "\n [" << v.map! {|obj| obj.map! {|o| o.instance_of?(String) ? o.match?(/^-?\d/) ? "'#{o.to_f}'" : '_' << o : evaluate(o, namespace)}.join(', ')}.join("],\n [") << "]\n " unless v.empty? - problem_str << (state.size.pred == i ? ']' : "],\n") + problem_str << (state.size.pred == i ? ']' : '],') } # Tasks problem_str << "\n },\n # Tasks\n [" << tasks.map! {|task,*terms| "\n ['#{task}'#{terms.map! {|o| o.instance_of?(String) ? o.match?(/^-?\d/) ? ", '#{o.to_f}'" : ', _' << o : ', ' << evaluate(o, namespace)}.join}]"}.join(',') << - "\n ],\n # Debug\n ARGV.first == 'debug',\n # Maximum plans found\n ARGV[1] ? ARGV[1].to_i : -1,\n # Minimum probability for plans\n ARGV[2] ? ARGV[2].to_f : 0#{",\n # Ordered\n false" unless ordered}" + "\n ],\n # Debug\n ARGV.first == 'debug',\n # Maximum plans found\n ARGV[1] ? ARGV[1].to_i : -1,\n # Minimum probability for plans\n ARGV[2] ? ARGV[2].to_f : 0#{",\n # Ordered\n false" if ordered == false}" tasks.unshift(ordered) unless tasks.empty? problem_str.gsub!(/\b-\b/,'_') domain_filename ? "# Generated by Hype\nrequire_relative '#{domain_filename}'\n\n#{problem_str}\n)" : "#{problem_str}\n)"