22#include "absl/container/flat_hash_map.h"
23#include "absl/container/flat_hash_set.h"
34 const std::function<int64_t(
Variable*)>& evaluator) {
40 return evaluator(arg.
Var());
53int64_t EvalAt(
const Argument& arg,
int pos,
54 const std::function<int64_t(
Variable*)>& evaluator) {
60 return evaluator(arg.
VarAt(pos));
72 const std::function<int64_t(
Variable*)>& evaluator) {
73 absl::flat_hash_set<int64_t> visited;
76 if (visited.contains(
value)) {
79 visited.insert(
value);
85bool CheckAlldifferentExcept0(
87 absl::flat_hash_set<int64_t> visited;
93 visited.insert(
value);
100 const std::function<int64_t(
Variable*)>& evaluator) {
101 const int64_t expected = Eval(
ct.
arguments[0], evaluator);
108 return count == expected;
112 const std::function<int64_t(
Variable*)>& evaluator) {
124 const std::function<int64_t(
Variable*)>& evaluator) {
136 const std::function<int64_t(
Variable*)>& evaluator) {
143 return result % 2 == 1;
147 const std::function<int64_t(
Variable*)>& evaluator) {
153 const int64_t shifted_index = Eval(
ct.
arguments[0], evaluator) - 1;
154 const int64_t element = EvalAt(
ct.
arguments[1], shifted_index, evaluator);
155 const int64_t target = Eval(
ct.
arguments[2], evaluator);
156 return element == target;
159bool CheckArrayIntElementNonShifted(
164 const int64_t target = Eval(
ct.
arguments[2], evaluator);
165 return element == target;
168bool CheckArrayVarIntElement(
175 const int64_t shifted_index = Eval(
ct.
arguments[0], evaluator) - 1;
176 const int64_t element = EvalAt(
ct.
arguments[1], shifted_index, evaluator);
177 const int64_t target = Eval(
ct.
arguments[2], evaluator);
178 return element == target;
182 const std::function<int64_t(
Variable*)>& evaluator) {
183 const int64_t expected = Eval(
ct.
arguments[0], evaluator);
190 return count <= expected;
194 const std::function<int64_t(
Variable*)>& evaluator) {
195 const int64_t left = Eval(
ct.
arguments[0], evaluator);
196 const int64_t right = Eval(
ct.
arguments[1], evaluator);
202 const std::function<int64_t(
Variable*)>& evaluator) {
220 const std::function<int64_t(
Variable*)>& evaluator) {
221 const int64_t left = Eval(
ct.
arguments[0], evaluator);
222 const int64_t right = Eval(
ct.
arguments[1], evaluator);
223 return left == 1 - right;
227 const std::function<int64_t(
Variable*)>& evaluator) {
228 const int64_t left = Eval(
ct.
arguments[0], evaluator);
229 const int64_t right = Eval(
ct.
arguments[1], evaluator);
235 const std::function<int64_t(
Variable*)>& evaluator) {
236 const int64_t left = Eval(
ct.
arguments[0], evaluator);
237 const int64_t right = Eval(
ct.
arguments[1], evaluator);
238 const int64_t target = Eval(
ct.
arguments[2], evaluator);
239 return target == (left + right == 1);
243 const std::function<int64_t(
Variable*)>& evaluator) {
247 absl::flat_hash_set<int64_t> visited;
249 for (
int i = 0; i < size; ++i) {
250 const int64_t
next = EvalAt(
ct.
arguments[0], current, evaluator) - base;
251 visited.insert(
next);
254 return visited.size() == size;
258 const std::function<int64_t(
Variable*)>& evaluator) {
268 const std::function<int64_t(
Variable*)>& evaluator) {
269 const int64_t count = ComputeCount(
ct, evaluator);
270 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
271 return count == expected;
275 const std::function<int64_t(
Variable*)>& evaluator) {
276 const int64_t count = ComputeCount(
ct, evaluator);
277 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
278 return count >= expected;
282 const std::function<int64_t(
Variable*)>& evaluator) {
283 const int64_t count = ComputeCount(
ct, evaluator);
284 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
285 return count > expected;
289 const std::function<int64_t(
Variable*)>& evaluator) {
290 const int64_t count = ComputeCount(
ct, evaluator);
291 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
292 return count <= expected;
296 const std::function<int64_t(
Variable*)>& evaluator) {
297 const int64_t count = ComputeCount(
ct, evaluator);
298 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
299 return count < expected;
303 const std::function<int64_t(
Variable*)>& evaluator) {
304 const int64_t count = ComputeCount(
ct, evaluator);
305 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
306 return count != expected;
310 const std::function<int64_t(
Variable*)>& evaluator) {
311 const int64_t count = ComputeCount(
ct, evaluator);
312 const int64_t expected = Eval(
ct.
arguments[2], evaluator);
314 return status == (expected == count);
318 const std::function<int64_t(
Variable*)>& evaluator) {
324 absl::flat_hash_map<int64_t, int64_t> usage;
325 for (
int i = 0; i < size; ++i) {
327 const int64_t duration = EvalAt(
ct.
arguments[1], i, evaluator);
328 const int64_t requirement = EvalAt(
ct.
arguments[2], i, evaluator);
329 for (int64_t t =
start; t <
start + duration; ++t) {
330 usage[t] += requirement;
340 const std::function<int64_t(
Variable*)>& evaluator) {
345 const std::function<int64_t(
Variable*)>& evaluator) {
350 const std::function<int64_t(
Variable*)>& evaluator) {
355 const std::function<int64_t(
Variable*)>& evaluator) {
360 const std::function<int64_t(
Variable*)>& evaluator) {
364bool CheckDisjunctiveStrict(
370 const std::function<int64_t(
Variable*)>& evaluator) {
374std::vector<int64_t> ComputeGlobalCardinalityCards(
376 std::vector<int64_t> cards(Size(
ct.
arguments[1]), 0);
377 absl::flat_hash_map<int64_t, int> positions;
378 for (
int i = 0; i <
ct.
arguments[1].values.size(); ++i) {
381 positions[
value] = i;
385 if (positions.contains(
value)) {
386 cards[positions[
value]]++;
392bool CheckGlobalCardinality(
394 const std::vector<int64_t> cards =
395 ComputeGlobalCardinalityCards(
ct, evaluator);
398 const int64_t card = EvalAt(
ct.
arguments[2], i, evaluator);
399 if (card != cards[i]) {
406bool CheckGlobalCardinalityClosed(
408 const std::vector<int64_t> cards =
409 ComputeGlobalCardinalityCards(
ct, evaluator);
412 const int64_t card = EvalAt(
ct.
arguments[2], i, evaluator);
413 if (card != cards[i]) {
417 int64_t sum_of_cards = 0;
418 for (int64_t card : cards) {
419 sum_of_cards += card;
424bool CheckGlobalCardinalityLowUp(
426 const std::vector<int64_t> cards =
427 ComputeGlobalCardinalityCards(
ct, evaluator);
430 for (
int i = 0; i < cards.size(); ++i) {
431 const int64_t card = cards[i];
439bool CheckGlobalCardinalityLowUpClosed(
441 const std::vector<int64_t> cards =
442 ComputeGlobalCardinalityCards(
ct, evaluator);
445 for (
int i = 0; i < cards.size(); ++i) {
446 const int64_t card = cards[i];
451 int64_t sum_of_cards = 0;
452 for (int64_t card : cards) {
453 sum_of_cards += card;
458bool CheckGlobalCardinalityOld(
461 std::vector<int64_t> cards(size, 0);
468 for (
int i = 0; i < size; ++i) {
469 const int64_t card = EvalAt(
ct.
arguments[1], i, evaluator);
470 if (card != cards[i]) {
478 const std::function<int64_t(
Variable*)>& evaluator) {
479 const int64_t left = Eval(
ct.
arguments[0], evaluator);
480 const int64_t right = Eval(
ct.
arguments[1], evaluator);
481 return std::abs(left) == right;
485 const std::function<int64_t(
Variable*)>& evaluator) {
486 const int64_t left = Eval(
ct.
arguments[0], evaluator);
487 const int64_t right = Eval(
ct.
arguments[1], evaluator);
488 const int64_t target = Eval(
ct.
arguments[2], evaluator);
489 return target == left / right;
493 const std::function<int64_t(
Variable*)>& evaluator) {
494 const int64_t left = Eval(
ct.
arguments[0], evaluator);
495 const int64_t right = Eval(
ct.
arguments[1], evaluator);
496 return left == right;
500 const std::function<int64_t(
Variable*)>& evaluator) {
501 const int64_t left = Eval(
ct.
arguments[0], evaluator);
502 const int64_t right = Eval(
ct.
arguments[1], evaluator);
508 const std::function<int64_t(
Variable*)>& evaluator) {
509 const int64_t left = Eval(
ct.
arguments[0], evaluator);
510 const int64_t right = Eval(
ct.
arguments[1], evaluator);
512 return status == (left == right);
516 const std::function<int64_t(
Variable*)>& evaluator) {
517 const int64_t left = Eval(
ct.
arguments[0], evaluator);
518 const int64_t right = Eval(
ct.
arguments[1], evaluator);
519 return left >= right;
523 const std::function<int64_t(
Variable*)>& evaluator) {
524 const int64_t left = Eval(
ct.
arguments[0], evaluator);
525 const int64_t right = Eval(
ct.
arguments[1], evaluator);
531 const std::function<int64_t(
Variable*)>& evaluator) {
532 const int64_t left = Eval(
ct.
arguments[0], evaluator);
533 const int64_t right = Eval(
ct.
arguments[1], evaluator);
535 return status == (left >= right);
539 const std::function<int64_t(
Variable*)>& evaluator) {
540 const int64_t left = Eval(
ct.
arguments[0], evaluator);
541 const int64_t right = Eval(
ct.
arguments[1], evaluator);
546 const std::function<int64_t(
Variable*)>& evaluator) {
547 const int64_t left = Eval(
ct.
arguments[0], evaluator);
548 const int64_t right = Eval(
ct.
arguments[1], evaluator);
554 const std::function<int64_t(
Variable*)>& evaluator) {
555 const int64_t left = Eval(
ct.
arguments[0], evaluator);
556 const int64_t right = Eval(
ct.
arguments[1], evaluator);
558 return status == (left > right);
562 const std::function<int64_t(
Variable*)>& evaluator) {
563 const int64_t left = Eval(
ct.
arguments[0], evaluator);
564 const int64_t right = Eval(
ct.
arguments[1], evaluator);
565 return left <= right;
569 const std::function<int64_t(
Variable*)>& evaluator) {
570 const int64_t left = Eval(
ct.
arguments[0], evaluator);
571 const int64_t right = Eval(
ct.
arguments[1], evaluator);
577 const std::function<int64_t(
Variable*)>& evaluator) {
578 const int64_t left = Eval(
ct.
arguments[0], evaluator);
579 const int64_t right = Eval(
ct.
arguments[1], evaluator);
581 return status == (left <= right);
585 const std::function<int64_t(
Variable*)>& evaluator) {
586 const int64_t left = Eval(
ct.
arguments[0], evaluator);
587 const int64_t right = Eval(
ct.
arguments[1], evaluator);
592 const std::function<int64_t(
Variable*)>& evaluator) {
593 const int64_t left = Eval(
ct.
arguments[0], evaluator);
594 const int64_t right = Eval(
ct.
arguments[1], evaluator);
600 const std::function<int64_t(
Variable*)>& evaluator) {
601 const int64_t left = Eval(
ct.
arguments[0], evaluator);
602 const int64_t right = Eval(
ct.
arguments[1], evaluator);
604 return status == (left < right);
608 const std::function<int64_t(
Variable*)>& evaluator) {
618 const std::function<int64_t(
Variable*)>& evaluator) {
619 const int64_t left = ComputeIntLin(
ct, evaluator);
620 const int64_t right = Eval(
ct.
arguments[2], evaluator);
621 return left == right;
625 const std::function<int64_t(
Variable*)>& evaluator) {
626 const int64_t left = ComputeIntLin(
ct, evaluator);
627 const int64_t right = Eval(
ct.
arguments[2], evaluator);
633 const std::function<int64_t(
Variable*)>& evaluator) {
634 const int64_t left = ComputeIntLin(
ct, evaluator);
635 const int64_t right = Eval(
ct.
arguments[2], evaluator);
637 return status == (left == right);
641 const std::function<int64_t(
Variable*)>& evaluator) {
642 const int64_t left = ComputeIntLin(
ct, evaluator);
643 const int64_t right = Eval(
ct.
arguments[2], evaluator);
644 return left >= right;
648 const std::function<int64_t(
Variable*)>& evaluator) {
649 const int64_t left = ComputeIntLin(
ct, evaluator);
650 const int64_t right = Eval(
ct.
arguments[2], evaluator);
656 const std::function<int64_t(
Variable*)>& evaluator) {
657 const int64_t left = ComputeIntLin(
ct, evaluator);
658 const int64_t right = Eval(
ct.
arguments[2], evaluator);
660 return status == (left >= right);
664 const std::function<int64_t(
Variable*)>& evaluator) {
665 const int64_t left = ComputeIntLin(
ct, evaluator);
666 const int64_t right = Eval(
ct.
arguments[2], evaluator);
667 return left <= right;
671 const std::function<int64_t(
Variable*)>& evaluator) {
672 const int64_t left = ComputeIntLin(
ct, evaluator);
673 const int64_t right = Eval(
ct.
arguments[2], evaluator);
679 const std::function<int64_t(
Variable*)>& evaluator) {
680 const int64_t left = ComputeIntLin(
ct, evaluator);
681 const int64_t right = Eval(
ct.
arguments[2], evaluator);
683 return status == (left <= right);
687 const std::function<int64_t(
Variable*)>& evaluator) {
688 const int64_t left = ComputeIntLin(
ct, evaluator);
689 const int64_t right = Eval(
ct.
arguments[2], evaluator);
690 return left != right;
694 const std::function<int64_t(
Variable*)>& evaluator) {
695 const int64_t left = ComputeIntLin(
ct, evaluator);
696 const int64_t right = Eval(
ct.
arguments[2], evaluator);
702 const std::function<int64_t(
Variable*)>& evaluator) {
703 const int64_t left = ComputeIntLin(
ct, evaluator);
704 const int64_t right = Eval(
ct.
arguments[2], evaluator);
706 return status == (left != right);
710 const std::function<int64_t(
Variable*)>& evaluator) {
711 const int64_t left = Eval(
ct.
arguments[0], evaluator);
712 const int64_t right = Eval(
ct.
arguments[1], evaluator);
718 const std::function<int64_t(
Variable*)>& evaluator) {
719 const int64_t left = Eval(
ct.
arguments[0], evaluator);
720 const int64_t right = Eval(
ct.
arguments[1], evaluator);
726 const std::function<int64_t(
Variable*)>& evaluator) {
727 const int64_t left = Eval(
ct.
arguments[0], evaluator);
728 const int64_t right = Eval(
ct.
arguments[1], evaluator);
729 const int64_t target = Eval(
ct.
arguments[2], evaluator);
730 return target == left - right;
734 const std::function<int64_t(
Variable*)>& evaluator) {
735 const int64_t left = Eval(
ct.
arguments[0], evaluator);
736 const int64_t right = Eval(
ct.
arguments[1], evaluator);
737 const int64_t target = Eval(
ct.
arguments[2], evaluator);
738 return target == left % right;
742 const std::function<int64_t(
Variable*)>& evaluator) {
743 const int64_t left = Eval(
ct.
arguments[0], evaluator);
744 const int64_t right = Eval(
ct.
arguments[1], evaluator);
745 return left != right;
749 const std::function<int64_t(
Variable*)>& evaluator) {
750 const int64_t left = Eval(
ct.
arguments[0], evaluator);
751 const int64_t right = Eval(
ct.
arguments[1], evaluator);
757 const std::function<int64_t(
Variable*)>& evaluator) {
758 const int64_t left = Eval(
ct.
arguments[0], evaluator);
759 const int64_t right = Eval(
ct.
arguments[1], evaluator);
761 return status == (left != right);
765 const std::function<int64_t(
Variable*)>& evaluator) {
766 const int64_t left = Eval(
ct.
arguments[0], evaluator);
767 const int64_t right = Eval(
ct.
arguments[1], evaluator);
768 return left == -right;
772 const std::function<int64_t(
Variable*)>& evaluator) {
773 const int64_t left = Eval(
ct.
arguments[0], evaluator);
774 const int64_t right = Eval(
ct.
arguments[1], evaluator);
775 const int64_t target = Eval(
ct.
arguments[2], evaluator);
776 return target == left + right;
780 const std::function<int64_t(
Variable*)>& evaluator) {
781 const int64_t left = Eval(
ct.
arguments[0], evaluator);
782 const int64_t right = Eval(
ct.
arguments[1], evaluator);
783 const int64_t target = Eval(
ct.
arguments[2], evaluator);
784 return target == left * right;
788 const std::function<int64_t(
Variable*)>& evaluator) {
794 for (
int i = 0; i < size; ++i) {
795 const int64_t x = EvalAt(
ct.
arguments[0], i, evaluator) - invf_base;
796 const int64_t y = EvalAt(
ct.
arguments[1], i, evaluator) - f_base;
797 if (x < 0 || x >= size || y < 0 || y >= size) {
803 for (
int i = 0; i < size; ++i) {
804 const int64_t fi = EvalAt(
ct.
arguments[0], i, evaluator) - invf_base;
805 const int64_t invf_fi = EvalAt(
ct.
arguments[1], fi, evaluator) - f_base;
815 const std::function<int64_t(
Variable*)>& evaluator) {
818 const int64_t x = EvalAt(
ct.
arguments[0], i, evaluator);
819 const int64_t y = EvalAt(
ct.
arguments[1], i, evaluator);
832 const std::function<int64_t(
Variable*)>& evaluator) {
835 const int64_t x = EvalAt(
ct.
arguments[0], i, evaluator);
836 const int64_t y = EvalAt(
ct.
arguments[1], i, evaluator);
849 const std::function<int64_t(
Variable*)>& evaluator) {
850 const int64_t max_index = Eval(
ct.
arguments[1], evaluator) - 1;
851 const int64_t max_value = EvalAt(
ct.
arguments[0], max_index, evaluator);
853 for (
int i = 0; i < max_index; ++i) {
854 if (EvalAt(
ct.
arguments[0], i, evaluator) >= max_value) {
859 for (
int i = max_index + 1; i < Size(
ct.
arguments[0]); i++) {
860 if (EvalAt(
ct.
arguments[0], i, evaluator) > max_value) {
869 const std::function<int64_t(
Variable*)>& evaluator) {
874 return max_value == Eval(
ct.
arguments[0], evaluator);
878 const std::function<int64_t(
Variable*)>& evaluator) {
879 const int64_t min_index = Eval(
ct.
arguments[1], evaluator) - 1;
880 const int64_t min_value = EvalAt(
ct.
arguments[0], min_index, evaluator);
882 for (
int i = 0; i < min_index; ++i) {
883 if (EvalAt(
ct.
arguments[0], i, evaluator) <= min_value) {
888 for (
int i = min_index + 1; i < Size(
ct.
arguments[0]); i++) {
889 if (EvalAt(
ct.
arguments[0], i, evaluator) < min_value) {
898 const std::function<int64_t(
Variable*)>& evaluator) {
903 return min_value == Eval(
ct.
arguments[0], evaluator);
906bool CheckNetworkFlowConservation(
909 const std::function<int64_t(
Variable*)>& evaluator) {
910 std::vector<int64_t> balance(balance_input.
values);
912 const int num_arcs = Size(arcs) / 2;
913 for (
int arc = 0;
arc < num_arcs;
arc++) {
916 const int64_t flow = EvalAt(flow_vars,
arc, evaluator);
917 balance[
tail] -= flow;
918 balance[
head] += flow;
921 for (
const int64_t
value : balance) {
922 if (
value != 0)
return false;
929 const std::function<int64_t(
Variable*)>& evaluator) {
935 const std::function<int64_t(
Variable*)>& evaluator) {
941 int64_t total_cost = 0;
943 for (
int arc = 0;
arc < num_arcs;
arc++) {
946 total_cost += flow *
cost;
949 return total_cost == Eval(
ct.
arguments[4], evaluator);
953 const std::function<int64_t(
Variable*)>& evaluator) {
954 const int64_t count = Eval(
ct.
arguments[0], evaluator);
955 absl::flat_hash_set<int64_t> all_values;
957 all_values.insert(EvalAt(
ct.
arguments[1], i, evaluator));
960 return count == all_values.size();
964 const std::function<int64_t(
Variable*)>& evaluator) {
969 const std::function<int64_t(
Variable*)>& evaluator) {
974 const std::function<int64_t(
Variable*)>& evaluator) {
980 const std::function<int64_t(
Variable*)>& evaluator) {
986 const std::function<int64_t(
Variable*)>& evaluator) {
993 const std::function<int64_t(
Variable*)>& evaluator) {
994 const int64_t low = Eval(
ct.
arguments[0], evaluator);
995 const int64_t up = Eval(
ct.
arguments[1], evaluator);
996 const int64_t length = Eval(
ct.
arguments[2], evaluator);
998 int64_t sliding_sum = 0;
999 for (
int i = 0; i < std::min<int64_t>(length, Size(
ct.
arguments[3])); ++i) {
1000 sliding_sum += EvalAt(
ct.
arguments[3], i, evaluator);
1002 if (sliding_sum < low || sliding_sum > up) {
1005 for (
int i = length; i < Size(
ct.
arguments[3]); ++i) {
1006 sliding_sum += EvalAt(
ct.
arguments[3], i, evaluator) -
1008 if (sliding_sum < low || sliding_sum > up) {
1016 const std::function<int64_t(
Variable*)>& evaluator) {
1018 absl::flat_hash_map<int64_t, int> init_count;
1019 absl::flat_hash_map<int64_t, int> sorted_count;
1021 init_count[EvalAt(
ct.
arguments[0], i, evaluator)]++;
1022 sorted_count[EvalAt(
ct.
arguments[1], i, evaluator)]++;
1024 if (init_count != sorted_count) {
1027 for (
int i = 0; i < Size(
ct.
arguments[1]) - 1; ++i) {
1037 const std::function<int64_t(
Variable*)>& evaluator) {
1038 absl::flat_hash_set<int64_t> visited;
1041 int64_t current = -1;
1044 if (
next != i && current == -1) {
1046 }
else if (
next == i) {
1047 visited.insert(
next);
1052 const int residual_size = Size(
ct.
arguments[0]) - visited.size();
1053 for (
int i = 0; i < residual_size; ++i) {
1054 const int64_t
next = EvalAt(
ct.
arguments[0], current, evaluator) - base;
1055 visited.insert(
next);
1056 if (
next == current) {
1067 const std::function<int64_t(
Variable*)>& evaluator) {
1071bool CheckSymmetricAllDifferent(
1074 for (
int i = 0; i < size; ++i) {
1076 if (value < 0 || value >= size) {
1079 const int64_t reverse_value = EvalAt(
ct.
arguments[0],
value, evaluator) - 1;
1080 if (reverse_value != i) {
1088 absl::flat_hash_map<std::string,
1090 std::function<int64_t(
Variable*)>)>>;
1099CallMap CreateCallMap() {
1101 m[
"fzn_all_different_int"] = CheckAllDifferentInt;
1102 m[
"alldifferent_except_0"] = CheckAlldifferentExcept0;
1103 m[
"among"] = CheckAmong;
1104 m[
"array_bool_and"] = CheckArrayBoolAnd;
1105 m[
"array_bool_element"] = CheckArrayIntElement;
1106 m[
"array_bool_or"] = CheckArrayBoolOr;
1107 m[
"array_bool_xor"] = CheckArrayBoolXor;
1108 m[
"array_int_element"] = CheckArrayIntElement;
1109 m[
"array_int_element_nonshifted"] = CheckArrayIntElementNonShifted;
1110 m[
"array_var_bool_element"] = CheckArrayVarIntElement;
1111 m[
"array_var_int_element"] = CheckArrayVarIntElement;
1112 m[
"at_most_int"] = CheckAtMostInt;
1113 m[
"bool_and"] = CheckBoolAnd;
1114 m[
"bool_clause"] = CheckBoolClause;
1115 m[
"bool_eq"] = CheckIntEq;
1116 m[
"bool2int"] = CheckIntEq;
1117 m[
"bool_eq_imp"] = CheckIntEqImp;
1118 m[
"bool_eq_reif"] = CheckIntEqReif;
1119 m[
"bool_ge"] = CheckIntGe;
1120 m[
"bool_ge_imp"] = CheckIntGeImp;
1121 m[
"bool_ge_reif"] = CheckIntGeReif;
1122 m[
"bool_gt"] = CheckIntGt;
1123 m[
"bool_gt_imp"] = CheckIntGtImp;
1124 m[
"bool_gt_reif"] = CheckIntGtReif;
1125 m[
"bool_le"] = CheckIntLe;
1126 m[
"bool_le_imp"] = CheckIntLeImp;
1127 m[
"bool_le_reif"] = CheckIntLeReif;
1128 m[
"bool_left_imp"] = CheckIntLe;
1129 m[
"bool_lin_eq"] = CheckIntLinEq;
1130 m[
"bool_lin_le"] = CheckIntLinLe;
1131 m[
"bool_lt"] = CheckIntLt;
1132 m[
"bool_lt_imp"] = CheckIntLtImp;
1133 m[
"bool_lt_reif"] = CheckIntLtReif;
1134 m[
"bool_ne"] = CheckIntNe;
1135 m[
"bool_ne_imp"] = CheckIntNeImp;
1136 m[
"bool_ne_reif"] = CheckIntNeReif;
1137 m[
"bool_not"] = CheckBoolNot;
1138 m[
"bool_or"] = CheckBoolOr;
1139 m[
"bool_right_imp"] = CheckIntGe;
1140 m[
"bool_xor"] = CheckBoolXor;
1141 m[
"ortools_circuit"] = CheckCircuit;
1142 m[
"count_eq"] = CheckCountEq;
1143 m[
"count"] = CheckCountEq;
1144 m[
"count_geq"] = CheckCountGeq;
1145 m[
"count_gt"] = CheckCountGt;
1146 m[
"count_leq"] = CheckCountLeq;
1147 m[
"count_lt"] = CheckCountLt;
1148 m[
"count_neq"] = CheckCountNeq;
1149 m[
"count_reif"] = CheckCountReif;
1150 m[
"fzn_cumulative"] = CheckCumulative;
1151 m[
"var_cumulative"] = CheckCumulative;
1152 m[
"variable_cumulative"] = CheckCumulative;
1153 m[
"fixed_cumulative"] = CheckCumulative;
1154 m[
"fzn_diffn"] = CheckDiffn;
1155 m[
"diffn_k_with_sizes"] = CheckDiffnK;
1156 m[
"fzn_diffn_nonstrict"] = CheckDiffnNonStrict;
1157 m[
"diffn_nonstrict_k_with_sizes"] = CheckDiffnNonStrictK;
1158 m[
"disjunctive"] = CheckDisjunctive;
1159 m[
"disjunctive_strict"] = CheckDisjunctiveStrict;
1160 m[
"false_constraint"] = CheckFalseConstraint;
1161 m[
"global_cardinality"] = CheckGlobalCardinality;
1162 m[
"global_cardinality_closed"] = CheckGlobalCardinalityClosed;
1163 m[
"global_cardinality_low_up"] = CheckGlobalCardinalityLowUp;
1164 m[
"global_cardinality_low_up_closed"] = CheckGlobalCardinalityLowUpClosed;
1165 m[
"global_cardinality_old"] = CheckGlobalCardinalityOld;
1166 m[
"int_abs"] = CheckIntAbs;
1167 m[
"int_div"] = CheckIntDiv;
1168 m[
"int_eq"] = CheckIntEq;
1169 m[
"int_eq_imp"] = CheckIntEqImp;
1170 m[
"int_eq_reif"] = CheckIntEqReif;
1171 m[
"int_ge"] = CheckIntGe;
1172 m[
"int_ge_imp"] = CheckIntGeImp;
1173 m[
"int_ge_reif"] = CheckIntGeReif;
1174 m[
"int_gt"] = CheckIntGt;
1175 m[
"int_gt_imp"] = CheckIntGtImp;
1176 m[
"int_gt_reif"] = CheckIntGtReif;
1177 m[
"int_le"] = CheckIntLe;
1178 m[
"int_le_imp"] = CheckIntLeImp;
1179 m[
"int_le_reif"] = CheckIntLeReif;
1180 m[
"int_lin_eq"] = CheckIntLinEq;
1181 m[
"int_lin_eq_imp"] = CheckIntLinEqImp;
1182 m[
"int_lin_eq_reif"] = CheckIntLinEqReif;
1183 m[
"int_lin_ge"] = CheckIntLinGe;
1184 m[
"int_lin_ge_imp"] = CheckIntLinGeImp;
1185 m[
"int_lin_ge_reif"] = CheckIntLinGeReif;
1186 m[
"int_lin_le"] = CheckIntLinLe;
1187 m[
"int_lin_le_imp"] = CheckIntLinLeImp;
1188 m[
"int_lin_le_reif"] = CheckIntLinLeReif;
1189 m[
"int_lin_ne"] = CheckIntLinNe;
1190 m[
"int_lin_ne_imp"] = CheckIntLinNeImp;
1191 m[
"int_lin_ne_reif"] = CheckIntLinNeReif;
1192 m[
"int_lt"] = CheckIntLt;
1193 m[
"int_lt_imp"] = CheckIntLtImp;
1194 m[
"int_lt_reif"] = CheckIntLtReif;
1195 m[
"int_max"] = CheckIntMax;
1196 m[
"int_min"] = CheckIntMin;
1197 m[
"int_minus"] = CheckIntMinus;
1198 m[
"int_mod"] = CheckIntMod;
1199 m[
"int_ne"] = CheckIntNe;
1200 m[
"int_ne_imp"] = CheckIntNeImp;
1201 m[
"int_ne_reif"] = CheckIntNeReif;
1202 m[
"int_negate"] = CheckIntNegate;
1203 m[
"int_plus"] = CheckIntPlus;
1204 m[
"int_times"] = CheckIntTimes;
1205 m[
"ortools_inverse"] = CheckInverse;
1206 m[
"lex_less_bool"] = CheckLexLessInt;
1207 m[
"lex_less_int"] = CheckLexLessInt;
1208 m[
"lex_lesseq_bool"] = CheckLexLesseqInt;
1209 m[
"lex_lesseq_int"] = CheckLexLesseqInt;
1210 m[
"maximum_arg_int"] = CheckMaximumArgInt;
1211 m[
"maximum_int"] = CheckMaximumInt;
1212 m[
"array_int_maximum"] = CheckMaximumInt;
1213 m[
"minimum_arg_int"] = CheckMinimumArgInt;
1214 m[
"minimum_int"] = CheckMinimumInt;
1215 m[
"array_int_minimum"] = CheckMinimumInt;
1216 m[
"ortools_network_flow"] = CheckNetworkFlow;
1217 m[
"ortools_network_flow_cost"] = CheckNetworkFlowCost;
1218 m[
"nvalue"] = CheckNvalue;
1219 m[
"ortools_regular"] = CheckRegular;
1220 m[
"regular_nfa"] = CheckRegularNfa;
1221 m[
"set_in"] = CheckSetIn;
1222 m[
"int_in"] = CheckSetIn;
1223 m[
"set_not_in"] = CheckSetNotIn;
1224 m[
"int_not_in"] = CheckSetNotIn;
1225 m[
"set_in_reif"] = CheckSetInReif;
1226 m[
"sliding_sum"] = CheckSlidingSum;
1227 m[
"sort"] = CheckSort;
1228 m[
"ortools_subcircuit"] = CheckSubCircuit;
1229 m[
"symmetric_all_different"] = CheckSymmetricAllDifferent;
1230 m[
"ortools_table_bool"] = CheckTableInt;
1231 m[
"ortools_table_int"] = CheckTableInt;
1238 const std::function<int64_t(
Variable*)>& evaluator,
1241 const CallMap call_map = CreateCallMap();
1244 const auto& checker = call_map.at(
ct->
type);
1245 if (!checker(*
ct, evaluator)) {
#define CHECK_EQ(val1, val2)
bool CheckSolution(const Model &model, const std::function< int64_t(Variable *)> &evaluator, SolverLogger *logger)
Collection of objects used to extend the Constraint Solver library.
Variable * VarAt(int pos) const
std::string DebugString() const
std::vector< Variable * > variables
std::vector< int64_t > values
int64_t ValueAt(int pos) const
std::string DebugString() const
std::vector< Argument > arguments
#define SOLVER_LOG(logger,...)