Commit 6809ab10 authored by Luc Libralesso's avatar Luc Libralesso
Browse files

correct bug in abstraction model writing

parent 4bffb6b5
......@@ -13,7 +13,7 @@ require "pry"
class TestWriterGraphviz < Minitest::Unit::TestCase
def test_a()
dag = Midori128_Dag.new(nb_rounds=3)
dag = Midori128_Dag.new(nb_rounds=4)
model = get_abstract_constraint_model(dag)
file = File.open("test.mzn", "w")
file.puts(Minizinc.new.generate_code(model))
......
......@@ -10,7 +10,7 @@ def get_abstract_constraint_model(dag)
variable_dict = {} # Atom -> Variable
# add atoms as booleans
atoms.each do |atom|
var = Variable.new(atom.name, 0..1, atom.value)
var = Variable.new(atom.name, 0..1, atom.value != nil ? 0 : nil)
variable_dict[atom] = var
model.add_variables(var)
end
......@@ -61,4 +61,8 @@ def get_abstract_constraint_model(dag)
)
model.add_instructions(Instruction.new("solve minimize obj"))
return model
end
\ No newline at end of file
end
# def add_diff_variables()
# end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment