Skip to content

Instantly share code, notes, and snippets.

@daynebatten
Created May 21, 2015 18:31
Show Gist options
  • Select an option

  • Save daynebatten/f620a0a66a385dde993c to your computer and use it in GitHub Desktop.

Select an option

Save daynebatten/f620a0a66a385dde993c to your computer and use it in GitHub Desktop.
/* These decisions variables govern whether we suppress 0 or 2+ cells within each grouping constraint */
var choose_zero {con_set} binary;
/* For each grouping constraint, we must have 0 cells suppressed if we're choosing to have 0 cells suppressed */
con zero_con {i in con_set}: (sum{j in dec_set} choices[j] * constraints[i, j]) - (1 - choose_zero[i]) * 100000000000 <= 0;
/* For each grouping constraint, we must have 2+ cells suppressed if we're choosing to have 2+ cells supppressed */
con two_more_con {i in con_set}: (sum{j in dec_set} choices[j] * constraints[i, j]) + choose_zero[i] * 100000000000 >= 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment