draco icon indicating copy to clipboard operation
draco copied to clipboard

Counterexample for `no_stack_with_bar_area_discrete_color` hard constraint

Open light-and-salt opened this issue 5 years ago • 8 comments

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

Screen Shot 2019-06-23 at 6 59 54 PM

light-and-salt avatar Jun 24 '19 02:06 light-and-salt

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.

domoritz avatar Jun 24 '19 03:06 domoritz

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...

light-and-salt avatar Jun 24 '19 04:06 light-and-salt

I don't understand the rule. Also note that you usually want to use > instead of != To break symmetries.

domoritz avatar Jun 24 '19 04:06 domoritz

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.

light-and-salt avatar Jun 24 '19 05:06 light-and-salt

EX and EY are just encodings and you never say that they are the x or y encoding, though.

domoritz avatar Jun 24 '19 05:06 domoritz

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.

light-and-salt avatar Jun 24 '19 05:06 light-and-salt

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(_).

domoritz avatar Jun 24 '19 15:06 domoritz

yup! looks good to me!

light-and-salt avatar Jun 24 '19 17:06 light-and-salt