| 455 | }; |
| 456 | |
| 457 | ColoredMatrixOptions::ColoredMatrixOptions(const char* n) |
| 458 | : Options(n), |
| 459 | _height("height", "Height of matrix", 8), |
| 460 | _width("width", "Width of matrix", 8), |
| 461 | _size("size", "If different from 0, used as both width and height", 0), |
| 462 | _colors("colors", "Maximum number of colors", 4), |
| 463 | _not_all_equal("not-all-equal", "How to implement the not all equals constraint (used in corners model)", |
| 464 | ColoredMatrix::NOT_ALL_EQUAL_NQ), |
| 465 | _same_or_0("same-or-0", "How to implement the same or 0 constraint (used in the decomposed no monochrome rectangle constraint)", |
| 466 | ColoredMatrix::SAME_OR_0_DFA), |
| 467 | _distinct_except_0("distinct-except-0", "How to implement the distinct except 0 constraint (used in the decomposed no monochrome rectangle constraint)", |
| 468 | ColoredMatrix::DISTINCT_EXCEPT_0_DFA), |
| 469 | _no_monochrome_rectangle("no-monochrome-rectangle", "How to implement no monochrome rectangle (used in the rows model)", |
| 470 | ColoredMatrix::NO_MONOCHROME_DFA) |
| 471 | { |
| 472 | add(_height); |
| 473 | add(_width); |
| 474 | add(_size); |
| 475 | add(_colors); |
| 476 | add(_not_all_equal); |
| 477 | add(_same_or_0); |
| 478 | add(_distinct_except_0); |
| 479 | add(_no_monochrome_rectangle); |
| 480 | |
| 481 | // Add search options |
| 482 | _search.add(ColoredMatrix::SEARCH_DFS, "dfs", "Find a solution."); |
| 483 | _search.add(ColoredMatrix::SEARCH_BAB, "bab", "Find an optimal solution."); |
| 484 | _search.value(ColoredMatrix::SEARCH_DFS); |
| 485 | |
| 486 | // Add symmetry options |
| 487 | _symmetry.add(ColoredMatrix::SYMMETRY_NONE, "none", "Don't use symmetry breaking."); |
| 488 | _symmetry.add(ColoredMatrix::SYMMETRY_MATRIX, "matrix", "Order matrix rows and columns"); |
| 489 | _symmetry.add(ColoredMatrix::SYMMETRY_VALUES, "values", "Order values"); |
| 490 | _symmetry.add(ColoredMatrix::SYMMETRY_MATRIX | ColoredMatrix::SYMMETRY_VALUES, |
| 491 | "both", "Order both rows/columns and values"); |
| 492 | _symmetry.value(ColoredMatrix::SYMMETRY_MATRIX); |
| 493 | |
| 494 | // Add model options |
| 495 | _model.add(ColoredMatrix::MODEL_CORNERS, "corner", "Use direct corners model with not-all-equal constraints."); |
| 496 | _model.add(ColoredMatrix::MODEL_ROWS, "rows", "Use model on pairs of rows (same_or_0 and distinct_except_0 constraints)."); |
| 497 | _model.add(ColoredMatrix::MODEL_ROWS | ColoredMatrix::MODEL_CORNERS, |
| 498 | "both", "Use both rows and corners model"); |
| 499 | _model.add(ColoredMatrix::MODEL_COLUMNS, "columns", "Use model on pairs of columns (same_or_0 and distinct_except_0 constraints)."); |
| 500 | _model.add(ColoredMatrix::MODEL_ROWS | ColoredMatrix::MODEL_COLUMNS, |
| 501 | "matrix", "Use both rows and columns model"); |
| 502 | _model.value(ColoredMatrix::MODEL_CORNERS); |
| 503 | |
| 504 | // Add not all equal variants |
| 505 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_NQ, "nq", "Use nq constraint."); |
| 506 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_NAIVE, "naive", "Use naive reified decomposition."); |
| 507 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_REIFIED, "reified", "Use reified decomposition."); |
| 508 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_NVALUES, "nvalues", "Use nvalues."); |
| 509 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_COUNT, "count", "Use count."); |
| 510 | _not_all_equal.add(ColoredMatrix::NOT_ALL_EQUAL_DFA, "dfa", "Use dfa."); |
| 511 | |
| 512 | // Add same or 0 variants |
| 513 | _same_or_0.add(ColoredMatrix::SAME_OR_0_REIFIED, "reified", "Use reified decomposition."); |
| 514 | _same_or_0.add(ColoredMatrix::SAME_OR_0_TUPLE_SET, "tuple-set", "Use tuple set representation."); |