draco
draco copied to clipboard
Counterexample for `no_stack_with_bar_area_discrete_color` hard constraint
I have a counterexample for the no_stack_with_bar_area_discrete_color
hard constraint :P
https://github.com/uwdata/draco/blob/d89bc0b0466cb766a663a65b9dc1bc8550bf0244/asp/hard.lp#L150

Adding stack doesn't hurt in this case, though, right?
I guess we can make an exception when the color field is the same as the categorical field.
Or we can make the rule a bit more specific like
hard(no_stack_with_bar_area_discrete_color,E)
:- mark(bar;area), channel(E,color), discrete(E),
field(E,F), field(EX,FX), field(EY, FY), F != FX, F != FY,
not stack(_).
Hmm... this is a bit verbose...
I don't understand the rule. Also note that you usually want to use > instead of != To break symmetries.
F != FX, F != FY,
is my ugly way of saying that the color field is not the same as the x field and it's also not the same as the y field
I guess I could revise the rule to make it a bit more readable:
hard(no_stack_with_bar_area_discrete_color,E)
:- mark(bar;area), channel(E,color), discrete(E), not redundant_color(E), not stack(_).
redundant_color(E) :- channel(E,color), field(E,F), field(EX,FX), F = FX.
redundant_color(E) :- channel(E,color), field(E,F), field(EY,FY), F = FY.
EX and EY are just encodings and you never say that they are the x or y encoding, though.
Right, so it should be
hard(no_stack_with_bar_area_discrete_color,E)
:- mark(bar;area), channel(E,color), discrete(E), not redundant_color(E), not stack(_).
redundant_color(E) :- channel(E,color), field(E,F), channel(EX, x), field(EX,FX), F = FX.
redundant_color(E) :- channel(E,color), field(E,F), channel(EY, y), field(EY,FY), F = FY.
This should be the same as this, right?
hard(no_stack_with_bar_area_discrete_color,E)
:- mark(bar;area), channel(E,color), discrete(E), field(E,F), field(EE,F) not channel(EE,x), not channel(EE,y), not stack(_).
yup! looks good to me!