dep-selector-libgecode 1.0.0.alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +20 -0
- data/dep-selector-libgecode.gemspec +25 -0
- data/ext/libgecode3/Makefile +8 -0
- data/ext/libgecode3/extconf.rb +57 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/LICENSE +25 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/Makefile.contribs +88 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/Makefile.dep +11307 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/Makefile.in +1795 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/changelog.in +6132 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/configure +13054 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/configure.ac +356 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/configure.ac.in +352 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/README +26 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/AbstractWorker.hh +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Doxyfile +263 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Makefile.in.in +162 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/OptVar.cc +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/OptVar.hh +124 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/QCOPPlus.cc +306 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/QCOPPlus.hh +166 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/QCSPPlusUnblockable.cc +239 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/QCSPPlusUnblockable.hh +140 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/README +6 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Strategy.cc +253 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Strategy.hh +112 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/StrategyNode.cc +59 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/StrategyNode.hh +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/UnblockableBranching.hh +34 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/UnblockableViewValBranching.cc +61 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/UnblockableViewValBranching.hh +45 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Work.cc +48 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Work.hh +64 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/WorkComparators.hh +67 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/WorkManager.cc +376 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/WorkManager.hh +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Worker.cc +285 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/Worker.hh +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/clean +5 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/configure +2637 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/configure.ac +44 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/myDom.cc +59 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/myspace.cc +119 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/myspace.hh +79 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qecode.hh +56 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_parallel.cc +41 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_parallel.hh +43 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_qcop.cc +268 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_qcop.hh +56 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_qcsp.cc +163 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_qcsp.hh +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_unblockable.cc +423 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/qsolver_unblockable.hh +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/shortdesc.ac +1 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/contribs/qecode/vartype.hh +31 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/doxygen/doxygen.conf.in +1245 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/doxygen/doxygen.hh.in +594 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/all-interval.cpp +136 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/alpha.cpp +151 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/bacp.cpp +596 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/bibd.cpp +182 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/bin-packing.cpp +25363 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/black-hole.cpp +413 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/car-sequencing.cpp +653 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/crew.cpp +269 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/crossword.cpp +3954 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/crowded-chess.cpp +424 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/dominating-queens.cpp +170 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/domino.cpp +346 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/donald.cpp +135 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/efpa.cpp +323 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/eq20.cpp +128 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/golf.cpp +190 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/golomb-ruler.cpp +157 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/graph-color.cpp +425 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/grocery.cpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/hamming.cpp +144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/ind-set.cpp +144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/kakuro.cpp +627 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/knights.cpp +430 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/langford-number.cpp +218 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/magic-sequence.cpp +133 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/magic-square.cpp +141 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/minesweeper.cpp +311 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/money.cpp +132 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/nonogram.cpp +1215 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/open-shop.cpp +412 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/ortho-latin.cpp +183 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/partition.cpp +145 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/pentominoes.cpp +952 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/perfect-square.cpp +317 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/photo.cpp +166 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/queen-armies.cpp +335 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/queens.cpp +214 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/radiotherapy.cpp +943 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/sat.cpp +260 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/schurs-lemma.cpp +142 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/scowl.hpp +14149 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/sports-league.cpp +353 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/steel-mill.cpp +654 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/steiner.cpp +170 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/sudoku.cpp +2294 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/tsp.cpp +339 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/warehouses.cpp +185 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/examples/word-square.cpp +168 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode.m4 +1272 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/driver.hh +602 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/driver/options.cpp +435 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/driver/options.hpp +418 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/driver/script.cpp +104 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/driver/script.hpp +388 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc.hh +417 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/CHANGES +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/ast.hh +492 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/conexpr.hh +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/exampleplugin/myplugin.cpp +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/exampleplugin/myplugin.hh +47 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/exampleplugin/myplugin.pro +51 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/exampleplugin/test_myplugin.fzn +1 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/flatzinc.cpp +1056 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/lexer.lxx +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/lexer.yy.cpp +2458 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/all_different_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/all_equal_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/among.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/at_least_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/at_least_set.mzn +38 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/at_most_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/at_most_set.mzn +38 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/bin_packing.mzn +44 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/bin_packing_capa.mzn +45 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/bin_packing_load.mzn +45 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/circuit.mzn +40 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/count.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/cumulative.mzn +53 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/decreasing_bool.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/decreasing_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/diffn.mzn +44 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/disjoint.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/distribute.mzn +46 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/exactly_int.mzn +40 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/exactly_set.mzn +38 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/gecode.mzn +98 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/global_cardinality.mzn +43 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/global_cardinality_closed.mzn +39 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/global_cardinality_low_up.mzn +40 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/global_cardinality_low_up_closed.mzn +40 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/increasing_bool.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/increasing_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/int_set_channel.mzn +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/inverse.mzn +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/lex_less_int.mzn +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/lex_lesseq_int.mzn +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/link_set_to_booleans.mzn +47 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/maximum_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/member_bool.mzn +41 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/member_int.mzn +41 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/minimum_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/nvalue.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/partition_set.mzn +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/precedence.mzn +41 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/range.mzn +51 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/redefinitions.mzn +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/regular.mzn +38 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/roots.mzn +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/sort.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/sum_pred.mzn +42 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/table_bool.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/mznlib/table_int.mzn +37 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/option.hh +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/parser.hh +265 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/parser.tab.cpp +3571 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/parser.tab.hh +164 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/parser.yxx +1604 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/plugin.hh +83 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/registry.cpp +1812 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/registry.hh +71 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/symboltable.hh +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/flatzinc/varspec.hh +163 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist.hh +298 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/drawingcursor.cpp +288 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/drawingcursor.hh +110 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/drawingcursor.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/gecodelogo.cpp +673 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/gecodelogo.hh +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/gist.cpp +120 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/gist.hpp +207 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/layoutcursor.hh +69 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/layoutcursor.hpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/mainwindow.cpp +341 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/mainwindow.hh +129 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/node.cpp +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/node.hh +160 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/node.hpp +210 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodecursor.hh +215 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodecursor.hpp +271 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodestats.cpp +138 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodestats.hh +81 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodevisitor.hh +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodevisitor.hpp +126 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodewidget.cpp +90 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/nodewidget.hh +59 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/preferences.cpp +190 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/preferences.hh +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/qtgist.cpp +809 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/qtgist.hh +294 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/spacenode.cpp +369 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/spacenode.hh +221 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/spacenode.hpp +191 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/standalone-example/mygist.cpp +80 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/standalone-example/standalone_example.pro +18 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/stopbrancher.cpp +90 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/stopbrancher.hh +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/textoutput.cpp +175 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/textoutput.hh +75 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/treecanvas.cpp +1430 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/treecanvas.hh +369 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/visualnode.cpp +473 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/visualnode.hh +237 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/visualnode.hpp +220 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/gist/zoomToFitIcon.hpp +114 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int.hh +3477 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic.cpp +185 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic.hh +666 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/abs.hpp +236 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/divmod.hpp +350 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/max.hpp +398 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/mult.hpp +750 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/sqr.hpp +377 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/arithmetic/sqrt.hpp +217 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/array-traits.hpp +147 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/array.cpp +113 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/array.hpp +111 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bin-packing.cpp +71 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bin-packing.hh +184 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bin-packing/propagate.cpp +388 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bin-packing/propagate.hpp +219 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool.cpp +755 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool.hh +581 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/base.hpp +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/clause.hpp +353 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/eq.hpp +196 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/eqv.cpp +104 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/eqv.hpp +202 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/lq.hpp +241 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/bool/or.hpp +850 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch.cpp +152 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch.hh +607 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-val-bool.hpp +81 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-val-int.hpp +107 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-view-bool.bs +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-view-bool.cpp +438 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-view-int.bs +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/post-view-int.cpp +438 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/select-val.hpp +229 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/select-values.hpp +213 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/branch/select-view.hpp +364 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel.cpp +172 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel.hh +249 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/base.hpp +78 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/dom.hpp +332 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/link-multi.cpp +241 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/link-multi.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/link-single.cpp +77 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/link-single.hpp +71 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/channel/val.hpp +256 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/circuit.cpp +229 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/circuit.hh +160 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/circuit/base.hpp +270 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/circuit/dom.hpp +128 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/circuit/val.hpp +105 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count.cpp +417 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count.hh +410 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/int-base.hpp +80 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/int-eq.hpp +143 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/int-gq.hpp +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/int-lq.hpp +136 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/rel.hpp +281 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/view-base.hpp +131 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/view-eq.hpp +117 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/view-gq.hpp +109 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/count/view-lq.hpp +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative.cpp +432 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative.hh +745 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/basic.hpp +211 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/edge-finding.hpp +185 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/man-prop.hpp +127 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/opt-prop.hpp +171 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/overload.hpp +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/task-view.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/task.hpp +256 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulative/tree.hpp +272 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulatives.cpp +187 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulatives.hh +133 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/cumulatives/val.hpp +380 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct.cpp +97 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct.hh +314 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/bnd.hpp +444 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/dom-ctrl.hpp +81 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/dom.hpp +123 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/graph.hpp +266 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/ter-dom.hpp +113 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/distinct/val.hpp +185 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/dom.cpp +135 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/dom.hh +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/dom/range.hpp +105 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/dom/spec.hpp +124 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element.cpp +190 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element.hh +384 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element/int.hpp +443 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element/pair.cpp +151 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element/pair.hpp +74 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/element/view.hpp +559 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exception.hpp +196 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exec.cpp +83 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exec.hh +87 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exec/when.cpp +77 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/exec/when.hpp +51 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional.cpp +124 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional.hh +508 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/base.hpp +163 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/basic.hpp +148 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/dfa.cpp +535 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/dfa.hpp +282 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/incremental.hpp +454 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/layered-graph.hpp +982 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/tuple-set.cpp +222 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/extensional/tuple-set.hpp +184 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc.cpp +172 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc.hh +268 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/bnd-sup.hpp +608 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/bnd.hpp +829 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/dom-sup.hpp +1777 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/dom.hpp +315 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/post.hpp +169 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/val.hpp +299 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/gcc/view.hpp +410 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/int-set-1.hpp +249 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/int-set-2.hpp +51 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/int-set.cpp +167 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/limits.hpp +94 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear-bool.cpp +196 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear-int.cpp +194 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear.hh +1560 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/bool-int.hpp +743 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/bool-post.cpp +602 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/bool-scale.hpp +695 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/bool-view.hpp +319 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-bin.hpp +439 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-dom.hpp +484 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-nary.hpp +864 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-noview.hpp +251 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-post.cpp +561 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/int-ter.hpp +273 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/linear/post.hpp +152 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/member.cpp +85 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/member.hh +125 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/member/prop.hpp +175 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/member/re-prop.hpp +178 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap.cpp +226 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap.hh +318 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap/base.hpp +88 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap/box.hpp +198 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap/dim.hpp +197 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap/man.hpp +119 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/no-overlap/opt.hpp +153 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues.cpp +244 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues.hh +429 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/bool-base.hpp +98 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/bool-eq.hpp +174 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/bool-gq.hpp +149 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/bool-lq.hpp +151 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/graph.hpp +283 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/int-base.hpp +347 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/int-eq.hpp +167 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/int-gq.hpp +130 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/int-lq.hpp +154 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/range-event.hpp +51 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/nvalues/sym-bit-matrix.hpp +69 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/precede.cpp +73 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/precede.hh +113 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/precede/single.hpp +232 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/propagator.hpp +311 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel.cpp +381 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel.hh +665 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel/eq.hpp +676 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel/lex.hpp +414 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel/lq-le.hpp +537 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/rel/nq.hpp +196 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence.cpp +197 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence.hh +154 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence/int.hpp +168 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence/set-op.hpp +154 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence/view.hpp +499 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sequence/violations.hpp +101 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted.cpp +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted.hh +107 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted/matching.hpp +173 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted/narrowing.hpp +250 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted/order.hpp +213 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted/propagate.hpp +646 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/sorted/sortsup.hpp +564 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/support-values.hh +154 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/support-values.hpp +187 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task.hh +454 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/array.hpp +179 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/fwd-to-bwd.hpp +102 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/iter.hpp +92 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/man-to-opt.hpp +100 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/prop.hpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/purge.hpp +74 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/sort.hpp +234 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/task/tree.hpp +189 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary.cpp +258 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary.hh +839 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/detectable.hpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/edge-finding.hpp +78 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/man-prop.hpp +78 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/not-first-not-last.hpp +133 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/opt-prop.hpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/overload.hpp +93 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/subsumption.hpp +55 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/task-view.hpp +105 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/task.hpp +532 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unary/tree.hpp +229 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/unshare.cpp +146 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/val-set.hh +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/val-set.hpp +186 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp.hpp +710 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/bool.cpp +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/bool.hpp +431 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/bool.vis +75 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/delta.hpp +64 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/int.cpp +361 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/int.hpp +1029 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var-imp/int.vis +117 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var/bool.cpp +53 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var/bool.hpp +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var/int.cpp +61 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var/int.hpp +145 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/var/print.hpp +56 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph.hh +334 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/bi-link.hpp +89 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/comb-ptr-flag.hpp +78 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/edge.hpp +124 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/graph.hpp +202 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/iter-prune-val.hpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view-val-graph/node.hpp +171 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view.hpp +1690 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/bool-test.hpp +64 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/bool.hpp +314 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/cached.hpp +402 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/constint.hpp +324 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/int.hpp +264 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/iter.hpp +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/minus.hpp +300 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/neg-bool.hpp +177 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/offset.hpp +303 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/print.hpp +162 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/rel-test.hpp +231 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/scale.hpp +368 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/int/view/zero.hpp +305 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter.hh +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-add.hpp +144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-append.hpp +222 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-array.hpp +139 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-cache.hpp +106 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-compl.hpp +220 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-diff.hpp +142 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-empty.hpp +111 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-inter.hpp +309 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-list.hpp +263 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-map.hpp +260 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-minmax.hpp +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-minus.hpp +107 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-negative.hpp +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-offset.hpp +127 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-operations.hpp +157 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-positive.hpp +139 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-rangelist.hpp +115 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-scale.hpp +238 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-singleton-append.hpp +111 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-singleton.hpp +86 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-size.hpp +146 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-union.hpp +361 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/ranges-values.hpp +140 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-array.hpp +120 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-bitset.hpp +114 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-inter.hpp +130 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-list.hpp +186 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-map.hpp +136 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-minus.hpp +105 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-negative.hpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-offset.hpp +113 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-positive.hpp +123 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-ranges.hpp +106 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-singleton.hpp +109 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-union.hpp +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/iter/values-unique.hpp +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel.hh +194 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/advisor.hpp +102 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/allocators.hpp +476 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/archive.cpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/archive.hpp +298 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/array.hpp +2133 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/branch.cpp +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/branch.hpp +254 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/brancher-tiebreak.hpp +615 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/brancher-val.hpp +126 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/brancher-view.hpp +455 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/brancher.hpp +431 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/core.cpp +563 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/core.hpp +3668 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/exception.hpp +124 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/global-prop-info.hpp +258 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/macros.hpp +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/memory-config.hpp +154 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/memory-manager.cpp +53 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/memory-manager.hpp +511 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/modevent.hpp +69 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/propagator.hpp +699 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/range-list.hpp +184 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/region.cpp +85 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/region.hpp +459 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/shared-array.hpp +345 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/var-imp.hpp +332 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/var-type.hpp +767 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/var.hpp +144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/view.hpp +715 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/kernel/wait.hh +244 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel.hh +1870 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/arithmetic.cpp +408 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/bool-expr.cpp +522 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/bool-expr.hpp +87 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/exception.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/lin-expr.cpp +594 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/lin-expr.hpp +297 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/lin-rel.cpp +414 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/lin-rel.hpp +85 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/matrix.hpp +247 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/optimize.hpp +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/reg.cpp +817 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/reg.hpp +94 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/set-expr.cpp +704 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/set-expr.hpp +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/set-rel.cpp +81 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/minimodel/set-rel.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search.hh +458 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/bab.cpp +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/bab.hpp +91 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/dfs.cpp +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/dfs.hpp +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/options.cpp +72 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/options.hpp +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/bab.cpp +178 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/bab.hh +203 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/dfs.cpp +176 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/dfs.hh +195 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/engine.cpp +118 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/engine.hh +418 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/path.hh +477 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/restart.cpp +167 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/parallel/restart.hh +73 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/restart.cpp +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/restart.hpp +88 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/sequential/bab.hh +177 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/sequential/dfs.hh +176 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/sequential/path.hh +411 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/sequential/restart.hh +89 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/statistics.hpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/stop.cpp +83 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/stop.hpp +137 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/support.hh +91 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/search/worker.hh +202 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set.hh +1144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/array-traits.hpp +86 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/array.cpp +219 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/array.hpp +64 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch.cpp +128 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch.hh +438 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch/post-val.hpp +107 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch/post-view.bs +109 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch/post-view.cpp +370 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch/select-val.hpp +204 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/branch/select-view.hpp +306 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/cardinality.cpp +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex.cpp +60 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex.hh +107 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex/conv.cpp +97 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex/conv.hpp +67 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex/hull.cpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/convex/hull.hpp +68 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/distinct.cpp +56 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/distinct.hh +79 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/distinct/atmostOne.cpp +162 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/distinct/atmostOne.hpp +66 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/dom.cpp +300 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element.cpp +255 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element.hh +218 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element/disjoint.hpp +324 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element/inter.hpp +308 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element/union.hpp +342 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/element/unionConst.hpp +293 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/exception.hpp +146 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/exec.cpp +58 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int.cpp +191 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int.hh +459 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/card.hpp +93 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/channel-bool.hpp +282 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/channel-int.hpp +158 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/match.hpp +199 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/minmax.hpp +645 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/int/weights.hpp +353 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/limits.hpp +62 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/precede.cpp +74 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/precede.hh +115 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/precede/single.hpp +255 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-const-cvc.cpp +66 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-const-cvv.cpp +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-const-vcc.cpp +168 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-const-vcv.cpp +166 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-const-vvc.cpp +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-singleton.cpp +115 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op-ternary.cpp +60 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op.cpp +105 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op.hh +297 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/common.hpp +619 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/inter.hpp +389 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/partition.hpp +164 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-compl-cvc.cpp +58 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-compl-cvv.cpp +54 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-compl-vvc.cpp +57 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-compl.cpp +54 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-nocompl-cvc.cpp +55 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-nocompl-cvv.cpp +54 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-nocompl-vvc.cpp +54 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post-nocompl.cpp +54 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/post.hpp +266 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/subofunion.hpp +166 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/superofinter.hpp +167 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel-op/union.hpp +319 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel.cpp +232 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel.hh +322 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/common.hpp +125 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/eq.hpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/lq.hpp +417 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/nosubset.hpp +104 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/nq.hpp +160 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/re-eq.hpp +152 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/re-lq.hpp +182 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/re-subset.hpp +146 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/rel/subset.hpp +96 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence.cpp +64 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence.hh +115 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence/common.hpp +100 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence/seq-u.cpp +145 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence/seq-u.hpp +79 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence/seq.cpp +76 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/sequence/seq.hpp +69 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp.hpp +634 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/delta.hpp +78 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/integerset.cpp +348 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/integerset.hpp +426 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/iter.hpp +63 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/set.cpp +142 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/set.hpp +531 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var-imp/set.vis +197 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var/print.hpp +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var/set.cpp +111 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/var/set.hpp +254 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view.hpp +1142 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/cached.hpp +399 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/complement.hpp +556 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/const.hpp +723 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/print.hpp +140 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/set.hpp +263 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/set/view/singleton.hpp +402 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support.hh +135 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/auto-link.hpp +73 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/bitset-base.hpp +379 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/bitset.hpp +81 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/block-allocator.hpp +169 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/cast.hpp +52 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/config.hpp.in +109 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/dynamic-array.hpp +140 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/dynamic-queue.hpp +156 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/dynamic-stack.hpp +186 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/exception.cpp +65 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/exception.hpp +102 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/heap.cpp +49 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/heap.hpp +593 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/int-type.hpp +172 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/macros.hpp +103 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/marked-pointer.hpp +79 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/random.hpp +128 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/sort.hpp +268 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/static-stack.hpp +148 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread.hpp +272 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/none.hpp +87 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/pthreads.cpp +66 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/pthreads.hpp +142 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/thread.cpp +72 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/thread.hpp +114 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/windows.cpp +68 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/thread/windows.hpp +108 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/gecode/support/timer.hpp +103 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/install-sh +323 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/allexamples.perl +60 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/doxygen/back.png +0 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/doxygen/footer.html +3 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/doxygen/gecode-logo-100.png +0 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/doxygen/header.html +66 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/doxygen/stylesheet.css +468 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/fixautoheader.perl +55 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/fixmanifest.perl +84 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/fixproperties.sh +98 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/gecode-logo.ico +0 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genbranch.perl +310 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genchangelog.perl +249 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/gencurrentchangelog.perl +191 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genlcovmakefile.perl +148 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genlicense.perl +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genrc.perl +236 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genstatistics.perl +178 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/gentxtchangelog.perl +198 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genvarimp.perl +877 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/genxcodeproj.perl +144 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/getrevision.perl +47 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/makedepend.perl +85 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/svn-ignore-root.txt +43 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/misc/svn-ignore.txt +18 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/afc.cpp +143 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/array.cpp +277 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/assign.cpp +278 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/assign.hh +119 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/assign/bool.cpp +61 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/assign/int.cpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/assign/set.cpp +72 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/branch.cpp +504 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/branch.hh +119 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/branch/bool.cpp +61 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/branch/int.cpp +70 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/branch/set.cpp +72 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int.cpp +655 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int.hh +353 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int.hpp +314 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/arithmetic.cpp +772 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/basic.cpp +82 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/bin-packing.cpp +237 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/bool.cpp +500 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/channel.cpp +234 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/circuit.cpp +359 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/count.cpp +410 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/cumulative.cpp +560 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/cumulatives.cpp +276 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/distinct.cpp +248 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/dom.cpp +174 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/element.cpp +602 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/exec.cpp +150 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/extensional.cpp +571 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/gcc.cpp +320 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/linear.cpp +394 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/member.cpp +138 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/mm-arithmetic.cpp +368 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/mm-bool.cpp +4344 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/mm-count.cpp +295 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/mm-lin.cpp +2179 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/mm-rel.cpp +136 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/no-overlap.cpp +259 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/nvalues.cpp +241 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/precede.cpp +115 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/rel.cpp +568 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/sequence.cpp +168 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/sorted.cpp +165 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/unary.cpp +327 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/int/unshare.cpp +109 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/search.cpp +487 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set.cpp +638 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set.hh +362 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set.hpp +121 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/construct.cpp +225 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/convex.cpp +139 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/distinct.cpp +116 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/dom.cpp +346 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/element.cpp +397 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/exec.cpp +86 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/int.cpp +532 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/mm-set.cpp +4532 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/precede.cpp +136 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/rel-op-const.cpp +368 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/rel-op.cpp +504 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/rel.cpp +157 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/set/sequence.cpp +133 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/test.cpp +281 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/test.hh +161 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/test/test.hpp +76 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/tools/flatzinc/fz.cpp +93 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/tools/flatzinc/mzn-gecode.bat.in +41 -0
- data/ext/libgecode3/vendor/gecode-3.7.3/tools/flatzinc/mzn-gecode.in +41 -0
- data/lib/dep-selector-libgecode.rb +15 -0
- data/lib/dep-selector-libgecode/version.rb +3 -0
- metadata +878 -0
|
@@ -0,0 +1,3668 @@
|
|
|
1
|
+
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Main authors:
|
|
4
|
+
* Christian Schulte <schulte@gecode.org>
|
|
5
|
+
* Guido Tack <tack@gecode.org>
|
|
6
|
+
* Mikael Lagerkvist <lagerkvist@gecode.org>
|
|
7
|
+
*
|
|
8
|
+
* Contributing authors:
|
|
9
|
+
* Filip Konvicka <filip.konvicka@logis.cz>
|
|
10
|
+
*
|
|
11
|
+
* Copyright:
|
|
12
|
+
* Christian Schulte, 2002
|
|
13
|
+
* Guido Tack, 2003
|
|
14
|
+
* Mikael Lagerkvist, 2006
|
|
15
|
+
* LOGIS, s.r.o., 2009
|
|
16
|
+
*
|
|
17
|
+
* Bugfixes provided by:
|
|
18
|
+
* Alexander Samoilov <alexander_samoilov@yahoo.com>
|
|
19
|
+
*
|
|
20
|
+
* Last modified:
|
|
21
|
+
* $Date: 2012-02-22 16:18:28 +1100 (Wed, 22 Feb 2012) $ by $Author: tack $
|
|
22
|
+
* $Revision: 12538 $
|
|
23
|
+
*
|
|
24
|
+
* This file is part of Gecode, the generic constraint
|
|
25
|
+
* development environment:
|
|
26
|
+
* http://www.gecode.org
|
|
27
|
+
*
|
|
28
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
29
|
+
* a copy of this software and associated documentation files (the
|
|
30
|
+
* "Software"), to deal in the Software without restriction, including
|
|
31
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
32
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
33
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
34
|
+
* the following conditions:
|
|
35
|
+
*
|
|
36
|
+
* The above copyright notice and this permission notice shall be
|
|
37
|
+
* included in all copies or substantial portions of the Software.
|
|
38
|
+
*
|
|
39
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
40
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
41
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
42
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
43
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
44
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
45
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
#include <iostream>
|
|
49
|
+
namespace Gecode {
|
|
50
|
+
|
|
51
|
+
class Space;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* \defgroup FuncSupportShared Support for shared objects and handles
|
|
55
|
+
*
|
|
56
|
+
* Shared handles provide access to reference-counted objects. In
|
|
57
|
+
* particular, they support updates with and without sharing.
|
|
58
|
+
* An update with sharing just updates the handle, while a non-shared
|
|
59
|
+
* update creates a single copy per space.
|
|
60
|
+
*
|
|
61
|
+
* \ingroup FuncSupport
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* \brief The shared handle
|
|
66
|
+
*
|
|
67
|
+
* A shared handle provides access to an object that lives outside a space,
|
|
68
|
+
* and is shared between entities that possibly reside inside different
|
|
69
|
+
* spaces. The handle has an update mechanism that supports updates with and
|
|
70
|
+
* without sharing. An update without sharing makes sure that a
|
|
71
|
+
* single copy of the object is created when the space is copied.
|
|
72
|
+
*
|
|
73
|
+
* This is the base class that all shared handles must inherit from.
|
|
74
|
+
*
|
|
75
|
+
* \ingroup FuncSupportShared
|
|
76
|
+
*/
|
|
77
|
+
class SharedHandle {
|
|
78
|
+
public:
|
|
79
|
+
/**
|
|
80
|
+
* \brief The shared object
|
|
81
|
+
*
|
|
82
|
+
* Shared objects must inherit from this base class.
|
|
83
|
+
*
|
|
84
|
+
* \ingroup FuncSupportShared
|
|
85
|
+
*/
|
|
86
|
+
class Object {
|
|
87
|
+
friend class Space;
|
|
88
|
+
friend class SharedHandle;
|
|
89
|
+
private:
|
|
90
|
+
/// The next object collected during copying
|
|
91
|
+
Object* next;
|
|
92
|
+
/// The forwarding pointer
|
|
93
|
+
Object* fwd;
|
|
94
|
+
/// The counter used for reference counting
|
|
95
|
+
unsigned int use_cnt;
|
|
96
|
+
public:
|
|
97
|
+
/// Initialize
|
|
98
|
+
Object(void);
|
|
99
|
+
/// Return fresh copy for update
|
|
100
|
+
virtual Object* copy(void) const = 0;
|
|
101
|
+
/// Delete shared object
|
|
102
|
+
virtual ~Object(void);
|
|
103
|
+
/// Allocate memory from heap
|
|
104
|
+
static void* operator new(size_t s);
|
|
105
|
+
/// Free memory allocated from heap
|
|
106
|
+
static void operator delete(void* p);
|
|
107
|
+
};
|
|
108
|
+
private:
|
|
109
|
+
/// The shared object
|
|
110
|
+
Object* o;
|
|
111
|
+
/// Subscribe handle to object
|
|
112
|
+
void subscribe(void);
|
|
113
|
+
/// Cancel subscription of handle to object
|
|
114
|
+
void cancel(void);
|
|
115
|
+
public:
|
|
116
|
+
/// Create shared handle with no object pointing to
|
|
117
|
+
SharedHandle(void);
|
|
118
|
+
/// Create shared handle that points to shared object \a so
|
|
119
|
+
SharedHandle(SharedHandle::Object* so);
|
|
120
|
+
/// Copy constructor maintaining reference count
|
|
121
|
+
SharedHandle(const SharedHandle& sh);
|
|
122
|
+
/// Assignment operator mainitaining reference count
|
|
123
|
+
SharedHandle& operator =(const SharedHandle& sh);
|
|
124
|
+
/// Updating during cloning
|
|
125
|
+
void update(Space& home, bool share, SharedHandle& sh);
|
|
126
|
+
/// Destructor that maintains reference count
|
|
127
|
+
~SharedHandle(void);
|
|
128
|
+
protected:
|
|
129
|
+
/// Access to the shared object
|
|
130
|
+
SharedHandle::Object* object(void) const;
|
|
131
|
+
/// Modify shared object
|
|
132
|
+
void object(SharedHandle::Object* n);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* \defgroup TaskVarMEPC Generic modification events and propagation conditions
|
|
137
|
+
*
|
|
138
|
+
* Predefined modification events must be taken into account
|
|
139
|
+
* by variable types.
|
|
140
|
+
* \ingroup TaskVar
|
|
141
|
+
*/
|
|
142
|
+
//@{
|
|
143
|
+
/// Type for modification events
|
|
144
|
+
typedef int ModEvent;
|
|
145
|
+
|
|
146
|
+
/// Generic modification event: failed variable
|
|
147
|
+
const ModEvent ME_GEN_FAILED = -1;
|
|
148
|
+
/// Generic modification event: no modification
|
|
149
|
+
const ModEvent ME_GEN_NONE = 0;
|
|
150
|
+
/// Generic modification event: variable is assigned a value
|
|
151
|
+
const ModEvent ME_GEN_ASSIGNED = 1;
|
|
152
|
+
|
|
153
|
+
/// Type for propagation conditions
|
|
154
|
+
typedef int PropCond;
|
|
155
|
+
/// Propagation condition to be ignored (convenience)
|
|
156
|
+
const PropCond PC_GEN_NONE = -1;
|
|
157
|
+
/// Propagation condition for an assigned variable
|
|
158
|
+
const PropCond PC_GEN_ASSIGNED = 0;
|
|
159
|
+
//@}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* \brief Modification event deltas
|
|
163
|
+
*
|
|
164
|
+
* Modification event deltas are used by propagators. A
|
|
165
|
+
* propagator stores a modification event for each variable type.
|
|
166
|
+
* They can be accessed through a variable or a view from a given
|
|
167
|
+
* propagator. They can be constructed from a given modevent by
|
|
168
|
+
* a variable or view.
|
|
169
|
+
* \ingroup TaskActor
|
|
170
|
+
*/
|
|
171
|
+
typedef int ModEventDelta;
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#include <gecode/kernel/var-type.hpp>
|
|
176
|
+
|
|
177
|
+
namespace Gecode {
|
|
178
|
+
|
|
179
|
+
/// Configuration class for variable implementations without index structure
|
|
180
|
+
class NoIdxVarImpConf {
|
|
181
|
+
public:
|
|
182
|
+
/// Index for update
|
|
183
|
+
static const int idx_c = -1;
|
|
184
|
+
/// Index for disposal
|
|
185
|
+
static const int idx_d = -1;
|
|
186
|
+
/// Maximal propagation condition
|
|
187
|
+
static const PropCond pc_max = PC_GEN_ASSIGNED;
|
|
188
|
+
/// Freely available bits
|
|
189
|
+
static const int free_bits = 0;
|
|
190
|
+
/// Start of bits for modification event delta
|
|
191
|
+
static const int med_fst = 0;
|
|
192
|
+
/// End of bits for modification event delta
|
|
193
|
+
static const int med_lst = 0;
|
|
194
|
+
/// Bitmask for modification event delta
|
|
195
|
+
static const int med_mask = 0;
|
|
196
|
+
/// Combine modification events \a me1 and \a me2
|
|
197
|
+
static Gecode::ModEvent me_combine(ModEvent me1, ModEvent me2);
|
|
198
|
+
/// Update modification even delta \a med by \a me, return true on change
|
|
199
|
+
static bool med_update(ModEventDelta& med, ModEvent me);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
forceinline ModEvent
|
|
203
|
+
NoIdxVarImpConf::me_combine(ModEvent, ModEvent) {
|
|
204
|
+
GECODE_NEVER; return 0;
|
|
205
|
+
}
|
|
206
|
+
forceinline bool
|
|
207
|
+
NoIdxVarImpConf::med_update(ModEventDelta&, ModEvent) {
|
|
208
|
+
GECODE_NEVER; return false;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
* These are the classes of interest
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
class ActorLink;
|
|
217
|
+
class Actor;
|
|
218
|
+
class Propagator;
|
|
219
|
+
class LocalObject;
|
|
220
|
+
class Advisor;
|
|
221
|
+
template<class A> class Council;
|
|
222
|
+
template<class A> class Advisors;
|
|
223
|
+
template<class VIC> class VarImp;
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/*
|
|
227
|
+
* Variable implementations
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* \brief Base-class for variable implementations
|
|
233
|
+
*
|
|
234
|
+
* Serves as base-class that can be used without having to know any
|
|
235
|
+
* template arguments.
|
|
236
|
+
* \ingroup TaskVar
|
|
237
|
+
*/
|
|
238
|
+
class VarImpBase {};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* \brief Base class for %Variable type disposer
|
|
242
|
+
*
|
|
243
|
+
* Controls disposal of variable implementations.
|
|
244
|
+
* \ingroup TaskVar
|
|
245
|
+
*/
|
|
246
|
+
class GECODE_VTABLE_EXPORT VarImpDisposerBase {
|
|
247
|
+
public:
|
|
248
|
+
/// Dispose list of variable implementations starting at \a x
|
|
249
|
+
GECODE_KERNEL_EXPORT virtual void dispose(Space& home, VarImpBase* x);
|
|
250
|
+
/// Destructor (not used)
|
|
251
|
+
GECODE_KERNEL_EXPORT virtual ~VarImpDisposerBase(void);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* \brief %Variable implementation disposer
|
|
256
|
+
*
|
|
257
|
+
* Controls disposal of variable implementations.
|
|
258
|
+
* \ingroup TaskVar
|
|
259
|
+
*/
|
|
260
|
+
template<class VarImp>
|
|
261
|
+
class VarImpDisposer : public VarImpDisposerBase {
|
|
262
|
+
public:
|
|
263
|
+
/// Constructor (registers disposer with kernel)
|
|
264
|
+
VarImpDisposer(void);
|
|
265
|
+
/// Dispose list of variable implementations starting at \a x
|
|
266
|
+
virtual void dispose(Space& home, VarImpBase* x);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/// Generic domain change information to be supplied to advisors
|
|
270
|
+
class Delta {
|
|
271
|
+
template<class VIC> friend class VarImp;
|
|
272
|
+
private:
|
|
273
|
+
/// Modification event
|
|
274
|
+
ModEvent me;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* \brief Base-class for variable implementations
|
|
279
|
+
*
|
|
280
|
+
* Implements variable implementation for variable implementation
|
|
281
|
+
* configuration of type \a VIC.
|
|
282
|
+
* \ingroup TaskVar
|
|
283
|
+
*/
|
|
284
|
+
template<class VIC>
|
|
285
|
+
class VarImp : public VarImpBase {
|
|
286
|
+
friend class Space;
|
|
287
|
+
friend class Propagator;
|
|
288
|
+
template<class VarImp> friend class VarImpDisposer;
|
|
289
|
+
private:
|
|
290
|
+
union {
|
|
291
|
+
/**
|
|
292
|
+
* \brief Subscribed actors
|
|
293
|
+
*
|
|
294
|
+
* The base pointer of the array of subscribed actors.
|
|
295
|
+
*
|
|
296
|
+
* This pointer must be first to avoid padding on 64 bit machines.
|
|
297
|
+
*/
|
|
298
|
+
ActorLink** base;
|
|
299
|
+
/**
|
|
300
|
+
* \brief Forwarding pointer
|
|
301
|
+
*
|
|
302
|
+
* During cloning, this is used as the forwarding pointer for the
|
|
303
|
+
* variable. The original value is saved in the copy and restored after
|
|
304
|
+
* cloning.
|
|
305
|
+
*
|
|
306
|
+
*/
|
|
307
|
+
VarImp<VIC>* fwd;
|
|
308
|
+
} b;
|
|
309
|
+
|
|
310
|
+
/// Index for update
|
|
311
|
+
static const int idx_c = VIC::idx_c;
|
|
312
|
+
/// Index for disposal
|
|
313
|
+
static const int idx_d = VIC::idx_d;
|
|
314
|
+
/// Number of freely available bits
|
|
315
|
+
static const int free_bits = VIC::free_bits;
|
|
316
|
+
/// Number of used subscription entries
|
|
317
|
+
unsigned int entries;
|
|
318
|
+
/// Number of free subscription entries
|
|
319
|
+
unsigned int free_and_bits;
|
|
320
|
+
/// Maximal propagation condition
|
|
321
|
+
static const Gecode::PropCond pc_max = VIC::pc_max;
|
|
322
|
+
|
|
323
|
+
union {
|
|
324
|
+
/**
|
|
325
|
+
* \brief Indices of subscribed actors
|
|
326
|
+
*
|
|
327
|
+
* The entries from base[0] to base[idx[pc_max]] are propagators,
|
|
328
|
+
* where the entries between base[idx[pc-1]] and base[idx[pc]] are
|
|
329
|
+
* the propagators that have subscribed with propagation condition pc.
|
|
330
|
+
*
|
|
331
|
+
* The entries between base[idx[pc_max]] and base[idx[pc_max+1]] are the
|
|
332
|
+
* advisors subscribed to the variable implementation.
|
|
333
|
+
*/
|
|
334
|
+
unsigned int idx[pc_max+1];
|
|
335
|
+
/// During cloning, points to the next copied variable
|
|
336
|
+
VarImp<VIC>* next;
|
|
337
|
+
} u;
|
|
338
|
+
|
|
339
|
+
/// Return subscribed actor at index \a pc
|
|
340
|
+
ActorLink** actor(PropCond pc);
|
|
341
|
+
/// Return subscribed actor at index \a pc, where \a pc is non-zero
|
|
342
|
+
ActorLink** actorNonZero(PropCond pc);
|
|
343
|
+
/// Return reference to index \a pc, where \a pc is non-zero
|
|
344
|
+
unsigned int& idx(PropCond pc);
|
|
345
|
+
/// Return index \a pc, where \a pc is non-zero
|
|
346
|
+
unsigned int idx(PropCond pc) const;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* \brief Update copied variable \a x
|
|
350
|
+
*
|
|
351
|
+
* The argument \a sub gives the memory area where subscriptions are
|
|
352
|
+
* to be stored.
|
|
353
|
+
*/
|
|
354
|
+
void update(VarImp* x, ActorLink**& sub);
|
|
355
|
+
/**
|
|
356
|
+
* \brief Update all copied variables of this type
|
|
357
|
+
*
|
|
358
|
+
* The argument \a sub gives the memory area where subscriptions are
|
|
359
|
+
* to be stored.
|
|
360
|
+
*/
|
|
361
|
+
static void update(Space& home, ActorLink**& sub);
|
|
362
|
+
|
|
363
|
+
/// Enter propagator to subscription array
|
|
364
|
+
void enter(Space& home, Propagator* p, PropCond pc);
|
|
365
|
+
/// Enter advisor to subscription array
|
|
366
|
+
void enter(Space& home, Advisor* a);
|
|
367
|
+
/// Resize subscription array
|
|
368
|
+
void resize(Space& home);
|
|
369
|
+
/// Remove propagator from subscription array
|
|
370
|
+
void remove(Space& home, Propagator* p, PropCond pc);
|
|
371
|
+
/// Remove advisor from subscription array
|
|
372
|
+
void remove(Space& home, Advisor* a);
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
protected:
|
|
376
|
+
/// Cancel all subscriptions when variable implementation is assigned
|
|
377
|
+
void cancel(Space& home);
|
|
378
|
+
/**
|
|
379
|
+
* \brief Run advisors when variable implementation has been modified with modification event \a me and domain change \a d
|
|
380
|
+
*
|
|
381
|
+
* Returns false if an advisor has failed.
|
|
382
|
+
*/
|
|
383
|
+
bool advise(Space& home, ModEvent me, Delta& d);
|
|
384
|
+
#ifdef GECODE_HAS_VAR_DISPOSE
|
|
385
|
+
/// Return reference to variables (dispose)
|
|
386
|
+
static VarImp<VIC>* vars_d(Space& home);
|
|
387
|
+
/// Set reference to variables (dispose)
|
|
388
|
+
static void vars_d(Space& home, VarImp<VIC>* x);
|
|
389
|
+
#endif
|
|
390
|
+
|
|
391
|
+
public:
|
|
392
|
+
/// Creation
|
|
393
|
+
VarImp(Space& home);
|
|
394
|
+
/// Creation of static instances
|
|
395
|
+
VarImp(void);
|
|
396
|
+
|
|
397
|
+
/// \name Dependencies
|
|
398
|
+
//@{
|
|
399
|
+
/** \brief Subscribe propagator \a p with propagation condition \a pc
|
|
400
|
+
*
|
|
401
|
+
* In case \a schedule is false, the propagator is just subscribed but
|
|
402
|
+
* not scheduled for execution (this must be used when creating
|
|
403
|
+
* subscriptions during propagation).
|
|
404
|
+
*
|
|
405
|
+
* In case the variable is assigned (that is, \a assigned is
|
|
406
|
+
* true), the subscribing propagator is scheduled for execution.
|
|
407
|
+
* Otherwise, the propagator subscribes and is scheduled for execution
|
|
408
|
+
* with modification event \a me provided that \a pc is different
|
|
409
|
+
* from \a PC_GEN_ASSIGNED.
|
|
410
|
+
*/
|
|
411
|
+
void subscribe(Space& home, Propagator& p, PropCond pc,
|
|
412
|
+
bool assigned, ModEvent me, bool schedule);
|
|
413
|
+
/** \brief Cancel subscription of propagator \a p with propagation condition \a pc
|
|
414
|
+
*
|
|
415
|
+
* If the variable is assigned, \a assigned must be true.
|
|
416
|
+
*
|
|
417
|
+
*/
|
|
418
|
+
void cancel(Space& home, Propagator& p, PropCond pc,
|
|
419
|
+
bool assigned);
|
|
420
|
+
/** \brief Subscribe advisor \a a to variable
|
|
421
|
+
*
|
|
422
|
+
* The advisor \a a is only subscribed if \a assigned is false.
|
|
423
|
+
*
|
|
424
|
+
*/
|
|
425
|
+
void subscribe(Space& home, Advisor& a, bool assigned);
|
|
426
|
+
/** \brief Cancel subscription of advisor \a a
|
|
427
|
+
*
|
|
428
|
+
* If the variable is assigned, \a assigned must be true.
|
|
429
|
+
*
|
|
430
|
+
*/
|
|
431
|
+
void cancel(Space& home, Advisor& a, bool assigned);
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* \brief Return degree (number of subscribed propagators and advisors)
|
|
435
|
+
*
|
|
436
|
+
* Note that the degree of a variable implementation is not available
|
|
437
|
+
* during cloning.
|
|
438
|
+
*/
|
|
439
|
+
unsigned int degree(void) const;
|
|
440
|
+
/**
|
|
441
|
+
* \brief Return accumulated failure count (plus degree)
|
|
442
|
+
*
|
|
443
|
+
* Note that the accumulated failure count of a variable implementation
|
|
444
|
+
* is not available during cloning.
|
|
445
|
+
*/
|
|
446
|
+
double afc(void) const;
|
|
447
|
+
//@}
|
|
448
|
+
|
|
449
|
+
/// \name Cloning variables
|
|
450
|
+
//@{
|
|
451
|
+
/// Constructor for cloning
|
|
452
|
+
VarImp(Space& home, bool share, VarImp& x);
|
|
453
|
+
/// Is variable already copied
|
|
454
|
+
bool copied(void) const;
|
|
455
|
+
/// Use forward pointer if variable already copied
|
|
456
|
+
VarImp* forward(void) const;
|
|
457
|
+
/// Return next copied variable
|
|
458
|
+
VarImp* next(void) const;
|
|
459
|
+
//@}
|
|
460
|
+
|
|
461
|
+
/// \name Variable implementation-dependent propagator support
|
|
462
|
+
//@{
|
|
463
|
+
/**
|
|
464
|
+
* \brief Schedule propagator \a p with modification event \a me
|
|
465
|
+
*
|
|
466
|
+
* If \a force is true, the propagator is re-scheduled (including
|
|
467
|
+
* cost computation) even though its modification event delta has
|
|
468
|
+
* not changed.
|
|
469
|
+
*/
|
|
470
|
+
static void schedule(Space& home, Propagator& p, ModEvent me,
|
|
471
|
+
bool force = false);
|
|
472
|
+
/// Project modification event for this variable type from \a med
|
|
473
|
+
static ModEvent me(const ModEventDelta& med);
|
|
474
|
+
/// Translate modification event \a me into modification event delta
|
|
475
|
+
static ModEventDelta med(ModEvent me);
|
|
476
|
+
/// Combine modifications events \a me1 and \a me2
|
|
477
|
+
static ModEvent me_combine(ModEvent me1, ModEvent me2);
|
|
478
|
+
//@}
|
|
479
|
+
|
|
480
|
+
/// \name Delta information for advisors
|
|
481
|
+
//@{
|
|
482
|
+
/// Return modification event
|
|
483
|
+
static ModEvent modevent(const Delta& d);
|
|
484
|
+
//@}
|
|
485
|
+
|
|
486
|
+
/// \name Bit management
|
|
487
|
+
//@{
|
|
488
|
+
/// Provide access to free bits
|
|
489
|
+
unsigned int bits(void) const;
|
|
490
|
+
/// Provide access to free bits
|
|
491
|
+
unsigned int& bits(void);
|
|
492
|
+
//@}
|
|
493
|
+
|
|
494
|
+
protected:
|
|
495
|
+
/// Schedule subscribed propagators
|
|
496
|
+
void schedule(Space& home, PropCond pc1, PropCond pc2, ModEvent me);
|
|
497
|
+
|
|
498
|
+
public:
|
|
499
|
+
/// \name Memory management
|
|
500
|
+
//@{
|
|
501
|
+
/// Allocate memory from space
|
|
502
|
+
static void* operator new(size_t,Space&);
|
|
503
|
+
/// Return memory to space
|
|
504
|
+
static void operator delete(void*,Space&);
|
|
505
|
+
/// Needed for exceptions
|
|
506
|
+
static void operator delete(void*);
|
|
507
|
+
//@}
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* \defgroup TaskActorStatus Status of constraint propagation and branching commit
|
|
512
|
+
* Note that the enum values starting with a double underscore should not
|
|
513
|
+
* be used directly. Instead, use the provided functions with the same
|
|
514
|
+
* name without leading underscores.
|
|
515
|
+
*
|
|
516
|
+
* \ingroup TaskActor
|
|
517
|
+
*/
|
|
518
|
+
enum ExecStatus {
|
|
519
|
+
__ES_SUBSUMED = -2, ///< Internal: propagator is subsumed, do not use
|
|
520
|
+
ES_FAILED = -1, ///< Execution has resulted in failure
|
|
521
|
+
ES_NOFIX = 0, ///< Propagation has not computed fixpoint
|
|
522
|
+
ES_OK = 0, ///< Execution is okay
|
|
523
|
+
ES_FIX = 1, ///< Propagation has computed fixpoint
|
|
524
|
+
ES_NOFIX_FORCE = 2, ///< Advisor forces rescheduling of propagator
|
|
525
|
+
__ES_PARTIAL = 2 ///< Internal: propagator has computed partial fixpoint, do not use
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* \brief Propagation cost
|
|
530
|
+
* \ingroup TaskActor
|
|
531
|
+
*/
|
|
532
|
+
class PropCost {
|
|
533
|
+
friend class Space;
|
|
534
|
+
public:
|
|
535
|
+
/// The actual cost values that are used
|
|
536
|
+
enum ActualCost {
|
|
537
|
+
AC_CRAZY_LO = 0, ///< Exponential complexity, cheap
|
|
538
|
+
AC_CRAZY_HI = 0, ///< Exponential complexity, expensive
|
|
539
|
+
AC_CUBIC_LO = 1, ///< Cubic complexity, cheap
|
|
540
|
+
AC_CUBIC_HI = 1, ///< Cubic complexity, expensive
|
|
541
|
+
AC_QUADRATIC_LO = 2, ///< Quadratic complexity, cheap
|
|
542
|
+
AC_QUADRATIC_HI = 2, ///< Quadratic complexity, expensive
|
|
543
|
+
AC_LINEAR_HI = 3, ///< Linear complexity, expensive
|
|
544
|
+
AC_LINEAR_LO = 4, ///< Linear complexity, cheap
|
|
545
|
+
AC_TERNARY_HI = 4, ///< Three variables, expensive
|
|
546
|
+
AC_BINARY_HI = 5, ///< Two variables, expensive
|
|
547
|
+
AC_TERNARY_LO = 5, ///< Three variables, cheap
|
|
548
|
+
AC_BINARY_LO = 6, ///< Two variables, cheap
|
|
549
|
+
AC_UNARY_LO = 6, ///< Only single variable, cheap
|
|
550
|
+
AC_UNARY_HI = 6, ///< Only single variable, expensive
|
|
551
|
+
AC_MAX = 6 ///< Maximal cost value
|
|
552
|
+
};
|
|
553
|
+
/// Actual cost
|
|
554
|
+
ActualCost ac;
|
|
555
|
+
public:
|
|
556
|
+
/// Propagation cost modifier
|
|
557
|
+
enum Mod {
|
|
558
|
+
LO, ///< Cheap
|
|
559
|
+
HI ///< Expensive
|
|
560
|
+
};
|
|
561
|
+
private:
|
|
562
|
+
/// Compute dynamic cost for cost \a lo, expensive cost \a hi, and size measure \a n
|
|
563
|
+
static PropCost cost(Mod m, ActualCost lo, ActualCost hi, unsigned int n);
|
|
564
|
+
/// Constructor for automatic coercion of \a ac
|
|
565
|
+
PropCost(ActualCost ac);
|
|
566
|
+
public:
|
|
567
|
+
/// Exponential complexity for modifier \a m and size measure \a n
|
|
568
|
+
static PropCost crazy(PropCost::Mod m, unsigned int n);
|
|
569
|
+
/// Exponential complexity for modifier \a m and size measure \a n
|
|
570
|
+
static PropCost crazy(PropCost::Mod m, int n);
|
|
571
|
+
/// Cubic complexity for modifier \a m and size measure \a n
|
|
572
|
+
static PropCost cubic(PropCost::Mod m, unsigned int n);
|
|
573
|
+
/// Cubic complexity for modifier \a m and size measure \a n
|
|
574
|
+
static PropCost cubic(PropCost::Mod m, int n);
|
|
575
|
+
/// Quadratic complexity for modifier \a m and size measure \a n
|
|
576
|
+
static PropCost quadratic(PropCost::Mod m, unsigned int n);
|
|
577
|
+
/// Quadratic complexity for modifier \a m and size measure \a n
|
|
578
|
+
static PropCost quadratic(PropCost::Mod m, int n);
|
|
579
|
+
/// Linear complexity for modifier \a pcm and size measure \a n
|
|
580
|
+
static PropCost linear(PropCost::Mod m, unsigned int n);
|
|
581
|
+
/// Linear complexity for modifier \a pcm and size measure \a n
|
|
582
|
+
static PropCost linear(PropCost::Mod m, int n);
|
|
583
|
+
/// Three variables for modifier \a pcm
|
|
584
|
+
static PropCost ternary(PropCost::Mod m);
|
|
585
|
+
/// Two variables for modifier \a pcm
|
|
586
|
+
static PropCost binary(PropCost::Mod m);
|
|
587
|
+
/// Single variable for modifier \a pcm
|
|
588
|
+
static PropCost unary(PropCost::Mod m);
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* \brief Actor properties
|
|
594
|
+
* \ingroup TaskActor
|
|
595
|
+
*/
|
|
596
|
+
enum ActorProperty {
|
|
597
|
+
/**
|
|
598
|
+
* \brief Actor must always be disposed
|
|
599
|
+
*
|
|
600
|
+
* Normally, a propagator will not be disposed if its home space
|
|
601
|
+
* is deleted. However, if an actor uses external resources,
|
|
602
|
+
* this property can be used to make sure that the actor
|
|
603
|
+
* will always be disposed.
|
|
604
|
+
*/
|
|
605
|
+
AP_DISPOSE = (1 << 0),
|
|
606
|
+
/**
|
|
607
|
+
* Propagator is only weakly monotonic, that is, the propagator
|
|
608
|
+
* is only monotonic on assignments.
|
|
609
|
+
*
|
|
610
|
+
*/
|
|
611
|
+
AP_WEAKLY = (1 << 1)
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* \brief Double-linked list for actors
|
|
617
|
+
*
|
|
618
|
+
* Used to maintain which actors belong to a space and also
|
|
619
|
+
* (for propagators) to organize actors in the queue of
|
|
620
|
+
* waiting propagators.
|
|
621
|
+
*/
|
|
622
|
+
class ActorLink {
|
|
623
|
+
friend class Actor;
|
|
624
|
+
friend class Propagator;
|
|
625
|
+
friend class Advisor;
|
|
626
|
+
friend class Brancher;
|
|
627
|
+
friend class LocalObject;
|
|
628
|
+
friend class Space;
|
|
629
|
+
template<class VIC> friend class VarImp;
|
|
630
|
+
private:
|
|
631
|
+
ActorLink* _next; ActorLink* _prev;
|
|
632
|
+
public:
|
|
633
|
+
//@{
|
|
634
|
+
/// Routines for double-linked list
|
|
635
|
+
ActorLink* prev(void) const; void prev(ActorLink*);
|
|
636
|
+
ActorLink* next(void) const; void next(ActorLink*);
|
|
637
|
+
ActorLink** next_ref(void);
|
|
638
|
+
//@}
|
|
639
|
+
|
|
640
|
+
/// Initialize links (self-linked)
|
|
641
|
+
void init(void);
|
|
642
|
+
/// Remove from predecessor and successor
|
|
643
|
+
void unlink(void);
|
|
644
|
+
/// Insert \a al directly after this
|
|
645
|
+
void head(ActorLink* al);
|
|
646
|
+
/// Insert \a al directly before this
|
|
647
|
+
void tail(ActorLink* al);
|
|
648
|
+
/// Test whether actor link is empty (points to itself)
|
|
649
|
+
bool empty(void) const;
|
|
650
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
651
|
+
template<class T> static ActorLink* cast(T* a);
|
|
652
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
653
|
+
template<class T> static const ActorLink* cast(const T* a);
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* \brief Base-class for both propagators and branchers
|
|
659
|
+
* \ingroup TaskActor
|
|
660
|
+
*/
|
|
661
|
+
class GECODE_VTABLE_EXPORT Actor : private ActorLink {
|
|
662
|
+
friend class ActorLink;
|
|
663
|
+
friend class Space;
|
|
664
|
+
friend class Propagator;
|
|
665
|
+
friend class Advisor;
|
|
666
|
+
friend class Brancher;
|
|
667
|
+
friend class LocalObject;
|
|
668
|
+
template<class VIC> friend class VarImp;
|
|
669
|
+
template<class A> friend class Council;
|
|
670
|
+
private:
|
|
671
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
672
|
+
static Actor* cast(ActorLink* al);
|
|
673
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
674
|
+
static const Actor* cast(const ActorLink* al);
|
|
675
|
+
public:
|
|
676
|
+
/// Create copy
|
|
677
|
+
virtual Actor* copy(Space& home, bool share) = 0;
|
|
678
|
+
|
|
679
|
+
/// \name Memory management
|
|
680
|
+
//@{
|
|
681
|
+
/// Report size occupied by additionally datastructures
|
|
682
|
+
GECODE_KERNEL_EXPORT
|
|
683
|
+
virtual size_t allocated(void) const;
|
|
684
|
+
/// Delete actor and return its size
|
|
685
|
+
GECODE_KERNEL_EXPORT
|
|
686
|
+
virtual size_t dispose(Space& home);
|
|
687
|
+
/// Allocate memory from space
|
|
688
|
+
static void* operator new(size_t s, Space& home);
|
|
689
|
+
/// No-op for exceptions
|
|
690
|
+
static void operator delete(void* p, Space& home);
|
|
691
|
+
private:
|
|
692
|
+
#ifndef __GNUC__
|
|
693
|
+
/// Not used (uses dispose instead)
|
|
694
|
+
static void operator delete(void* p);
|
|
695
|
+
#endif
|
|
696
|
+
/// Not used
|
|
697
|
+
static void* operator new(size_t s);
|
|
698
|
+
//@}
|
|
699
|
+
#ifdef __GNUC__
|
|
700
|
+
public:
|
|
701
|
+
/// To avoid warnings from GCC
|
|
702
|
+
GECODE_KERNEL_EXPORT virtual ~Actor(void);
|
|
703
|
+
/// Not used (uses dispose instead)
|
|
704
|
+
static void operator delete(void* p);
|
|
705
|
+
#endif
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* \brief %Home class for posting propagators
|
|
712
|
+
*/
|
|
713
|
+
class Home {
|
|
714
|
+
protected:
|
|
715
|
+
/// The space where the propagator is to be posted
|
|
716
|
+
Space& s;
|
|
717
|
+
/// A propagator (possibly) that is currently being rewritten
|
|
718
|
+
Propagator* p;
|
|
719
|
+
public:
|
|
720
|
+
/// \name Conversion
|
|
721
|
+
//@{
|
|
722
|
+
/// Initialize the home with space \a s and propagator \a p
|
|
723
|
+
Home(Space& s, Propagator* p=NULL);
|
|
724
|
+
/// Retrieve the space of the home
|
|
725
|
+
operator Space&(void);
|
|
726
|
+
//@}
|
|
727
|
+
/// \name Extended information
|
|
728
|
+
//@{
|
|
729
|
+
/// Return a home extended by propagator to be rewritten
|
|
730
|
+
Home operator ()(Propagator& p);
|
|
731
|
+
/// Return propagator (or NULL) for currently rewritten propagator
|
|
732
|
+
Propagator* propagator(void) const;
|
|
733
|
+
//@}
|
|
734
|
+
/// \name Forwarding of common space operations
|
|
735
|
+
//@{
|
|
736
|
+
/// Check whether corresponding space is failed
|
|
737
|
+
bool failed(void) const;
|
|
738
|
+
/// Mark space as failed
|
|
739
|
+
void fail(void);
|
|
740
|
+
/// Notice actor property
|
|
741
|
+
void notice(Actor& a, ActorProperty p);
|
|
742
|
+
//@}
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* \brief Base-class for propagators
|
|
747
|
+
* \ingroup TaskActor
|
|
748
|
+
*/
|
|
749
|
+
class GECODE_VTABLE_EXPORT Propagator : public Actor {
|
|
750
|
+
friend class ActorLink;
|
|
751
|
+
friend class Space;
|
|
752
|
+
template<class VIC> friend class VarImp;
|
|
753
|
+
friend class Advisor;
|
|
754
|
+
template<class A> friend class Council;
|
|
755
|
+
private:
|
|
756
|
+
union {
|
|
757
|
+
/// A set of modification events (used during propagation)
|
|
758
|
+
ModEventDelta med;
|
|
759
|
+
/// The size of the propagator (used during subsumption)
|
|
760
|
+
size_t size;
|
|
761
|
+
/// A list of advisors (used during cloning)
|
|
762
|
+
Gecode::ActorLink* advisors;
|
|
763
|
+
} u;
|
|
764
|
+
/// A reference to global propagator information
|
|
765
|
+
PropInfo& pi;
|
|
766
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
767
|
+
static Propagator* cast(ActorLink* al);
|
|
768
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
769
|
+
static const Propagator* cast(const ActorLink* al);
|
|
770
|
+
protected:
|
|
771
|
+
/// Constructor for posting
|
|
772
|
+
Propagator(Home home);
|
|
773
|
+
/// Constructor for cloning \a p
|
|
774
|
+
Propagator(Space& home, bool share, Propagator& p);
|
|
775
|
+
|
|
776
|
+
public:
|
|
777
|
+
/// \name Propagation
|
|
778
|
+
//@{
|
|
779
|
+
/**
|
|
780
|
+
* \brief Propagation function
|
|
781
|
+
*
|
|
782
|
+
* The propagation function must return an execution status as
|
|
783
|
+
* follows:
|
|
784
|
+
* - ES_FAILED: the propagator has detected failure
|
|
785
|
+
* - ES_NOFIX: the propagator has done propagation
|
|
786
|
+
* - ES_FIX: the propagator has done propagation and has computed
|
|
787
|
+
* a fixpoint. That is, running the propagator immediately
|
|
788
|
+
* again will do nothing.
|
|
789
|
+
*
|
|
790
|
+
* Apart from the above values, a propagator can return
|
|
791
|
+
* the result from calling one of the functions defined by a space:
|
|
792
|
+
* - ES_SUBSUMED: the propagator is subsumed and has been already
|
|
793
|
+
* deleted.
|
|
794
|
+
* - ES_NOFIX_PARTIAL: the propagator has consumed some of its
|
|
795
|
+
* propagation events.
|
|
796
|
+
* - ES_FIX_PARTIAL: the propagator has consumed some of its
|
|
797
|
+
* propagation events and with respect to these events is
|
|
798
|
+
* at fixpoint
|
|
799
|
+
* For more details, see the individual functions.
|
|
800
|
+
*
|
|
801
|
+
*/
|
|
802
|
+
virtual ExecStatus propagate(Space& home, const ModEventDelta& med) = 0;
|
|
803
|
+
/// Cost function
|
|
804
|
+
virtual PropCost cost(const Space& home, const ModEventDelta& med) const = 0;
|
|
805
|
+
/**
|
|
806
|
+
* \brief Return the modification event delta
|
|
807
|
+
*
|
|
808
|
+
* This function returns the modification event delta of the currently
|
|
809
|
+
* executing propagator and hence can only be called within the
|
|
810
|
+
* propagate function of a propagator.
|
|
811
|
+
*/
|
|
812
|
+
ModEventDelta modeventdelta(void) const;
|
|
813
|
+
/**
|
|
814
|
+
* \brief Advise function
|
|
815
|
+
*
|
|
816
|
+
* The advisor is passed as argument \a a.
|
|
817
|
+
*
|
|
818
|
+
* A propagator must specialize this advise function, if it
|
|
819
|
+
* uses advisors. The advise function must return an execution
|
|
820
|
+
* status as follows:
|
|
821
|
+
* - ES_FAILED: the advisor has detected failure.
|
|
822
|
+
* - ES_FIX: the advisor's propagator (that is, this propagator)
|
|
823
|
+
* does not need to be run.
|
|
824
|
+
* - ES_NOFIX: the advisor's propagator (that is, this propagator)
|
|
825
|
+
* must be run.
|
|
826
|
+
* - ES_NOFIX_FORCE: the advisor's propagator (that is, this propagator)
|
|
827
|
+
* must be run and it must forcefully be rescheduled (including
|
|
828
|
+
* recomputation of cost).
|
|
829
|
+
*
|
|
830
|
+
* Apart from the above values, an advisor can return
|
|
831
|
+
* the result from calling the function defined by a space:
|
|
832
|
+
* - ES_FIX_DISPOSE: the advisor's propagator does not need to be run
|
|
833
|
+
* and the advisor will be disposed.
|
|
834
|
+
* - ES_NOFIX_DISPOSE: the advisor's propagator must be run and the
|
|
835
|
+
* advisor will be disposed.
|
|
836
|
+
* - ES_NOFIX_FORCE_DISPOSE: the advisor's propagator must be run
|
|
837
|
+
* , it must forcefully be rescheduled (including recomputation
|
|
838
|
+
* of cost), and the adviser will be disposed.
|
|
839
|
+
* For more details, see the function documentation.
|
|
840
|
+
*
|
|
841
|
+
* The delta \a d describes how the variable has been changed
|
|
842
|
+
* by an operation on the advisor's variable. Typically,
|
|
843
|
+
* the delta information can only be utilized by either
|
|
844
|
+
* static or member functions of views as the actual delta
|
|
845
|
+
* information is both domain and view dependent.
|
|
846
|
+
*
|
|
847
|
+
*/
|
|
848
|
+
GECODE_KERNEL_EXPORT
|
|
849
|
+
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
|
|
850
|
+
//@}
|
|
851
|
+
/// \name Information
|
|
852
|
+
//@{
|
|
853
|
+
/// Return the accumlated failure count
|
|
854
|
+
double afc(void) const;
|
|
855
|
+
//@}
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* \brief %Council of advisors
|
|
861
|
+
*
|
|
862
|
+
* If a propagator uses advisors, it must maintain its advisors
|
|
863
|
+
* through a council.
|
|
864
|
+
* \ingroup TaskActor
|
|
865
|
+
*/
|
|
866
|
+
template<class A>
|
|
867
|
+
class Council {
|
|
868
|
+
friend class Advisor;
|
|
869
|
+
friend class Advisors<A>;
|
|
870
|
+
private:
|
|
871
|
+
/// Starting point for a linked list of advisors
|
|
872
|
+
mutable ActorLink* advisors;
|
|
873
|
+
public:
|
|
874
|
+
/// Default constructor
|
|
875
|
+
Council(void);
|
|
876
|
+
/// Construct advisor council
|
|
877
|
+
Council(Space& home);
|
|
878
|
+
/// Test whether council has advisor left
|
|
879
|
+
bool empty(void) const;
|
|
880
|
+
/// Update during cloning (copies all advisors)
|
|
881
|
+
void update(Space& home, bool share, Council<A>& c);
|
|
882
|
+
/// Dispose council
|
|
883
|
+
void dispose(Space& home);
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* \brief Class to iterate over advisors of a council
|
|
889
|
+
* \ingroup TaskActor
|
|
890
|
+
*/
|
|
891
|
+
template<class A>
|
|
892
|
+
class Advisors {
|
|
893
|
+
private:
|
|
894
|
+
/// The current advisor
|
|
895
|
+
ActorLink* a;
|
|
896
|
+
public:
|
|
897
|
+
/// Initialize
|
|
898
|
+
Advisors(const Council<A>& c);
|
|
899
|
+
/// Test whether there advisors left
|
|
900
|
+
bool operator ()(void) const;
|
|
901
|
+
/// Move iterator to next advisor
|
|
902
|
+
void operator ++(void);
|
|
903
|
+
/// Return advisor
|
|
904
|
+
A& advisor(void) const;
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* \brief Base-class for advisors
|
|
910
|
+
*
|
|
911
|
+
* Advisors are typically subclassed for each propagator that
|
|
912
|
+
* wants to use advisors. The actual member function that
|
|
913
|
+
* is executed when a variable is changed, must be implemented
|
|
914
|
+
* by the advisor's propagator.
|
|
915
|
+
*
|
|
916
|
+
* \ingroup TaskActor
|
|
917
|
+
*/
|
|
918
|
+
class Advisor : private ActorLink {
|
|
919
|
+
template<class VIC> friend class VarImp;
|
|
920
|
+
template<class A> friend class Council;
|
|
921
|
+
template<class A> friend class Advisors;
|
|
922
|
+
private:
|
|
923
|
+
/// Is the advisor disposed?
|
|
924
|
+
bool disposed(void) const;
|
|
925
|
+
/// Static cast
|
|
926
|
+
static Advisor* cast(ActorLink* al);
|
|
927
|
+
/// Static cast
|
|
928
|
+
static const Advisor* cast(const ActorLink* al);
|
|
929
|
+
protected:
|
|
930
|
+
/// Return the advisor's propagator
|
|
931
|
+
Propagator& propagator(void) const;
|
|
932
|
+
public:
|
|
933
|
+
/// Constructor for creation
|
|
934
|
+
template<class A>
|
|
935
|
+
Advisor(Space& home, Propagator& p, Council<A>& c);
|
|
936
|
+
/// Copying constructor
|
|
937
|
+
Advisor(Space& home, bool share, Advisor& a);
|
|
938
|
+
|
|
939
|
+
/// \name Memory management
|
|
940
|
+
//@{
|
|
941
|
+
/// Dispose the advisor
|
|
942
|
+
template<class A>
|
|
943
|
+
void dispose(Space& home, Council<A>& c);
|
|
944
|
+
/// Allocate memory from space
|
|
945
|
+
static void* operator new(size_t s, Space& home);
|
|
946
|
+
/// No-op for exceptions
|
|
947
|
+
static void operator delete(void* p, Space& home);
|
|
948
|
+
//@}
|
|
949
|
+
private:
|
|
950
|
+
#ifndef __GNUC__
|
|
951
|
+
/// Not used (uses dispose instead)
|
|
952
|
+
static void operator delete(void* p);
|
|
953
|
+
#endif
|
|
954
|
+
/// Not used
|
|
955
|
+
static void* operator new(size_t s);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
class Brancher;
|
|
960
|
+
/**
|
|
961
|
+
* \brief %Choice for performing commit
|
|
962
|
+
*
|
|
963
|
+
* Must be refined by inheritance such that the information stored
|
|
964
|
+
* inside a choice is sufficient to redo a commit performed by a
|
|
965
|
+
* particular brancher.
|
|
966
|
+
*
|
|
967
|
+
* \ingroup TaskActor
|
|
968
|
+
*/
|
|
969
|
+
class GECODE_VTABLE_EXPORT Choice {
|
|
970
|
+
friend class Space;
|
|
971
|
+
private:
|
|
972
|
+
unsigned int _id; ///< Identity to match creating brancher
|
|
973
|
+
unsigned int _alt; ///< Number of alternatives
|
|
974
|
+
|
|
975
|
+
/// Return id of the creating brancher
|
|
976
|
+
unsigned int id(void) const;
|
|
977
|
+
protected:
|
|
978
|
+
/// Initialize for particular brancher \a b and alternatives \a a
|
|
979
|
+
Choice(const Brancher& b, const unsigned int a);
|
|
980
|
+
public:
|
|
981
|
+
/// Return number of alternatives
|
|
982
|
+
unsigned int alternatives(void) const;
|
|
983
|
+
/// Destructor
|
|
984
|
+
GECODE_KERNEL_EXPORT virtual ~Choice(void);
|
|
985
|
+
/// Report size occupied by choice
|
|
986
|
+
virtual size_t size(void) const = 0;
|
|
987
|
+
/// Allocate memory from heap
|
|
988
|
+
static void* operator new(size_t);
|
|
989
|
+
/// Return memory to heap
|
|
990
|
+
static void operator delete(void*);
|
|
991
|
+
/// Archive into \a e
|
|
992
|
+
GECODE_KERNEL_EXPORT virtual void archive(Archive& e) const;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* \brief Base-class for branchers
|
|
997
|
+
*
|
|
998
|
+
* Note that branchers cannot be created inside a propagator
|
|
999
|
+
* (no idea why one would like to do that anyway). If you do that
|
|
1000
|
+
* the system will explode in a truly interesting way.
|
|
1001
|
+
*
|
|
1002
|
+
* \ingroup TaskActor
|
|
1003
|
+
*/
|
|
1004
|
+
class GECODE_VTABLE_EXPORT Brancher : public Actor {
|
|
1005
|
+
friend class ActorLink;
|
|
1006
|
+
friend class Space;
|
|
1007
|
+
friend class Choice;
|
|
1008
|
+
private:
|
|
1009
|
+
/// Unique identity
|
|
1010
|
+
unsigned int _id;
|
|
1011
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
1012
|
+
static Brancher* cast(ActorLink* al);
|
|
1013
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
1014
|
+
static const Brancher* cast(const ActorLink* al);
|
|
1015
|
+
protected:
|
|
1016
|
+
/// Constructor for creation
|
|
1017
|
+
Brancher(Home home);
|
|
1018
|
+
/// Constructor for cloning \a b
|
|
1019
|
+
Brancher(Space& home, bool share, Brancher& b);
|
|
1020
|
+
public:
|
|
1021
|
+
/// \name Brancher
|
|
1022
|
+
//@{
|
|
1023
|
+
/**
|
|
1024
|
+
* \brief Check status of brancher, return true if alternatives left
|
|
1025
|
+
*
|
|
1026
|
+
* This method is called when Space::status is called, it determines
|
|
1027
|
+
* whether to continue branching with this brancher or move on to
|
|
1028
|
+
* the (possibly) next brancher.
|
|
1029
|
+
*
|
|
1030
|
+
*/
|
|
1031
|
+
virtual bool status(const Space& home) const = 0;
|
|
1032
|
+
/**
|
|
1033
|
+
* \brief Return choice
|
|
1034
|
+
*
|
|
1035
|
+
* Note that this method relies on the fact that it is called
|
|
1036
|
+
* immediately after a previous call to status. Moreover, the
|
|
1037
|
+
* member function can only be called once.
|
|
1038
|
+
*/
|
|
1039
|
+
virtual const Choice* choice(Space& home) = 0;
|
|
1040
|
+
/// Return choice from \a e
|
|
1041
|
+
virtual const Choice* choice(const Space& home, Archive& e) = 0;
|
|
1042
|
+
/**
|
|
1043
|
+
* \brief Commit for choice \a c and alternative \a a
|
|
1044
|
+
*
|
|
1045
|
+
* The current brancher in the space \a home performs a commit from
|
|
1046
|
+
* the information provided by the choice \a c and the alternative \a a.
|
|
1047
|
+
*/
|
|
1048
|
+
virtual ExecStatus commit(Space& home, const Choice& c,
|
|
1049
|
+
unsigned int a) = 0;
|
|
1050
|
+
/// Return unsigned brancher id
|
|
1051
|
+
unsigned int id(void) const;
|
|
1052
|
+
//@}
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* \brief Local (space-shared) object
|
|
1057
|
+
*
|
|
1058
|
+
* Local objects must inherit from this base class.
|
|
1059
|
+
*
|
|
1060
|
+
* \ingroup FuncSupportShared
|
|
1061
|
+
*/
|
|
1062
|
+
class LocalObject : public Actor {
|
|
1063
|
+
friend class ActorLink;
|
|
1064
|
+
friend class Space;
|
|
1065
|
+
friend class LocalHandle;
|
|
1066
|
+
protected:
|
|
1067
|
+
/// Constructor for creation
|
|
1068
|
+
LocalObject(Home home);
|
|
1069
|
+
/// Copy constructor
|
|
1070
|
+
LocalObject(Space& home, bool share, LocalObject& l);
|
|
1071
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
1072
|
+
static LocalObject* cast(ActorLink* al);
|
|
1073
|
+
/// Static cast for a non-null pointer (to give a hint to optimizer)
|
|
1074
|
+
static const LocalObject* cast(const ActorLink* al);
|
|
1075
|
+
private:
|
|
1076
|
+
/// Make copy and set forwarding pointer
|
|
1077
|
+
GECODE_KERNEL_EXPORT void fwdcopy(Space& home, bool share);
|
|
1078
|
+
public:
|
|
1079
|
+
/// Return forwarding pointer
|
|
1080
|
+
LocalObject* fwd(Space& home, bool share);
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* \brief Handles for local (space-shared) objects
|
|
1085
|
+
*
|
|
1086
|
+
* \ingroup FuncSupportShared
|
|
1087
|
+
*
|
|
1088
|
+
*/
|
|
1089
|
+
class LocalHandle {
|
|
1090
|
+
private:
|
|
1091
|
+
/// The local object
|
|
1092
|
+
LocalObject* o;
|
|
1093
|
+
protected:
|
|
1094
|
+
/// Create local handle pointing to NULL object
|
|
1095
|
+
LocalHandle(void);
|
|
1096
|
+
/// Create local handle that points to local object \a lo
|
|
1097
|
+
LocalHandle(LocalObject* lo);
|
|
1098
|
+
/// Copy constructor
|
|
1099
|
+
LocalHandle(const LocalHandle& lh);
|
|
1100
|
+
public:
|
|
1101
|
+
/// Assignment operator
|
|
1102
|
+
LocalHandle& operator =(const LocalHandle& lh);
|
|
1103
|
+
/// Updating during cloning
|
|
1104
|
+
void update(Space& home, bool share, LocalHandle& lh);
|
|
1105
|
+
/// Destructor
|
|
1106
|
+
~LocalHandle(void);
|
|
1107
|
+
protected:
|
|
1108
|
+
/// Access to the local object
|
|
1109
|
+
LocalObject* object(void) const;
|
|
1110
|
+
/// Modify local object
|
|
1111
|
+
void object(LocalObject* n);
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* \brief %Space status
|
|
1117
|
+
* \ingroup TaskSearch
|
|
1118
|
+
*/
|
|
1119
|
+
enum SpaceStatus {
|
|
1120
|
+
SS_FAILED, ///< %Space is failed
|
|
1121
|
+
SS_SOLVED, ///< %Space is solved (no brancher left)
|
|
1122
|
+
SS_BRANCH ///< %Space must be branched (at least one brancher left)
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* \brief %Statistics for execution of status
|
|
1127
|
+
*
|
|
1128
|
+
*/
|
|
1129
|
+
class StatusStatistics {
|
|
1130
|
+
public:
|
|
1131
|
+
/// Number of propagator executions
|
|
1132
|
+
unsigned long int propagate;
|
|
1133
|
+
/// Whether a weakly monotonic propagator might have been executed
|
|
1134
|
+
bool wmp;
|
|
1135
|
+
/// Initialize
|
|
1136
|
+
StatusStatistics(void);
|
|
1137
|
+
/// Reset information
|
|
1138
|
+
void reset(void);
|
|
1139
|
+
/// Return sum with \a s
|
|
1140
|
+
StatusStatistics operator +(const StatusStatistics& s);
|
|
1141
|
+
/// Increment by statistics \a s
|
|
1142
|
+
StatusStatistics& operator +=(const StatusStatistics& s);
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* \brief %Statistics for execution of clone
|
|
1147
|
+
*
|
|
1148
|
+
*/
|
|
1149
|
+
class CloneStatistics {
|
|
1150
|
+
public:
|
|
1151
|
+
/// Initialize
|
|
1152
|
+
CloneStatistics(void);
|
|
1153
|
+
/// Reset information
|
|
1154
|
+
void reset(void);
|
|
1155
|
+
/// Return sum with \a s
|
|
1156
|
+
CloneStatistics operator +(const CloneStatistics& s);
|
|
1157
|
+
/// Increment by statistics \a s
|
|
1158
|
+
CloneStatistics& operator +=(const CloneStatistics& s);
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* \brief %Statistics for execution of commit
|
|
1163
|
+
*
|
|
1164
|
+
*/
|
|
1165
|
+
class CommitStatistics {
|
|
1166
|
+
public:
|
|
1167
|
+
/// Initialize
|
|
1168
|
+
CommitStatistics(void);
|
|
1169
|
+
/// Reset information
|
|
1170
|
+
void reset(void);
|
|
1171
|
+
/// Return sum with \a s
|
|
1172
|
+
CommitStatistics operator +(const CommitStatistics& s);
|
|
1173
|
+
/// Increment by statistics \a s
|
|
1174
|
+
CommitStatistics& operator +=(const CommitStatistics& s);
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* \brief Computation spaces
|
|
1179
|
+
*/
|
|
1180
|
+
class GECODE_VTABLE_EXPORT Space {
|
|
1181
|
+
friend class Actor;
|
|
1182
|
+
friend class Propagator;
|
|
1183
|
+
friend class Brancher;
|
|
1184
|
+
friend class Advisor;
|
|
1185
|
+
template<class VIC> friend class VarImp;
|
|
1186
|
+
template<class VarImp> friend class VarImpDisposer;
|
|
1187
|
+
friend class SharedHandle;
|
|
1188
|
+
friend class LocalObject;
|
|
1189
|
+
friend class Region;
|
|
1190
|
+
private:
|
|
1191
|
+
/// Manager for shared memory areas
|
|
1192
|
+
SharedMemory* sm;
|
|
1193
|
+
/// Performs memory management for space
|
|
1194
|
+
MemoryManager mm;
|
|
1195
|
+
/// Global propagator information
|
|
1196
|
+
GlobalPropInfo gpi;
|
|
1197
|
+
/// Doubly linked list of all propagators
|
|
1198
|
+
ActorLink pl;
|
|
1199
|
+
/// Doubly linked list of all branchers
|
|
1200
|
+
ActorLink bl;
|
|
1201
|
+
/**
|
|
1202
|
+
* \brief Points to the first brancher to be used for status
|
|
1203
|
+
*
|
|
1204
|
+
* If equal to &bl, no brancher does exist.
|
|
1205
|
+
*/
|
|
1206
|
+
Brancher* b_status;
|
|
1207
|
+
/**
|
|
1208
|
+
* \brief Points to the first brancher to be used for commit
|
|
1209
|
+
*
|
|
1210
|
+
* Note that \a b_commit can point to an earlier brancher
|
|
1211
|
+
* than \a b_status. This reflects the fact that the earlier
|
|
1212
|
+
* brancher is already done (that is, status on that brancher
|
|
1213
|
+
* returns false) but there might be still choices
|
|
1214
|
+
* referring to the earlier brancher.
|
|
1215
|
+
*
|
|
1216
|
+
* If equal to &bl, no brancher does exist.
|
|
1217
|
+
*/
|
|
1218
|
+
Brancher* b_commit;
|
|
1219
|
+
union {
|
|
1220
|
+
/// Data only available during propagation
|
|
1221
|
+
struct {
|
|
1222
|
+
/**
|
|
1223
|
+
* \brief Cost level with next propagator to be executed
|
|
1224
|
+
*
|
|
1225
|
+
* This maintains the following invariant (but only if the
|
|
1226
|
+
* space does not perform propagation):
|
|
1227
|
+
* - If active points to a queue, this queue might contain
|
|
1228
|
+
* a propagator. However, there will be at least one queue
|
|
1229
|
+
* containing a propagator.
|
|
1230
|
+
* - Otherwise, active is smaller than the first queue
|
|
1231
|
+
* or larger than the last queue. Then, the space is stable.
|
|
1232
|
+
* - If active is larger than the last queue, the space is failed.
|
|
1233
|
+
*/
|
|
1234
|
+
ActorLink* active;
|
|
1235
|
+
/// Scheduled propagators according to cost
|
|
1236
|
+
ActorLink queue[PropCost::AC_MAX+1];
|
|
1237
|
+
/// Id of next brancher to be created
|
|
1238
|
+
unsigned int branch_id;
|
|
1239
|
+
/// Number of subscriptions
|
|
1240
|
+
unsigned int n_sub;
|
|
1241
|
+
} p;
|
|
1242
|
+
/// Data available only during copying
|
|
1243
|
+
struct {
|
|
1244
|
+
/// Entries for updating variables
|
|
1245
|
+
VarImpBase* vars_u[AllVarConf::idx_c];
|
|
1246
|
+
/// Keep variables during copying without index structure
|
|
1247
|
+
VarImpBase* vars_noidx;
|
|
1248
|
+
/// Linked list of shared objects
|
|
1249
|
+
SharedHandle::Object* shared;
|
|
1250
|
+
/// Linked list of local objects
|
|
1251
|
+
LocalObject* local;
|
|
1252
|
+
} c;
|
|
1253
|
+
} pc;
|
|
1254
|
+
/// Put propagator \a p into right queue
|
|
1255
|
+
void enqueue(Propagator* p);
|
|
1256
|
+
/**
|
|
1257
|
+
* \name update, and dispose variables
|
|
1258
|
+
*/
|
|
1259
|
+
//@{
|
|
1260
|
+
#ifdef GECODE_HAS_VAR_DISPOSE
|
|
1261
|
+
/// Registered variable type disposers
|
|
1262
|
+
GECODE_KERNEL_EXPORT static VarImpDisposerBase* vd[AllVarConf::idx_d];
|
|
1263
|
+
/// Entries for disposing variables
|
|
1264
|
+
VarImpBase* _vars_d[AllVarConf::idx_d];
|
|
1265
|
+
/// Return reference to variables (dispose)
|
|
1266
|
+
template<class VIC> VarImpBase* vars_d(void) const;
|
|
1267
|
+
/// Set reference to variables (dispose)
|
|
1268
|
+
template<class VIC> void vars_d(VarImpBase* x);
|
|
1269
|
+
#endif
|
|
1270
|
+
/// Update all cloned variables
|
|
1271
|
+
void update(ActorLink** sub);
|
|
1272
|
+
//@}
|
|
1273
|
+
|
|
1274
|
+
/// First actor for forced disposal
|
|
1275
|
+
Actor** d_fst;
|
|
1276
|
+
/// Current actor for forced disposal
|
|
1277
|
+
Actor** d_cur;
|
|
1278
|
+
/// Last actor for forced disposal
|
|
1279
|
+
Actor** d_lst;
|
|
1280
|
+
/// Resize disposal array
|
|
1281
|
+
GECODE_KERNEL_EXPORT void d_resize(void);
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* \brief Number of weakly monotonic propagators
|
|
1285
|
+
*
|
|
1286
|
+
* If zero, none exists. If one, then none exists right now but
|
|
1287
|
+
* there has been one since the last fixpoint computed. Otherwise,
|
|
1288
|
+
* it gives the number of weakly monotoning propagators minus one.
|
|
1289
|
+
*/
|
|
1290
|
+
unsigned int n_wmp;
|
|
1291
|
+
|
|
1292
|
+
/// Used for default argument
|
|
1293
|
+
GECODE_KERNEL_EXPORT static StatusStatistics unused_status;
|
|
1294
|
+
/// Used for default argument
|
|
1295
|
+
GECODE_KERNEL_EXPORT static CloneStatistics unused_clone;
|
|
1296
|
+
/// Used for default argument
|
|
1297
|
+
GECODE_KERNEL_EXPORT static CommitStatistics unused_commit;
|
|
1298
|
+
/// Used for default argument
|
|
1299
|
+
GECODE_KERNEL_EXPORT static unsigned long int unused_uli;
|
|
1300
|
+
/// Used for default arguments
|
|
1301
|
+
GECODE_KERNEL_EXPORT static bool unused_b;
|
|
1302
|
+
|
|
1303
|
+
/**
|
|
1304
|
+
* \brief Clone space
|
|
1305
|
+
*
|
|
1306
|
+
* Assumes that the space is stable and not failed. If the space is
|
|
1307
|
+
* failed, an exception of type SpaceFailed is thrown. If the space
|
|
1308
|
+
* is not stable, an exception of SpaceNotStable is thrown.
|
|
1309
|
+
*
|
|
1310
|
+
* Otherwise, a clone of the space is returned. If \a share is true,
|
|
1311
|
+
* sharable datastructures are shared among the clone and the original
|
|
1312
|
+
* space. If \a share is false, independent copies of the shared
|
|
1313
|
+
* datastructures must be created. This means that a clone with no
|
|
1314
|
+
* sharing can be used in a different thread without any interaction
|
|
1315
|
+
* with the original space.
|
|
1316
|
+
*/
|
|
1317
|
+
GECODE_KERNEL_EXPORT Space* _clone(bool share=true);
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* \brief Commit choice \a c for alternative \a a
|
|
1321
|
+
*
|
|
1322
|
+
* The current brancher in the space performs a commit from
|
|
1323
|
+
* the information provided by the choice \a c
|
|
1324
|
+
* and the alternative \a a. The statistics information \a stat is
|
|
1325
|
+
* updated.
|
|
1326
|
+
*
|
|
1327
|
+
* Note that no propagation is perfomed (to support path
|
|
1328
|
+
* recomputation), in order to perform propagation the member
|
|
1329
|
+
* function status must be used.
|
|
1330
|
+
*
|
|
1331
|
+
* Committing with choices must be carried
|
|
1332
|
+
* out in the same order as the choices have been
|
|
1333
|
+
* obtained by the member function Space::choice().
|
|
1334
|
+
*
|
|
1335
|
+
* It is perfectly okay to add constraints interleaved with
|
|
1336
|
+
* choices (provided they are in the right order).
|
|
1337
|
+
* However, if propagation is performed by calling the member
|
|
1338
|
+
* function status and then new choices are
|
|
1339
|
+
* computed, these choices are different.
|
|
1340
|
+
*
|
|
1341
|
+
* Only choices can be used that are up-to-date in the following
|
|
1342
|
+
* sense: if a new choice is created (via the choice member
|
|
1343
|
+
* function), no older choices can be used.
|
|
1344
|
+
*
|
|
1345
|
+
* Committing throws the following exceptions:
|
|
1346
|
+
* - SpaceNoBrancher, if the space has no current brancher (it is
|
|
1347
|
+
* already solved).
|
|
1348
|
+
* - SpaceIllegalAlternative, if \a a is not smaller than the number
|
|
1349
|
+
* of alternatives supported by the choice \a c.
|
|
1350
|
+
*/
|
|
1351
|
+
GECODE_KERNEL_EXPORT
|
|
1352
|
+
void _commit(const Choice& c, unsigned int a);
|
|
1353
|
+
|
|
1354
|
+
public:
|
|
1355
|
+
/**
|
|
1356
|
+
* \brief Default constructor
|
|
1357
|
+
* \ingroup TaskModelScript
|
|
1358
|
+
*/
|
|
1359
|
+
GECODE_KERNEL_EXPORT Space(void);
|
|
1360
|
+
/**
|
|
1361
|
+
* \brief Destructor
|
|
1362
|
+
* \ingroup TaskModelScript
|
|
1363
|
+
*/
|
|
1364
|
+
GECODE_KERNEL_EXPORT virtual ~Space(void);
|
|
1365
|
+
/**
|
|
1366
|
+
* \brief Constructor for cloning
|
|
1367
|
+
*
|
|
1368
|
+
* Must copy and update all data structures (such as variables
|
|
1369
|
+
* and variable arrays) required by the subclass of Space.
|
|
1370
|
+
*
|
|
1371
|
+
* If \a share is true, share all data structures among copies.
|
|
1372
|
+
* Otherwise, make independent copies.
|
|
1373
|
+
* \ingroup TaskModelScript
|
|
1374
|
+
*/
|
|
1375
|
+
GECODE_KERNEL_EXPORT Space(bool share, Space& s);
|
|
1376
|
+
/**
|
|
1377
|
+
* \brief Copying member function
|
|
1378
|
+
*
|
|
1379
|
+
* Must create a new object using the constructor for cloning.
|
|
1380
|
+
* \ingroup TaskModelScript
|
|
1381
|
+
*/
|
|
1382
|
+
virtual Space* copy(bool share) = 0;
|
|
1383
|
+
/**
|
|
1384
|
+
* \brief Constrain function for best solution search
|
|
1385
|
+
*
|
|
1386
|
+
* Must constrain this space to be better than the so far best
|
|
1387
|
+
* solution \a best.
|
|
1388
|
+
*
|
|
1389
|
+
* If best solution search is used and this method is not redefined,
|
|
1390
|
+
* an exception of type SpaceConstrainUndefined is thrown.
|
|
1391
|
+
*
|
|
1392
|
+
* \ingroup TaskModelScript
|
|
1393
|
+
*/
|
|
1394
|
+
GECODE_KERNEL_EXPORT virtual void constrain(const Space& best);
|
|
1395
|
+
/**
|
|
1396
|
+
* \brief Allocate memory from heap for new space
|
|
1397
|
+
* \ingroup TaskModelScript
|
|
1398
|
+
*/
|
|
1399
|
+
static void* operator new(size_t);
|
|
1400
|
+
/**
|
|
1401
|
+
* \brief Free memory allocated from heap
|
|
1402
|
+
* \ingroup TaskModelScript
|
|
1403
|
+
*/
|
|
1404
|
+
static void operator delete(void*);
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
/*
|
|
1408
|
+
* Member functions for search engines
|
|
1409
|
+
*
|
|
1410
|
+
*/
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* \brief Query space status
|
|
1414
|
+
*
|
|
1415
|
+
* Propagates the space until fixpoint or failure;
|
|
1416
|
+
* updates the statistics information \a stat; and:
|
|
1417
|
+
* - if the space is failed, SpaceStatus::SS_FAILED is returned.
|
|
1418
|
+
* - if the space is not failed but the space has no brancher left,
|
|
1419
|
+
* SpaceStatus::SS_SOLVED is returned.
|
|
1420
|
+
* - otherwise, SpaceStatus::SS_BRANCH is returned.
|
|
1421
|
+
* \ingroup TaskSearch
|
|
1422
|
+
*/
|
|
1423
|
+
GECODE_KERNEL_EXPORT
|
|
1424
|
+
SpaceStatus status(StatusStatistics& stat=unused_status);
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* \brief Create new choice for current brancher
|
|
1428
|
+
*
|
|
1429
|
+
* This member function can only be called after the member function
|
|
1430
|
+
* Space::status on the same space has been called and in between
|
|
1431
|
+
* no non-const member function has been called on this space.
|
|
1432
|
+
*
|
|
1433
|
+
* Moreover, the member function can only be called at most once
|
|
1434
|
+
* (otherwise, it might generate conflicting choices).
|
|
1435
|
+
*
|
|
1436
|
+
* Note that the above invariant only pertains to calls of member
|
|
1437
|
+
* functions of the same space. If the invariant is violated, the
|
|
1438
|
+
* system is likely to crash (hopefully it does). In particular, if
|
|
1439
|
+
* applied to a space with no current brancher, the system will
|
|
1440
|
+
* crash.
|
|
1441
|
+
*
|
|
1442
|
+
* After a new choice has been created, no older choices
|
|
1443
|
+
* can be used on the space.
|
|
1444
|
+
*
|
|
1445
|
+
* If the status() member function has returned that the space has
|
|
1446
|
+
* no more branchers (that is, the result was either SS_FAILED or
|
|
1447
|
+
* SS_SOLVED), a call to choice() will return NULL and purge
|
|
1448
|
+
* all remaining branchers inside the space. This is interesting
|
|
1449
|
+
* for the case SS_SOLVED, where the call to choice can serve as
|
|
1450
|
+
* garbage collection.
|
|
1451
|
+
*
|
|
1452
|
+
* Throws an exception of type SpaceNotStable when applied to a not
|
|
1453
|
+
* yet stable space.
|
|
1454
|
+
*
|
|
1455
|
+
* \ingroup TaskSearch
|
|
1456
|
+
*/
|
|
1457
|
+
GECODE_KERNEL_EXPORT
|
|
1458
|
+
const Choice* choice(void);
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* \brief Create new choice from \a e
|
|
1462
|
+
*
|
|
1463
|
+
* The archived representation \a e must have been created from
|
|
1464
|
+
* a Choice that is compatible with this space (i.e., created from
|
|
1465
|
+
* the same model).
|
|
1466
|
+
*
|
|
1467
|
+
* \ingroup TaskSearch
|
|
1468
|
+
*/
|
|
1469
|
+
GECODE_KERNEL_EXPORT
|
|
1470
|
+
const Choice* choice(Archive& e) const;
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* \brief Clone space
|
|
1474
|
+
*
|
|
1475
|
+
* Assumes that the space is stable and not failed. If the space is
|
|
1476
|
+
* failed, an exception of type SpaceFailed is thrown. If the space
|
|
1477
|
+
* is not stable, an exception of SpaceNotStable is thrown.
|
|
1478
|
+
*
|
|
1479
|
+
* Otherwise, a clone of the space is returned and the statistics
|
|
1480
|
+
* information \a stat is updated. If \a share is true,
|
|
1481
|
+
* sharable datastructures are shared among the clone and the original
|
|
1482
|
+
* space. If \a share is false, independent copies of the shared
|
|
1483
|
+
* datastructures must be created. This means that a clone with no
|
|
1484
|
+
* sharing can be used in a different thread without any interaction
|
|
1485
|
+
* with the original space.
|
|
1486
|
+
*
|
|
1487
|
+
* \ingroup TaskSearch
|
|
1488
|
+
*/
|
|
1489
|
+
Space* clone(bool share=true, CloneStatistics& stat=unused_clone) const;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* \brief Commit choice \a c for alternative \a a
|
|
1493
|
+
*
|
|
1494
|
+
* The current brancher in the space performs a commit from
|
|
1495
|
+
* the information provided by the choice \a c
|
|
1496
|
+
* and the alternative \a a. The statistics information \a stat is
|
|
1497
|
+
* updated.
|
|
1498
|
+
*
|
|
1499
|
+
* Note that no propagation is perfomed (to support path
|
|
1500
|
+
* recomputation), in order to perform propagation the member
|
|
1501
|
+
* function status must be used.
|
|
1502
|
+
*
|
|
1503
|
+
* Committing with choices must be carried
|
|
1504
|
+
* out in the same order as the choices have been
|
|
1505
|
+
* obtained by the member function Space::choice().
|
|
1506
|
+
*
|
|
1507
|
+
* It is perfectly okay to add constraints interleaved with
|
|
1508
|
+
* choices (provided they are in the right order).
|
|
1509
|
+
* However, if propagation is performed by calling the member
|
|
1510
|
+
* function status and then new choices are
|
|
1511
|
+
* computed, these choices are different.
|
|
1512
|
+
*
|
|
1513
|
+
* Only choices can be used that are up-to-date in the following
|
|
1514
|
+
* sense: if a new choice is created (via the choice member
|
|
1515
|
+
* function), no older choices can be used.
|
|
1516
|
+
*
|
|
1517
|
+
* Committing throws the following exceptions:
|
|
1518
|
+
* - SpaceNoBrancher, if the space has no current brancher (it is
|
|
1519
|
+
* already solved).
|
|
1520
|
+
* - SpaceIllegalAlternative, if \a a is not smaller than the number
|
|
1521
|
+
* of alternatives supported by the choice \a c.
|
|
1522
|
+
*
|
|
1523
|
+
* \ingroup TaskSearch
|
|
1524
|
+
*/
|
|
1525
|
+
void commit(const Choice& c, unsigned int a,
|
|
1526
|
+
CommitStatistics& stat=unused_commit);
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* \brief Notice actor property
|
|
1530
|
+
*
|
|
1531
|
+
* Make the space notice that the actor \a a has the property \a p.
|
|
1532
|
+
* Note that the same property can only be noticed once for an actor.
|
|
1533
|
+
* \ingroup TaskActor
|
|
1534
|
+
*/
|
|
1535
|
+
void notice(Actor& a, ActorProperty p);
|
|
1536
|
+
/**
|
|
1537
|
+
* \brief Ignore actor property
|
|
1538
|
+
*
|
|
1539
|
+
* Make the space ignore that the actor \a a has the property \a p.
|
|
1540
|
+
* Note that a property must be ignored before an actor is disposed.
|
|
1541
|
+
* \ingroup TaskActor
|
|
1542
|
+
*/
|
|
1543
|
+
void ignore(Actor& a, ActorProperty p);
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* \brief %Propagator \a p is subsumed
|
|
1548
|
+
*
|
|
1549
|
+
* First disposes the propagator and then returns subsumption.
|
|
1550
|
+
*
|
|
1551
|
+
* \warning Has a side-effect on the propagator. Overwrites
|
|
1552
|
+
* the modification event delta of a propagator.
|
|
1553
|
+
* Use only directly with returning from propagation.
|
|
1554
|
+
* \ingroup TaskActorStatus
|
|
1555
|
+
*/
|
|
1556
|
+
ExecStatus ES_SUBSUMED(Propagator& p);
|
|
1557
|
+
/**
|
|
1558
|
+
* \brief %Propagator \a p is subsumed
|
|
1559
|
+
*
|
|
1560
|
+
* The size of the propagator is \a s.
|
|
1561
|
+
*
|
|
1562
|
+
* Note that the propagator must be subsumed and also disposed. So
|
|
1563
|
+
* in general, there should be code such as
|
|
1564
|
+
* \code return ES_SUBSUMED_DISPOSE(home,*this,dispose(home)) \endcode.
|
|
1565
|
+
*
|
|
1566
|
+
* \warning Has a side-effect on the propagator. Overwrites
|
|
1567
|
+
* the modification event delta of a propagator.
|
|
1568
|
+
* Use only directly with returning from propagation.
|
|
1569
|
+
* \ingroup TaskActorStatus
|
|
1570
|
+
*/
|
|
1571
|
+
ExecStatus ES_SUBSUMED_DISPOSED(Propagator& p, size_t s);
|
|
1572
|
+
/**
|
|
1573
|
+
* \brief %Propagator \a p has computed partial fixpoint
|
|
1574
|
+
*
|
|
1575
|
+
* %Set modification event delta to \a med and schedule propagator
|
|
1576
|
+
* accordingly.
|
|
1577
|
+
*
|
|
1578
|
+
* \warning Has a side-effect on the propagator.
|
|
1579
|
+
* Use only directly with returning from propagation.
|
|
1580
|
+
* \ingroup TaskActorStatus
|
|
1581
|
+
*/
|
|
1582
|
+
ExecStatus ES_FIX_PARTIAL(Propagator& p, const ModEventDelta& med);
|
|
1583
|
+
/**
|
|
1584
|
+
* \brief %Propagator \a p has not computed partial fixpoint
|
|
1585
|
+
*
|
|
1586
|
+
* Combine current modification event delta with \a and schedule
|
|
1587
|
+
* propagator accordingly.
|
|
1588
|
+
*
|
|
1589
|
+
* \warning Has a side-effect on the propagator.
|
|
1590
|
+
* Use only directly with returning from propagation.
|
|
1591
|
+
* \ingroup TaskActorStatus
|
|
1592
|
+
*/
|
|
1593
|
+
ExecStatus ES_NOFIX_PARTIAL(Propagator& p, const ModEventDelta& med);
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* \brief %Advisor \a a must be disposed
|
|
1597
|
+
*
|
|
1598
|
+
* Disposes the advisor and returns that the propagator of \a a
|
|
1599
|
+
* need not be run.
|
|
1600
|
+
*
|
|
1601
|
+
* \warning Has a side-effect on the advisor. Use only directly when
|
|
1602
|
+
* returning from advise.
|
|
1603
|
+
* \ingroup TaskActorStatus
|
|
1604
|
+
*/
|
|
1605
|
+
template<class A>
|
|
1606
|
+
ExecStatus ES_FIX_DISPOSE(Council<A>& c, A& a);
|
|
1607
|
+
/**
|
|
1608
|
+
* \brief %Advisor \a a must be disposed and its propagator must be run
|
|
1609
|
+
*
|
|
1610
|
+
* Disposes the advisor and returns that the propagator of \a a
|
|
1611
|
+
* must be run.
|
|
1612
|
+
*
|
|
1613
|
+
* \warning Has a side-effect on the advisor. Use only directly when
|
|
1614
|
+
* returning from advise.
|
|
1615
|
+
* \ingroup TaskActorStatus
|
|
1616
|
+
*/
|
|
1617
|
+
template<class A>
|
|
1618
|
+
ExecStatus ES_NOFIX_DISPOSE(Council<A>& c, A& a);
|
|
1619
|
+
/**
|
|
1620
|
+
* \brief %Advisor \a a must be disposed and its propagator must be forcefully rescheduled
|
|
1621
|
+
*
|
|
1622
|
+
* Disposes the advisor and returns that the propagator of \a a
|
|
1623
|
+
* must be run and must be forcefully rescheduled (including
|
|
1624
|
+
* recomputation of cost).
|
|
1625
|
+
*
|
|
1626
|
+
* \warning Has a side-effect on the advisor. Use only directly when
|
|
1627
|
+
* returning from advise.
|
|
1628
|
+
* \ingroup TaskActorStatus
|
|
1629
|
+
*/
|
|
1630
|
+
template<class A>
|
|
1631
|
+
ExecStatus ES_NOFIX_DISPOSE_FORCE(Council<A>& c, A& a);
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* \brief Fail space
|
|
1635
|
+
*
|
|
1636
|
+
* This is useful for failing outside of actors. Never use inside
|
|
1637
|
+
* a propagate or commit member function. The system will crash!
|
|
1638
|
+
* \ingroup TaskActor
|
|
1639
|
+
*/
|
|
1640
|
+
void fail(void);
|
|
1641
|
+
/**
|
|
1642
|
+
* \brief Check whether space is failed
|
|
1643
|
+
*
|
|
1644
|
+
* Note that this does not perform propagation. This is useful
|
|
1645
|
+
* for posting actors: only if a space is not yet failed, new
|
|
1646
|
+
* actors are allowed to be created.
|
|
1647
|
+
* \ingroup TaskActor
|
|
1648
|
+
*/
|
|
1649
|
+
bool failed(void) const;
|
|
1650
|
+
/**
|
|
1651
|
+
* \brief Return if space is stable (at fixpoint or failed)
|
|
1652
|
+
* \ingroup TaskActor
|
|
1653
|
+
*/
|
|
1654
|
+
bool stable(void) const;
|
|
1655
|
+
/**
|
|
1656
|
+
* \brief Return number of propagators
|
|
1657
|
+
*
|
|
1658
|
+
* Note that this function takes linear time in the number of
|
|
1659
|
+
* propagators.
|
|
1660
|
+
*/
|
|
1661
|
+
GECODE_KERNEL_EXPORT unsigned int propagators(void) const;
|
|
1662
|
+
/**
|
|
1663
|
+
* \brief Return number of branchers
|
|
1664
|
+
*
|
|
1665
|
+
* Note that this function takes linear time in the number of
|
|
1666
|
+
* branchers.
|
|
1667
|
+
*/
|
|
1668
|
+
GECODE_KERNEL_EXPORT unsigned int branchers(void) const;
|
|
1669
|
+
|
|
1670
|
+
/// \name Conversion from Space to Home
|
|
1671
|
+
//@{
|
|
1672
|
+
/// Return a home for this space with the information that \a p is being rewritten
|
|
1673
|
+
Home operator ()(Propagator& p);
|
|
1674
|
+
//@}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* \defgroup FuncMemSpace Space-memory management
|
|
1678
|
+
* \ingroup FuncMem
|
|
1679
|
+
*/
|
|
1680
|
+
//@{
|
|
1681
|
+
/**
|
|
1682
|
+
* \brief Allocate block of \a n objects of type \a T from space heap
|
|
1683
|
+
*
|
|
1684
|
+
* Note that this function implements C++ semantics: the default
|
|
1685
|
+
* constructor of \a T is run for all \a n objects.
|
|
1686
|
+
*/
|
|
1687
|
+
template<class T>
|
|
1688
|
+
T* alloc(long unsigned int n);
|
|
1689
|
+
/**
|
|
1690
|
+
* \brief Allocate block of \a n objects of type \a T from space heap
|
|
1691
|
+
*
|
|
1692
|
+
* Note that this function implements C++ semantics: the default
|
|
1693
|
+
* constructor of \a T is run for all \a n objects.
|
|
1694
|
+
*/
|
|
1695
|
+
template<class T>
|
|
1696
|
+
T* alloc(long int n);
|
|
1697
|
+
/**
|
|
1698
|
+
* \brief Allocate block of \a n objects of type \a T from space heap
|
|
1699
|
+
*
|
|
1700
|
+
* Note that this function implements C++ semantics: the default
|
|
1701
|
+
* constructor of \a T is run for all \a n objects.
|
|
1702
|
+
*/
|
|
1703
|
+
template<class T>
|
|
1704
|
+
T* alloc(unsigned int n);
|
|
1705
|
+
/**
|
|
1706
|
+
* \brief Allocate block of \a n objects of type \a T from space heap
|
|
1707
|
+
*
|
|
1708
|
+
* Note that this function implements C++ semantics: the default
|
|
1709
|
+
* constructor of \a T is run for all \a n objects.
|
|
1710
|
+
*/
|
|
1711
|
+
template<class T>
|
|
1712
|
+
T* alloc(int n);
|
|
1713
|
+
/**
|
|
1714
|
+
* \brief Delete \a n objects allocated from space heap starting at \a b
|
|
1715
|
+
*
|
|
1716
|
+
* Note that this function implements C++ semantics: the destructor
|
|
1717
|
+
* of \a T is run for all \a n objects.
|
|
1718
|
+
*
|
|
1719
|
+
* Note that the memory is not freed, it is just scheduled for later
|
|
1720
|
+
* reusal.
|
|
1721
|
+
*/
|
|
1722
|
+
template<class T>
|
|
1723
|
+
void free(T* b, long unsigned int n);
|
|
1724
|
+
/**
|
|
1725
|
+
* \brief Delete \a n objects allocated from space heap starting at \a b
|
|
1726
|
+
*
|
|
1727
|
+
* Note that this function implements C++ semantics: the destructor
|
|
1728
|
+
* of \a T is run for all \a n objects.
|
|
1729
|
+
*
|
|
1730
|
+
* Note that the memory is not freed, it is just scheduled for later
|
|
1731
|
+
* reusal.
|
|
1732
|
+
*/
|
|
1733
|
+
template<class T>
|
|
1734
|
+
void free(T* b, long int n);
|
|
1735
|
+
/**
|
|
1736
|
+
* \brief Delete \a n objects allocated from space heap starting at \a b
|
|
1737
|
+
*
|
|
1738
|
+
* Note that this function implements C++ semantics: the destructor
|
|
1739
|
+
* of \a T is run for all \a n objects.
|
|
1740
|
+
*
|
|
1741
|
+
* Note that the memory is not freed, it is just scheduled for later
|
|
1742
|
+
* reusal.
|
|
1743
|
+
*/
|
|
1744
|
+
template<class T>
|
|
1745
|
+
void free(T* b, unsigned int n);
|
|
1746
|
+
/**
|
|
1747
|
+
* \brief Delete \a n objects allocated from space heap starting at \a b
|
|
1748
|
+
*
|
|
1749
|
+
* Note that this function implements C++ semantics: the destructor
|
|
1750
|
+
* of \a T is run for all \a n objects.
|
|
1751
|
+
*
|
|
1752
|
+
* Note that the memory is not freed, it is just scheduled for later
|
|
1753
|
+
* reusal.
|
|
1754
|
+
*/
|
|
1755
|
+
template<class T>
|
|
1756
|
+
void free(T* b, int n);
|
|
1757
|
+
/**
|
|
1758
|
+
* \brief Reallocate block of \a n objects starting at \a b to \a m objects of type \a T from the space heap
|
|
1759
|
+
*
|
|
1760
|
+
* Note that this function implements C++ semantics: the copy constructor
|
|
1761
|
+
* of \a T is run for all \f$\min(n,m)\f$ objects, the default
|
|
1762
|
+
* constructor of \a T is run for all remaining
|
|
1763
|
+
* \f$\max(n,m)-\min(n,m)\f$ objects, and the destrucor of \a T is
|
|
1764
|
+
* run for all \a n objects in \a b.
|
|
1765
|
+
*
|
|
1766
|
+
* Returns the address of the new block.
|
|
1767
|
+
*/
|
|
1768
|
+
template<class T>
|
|
1769
|
+
T* realloc(T* b, long unsigned int n, long unsigned int m);
|
|
1770
|
+
/**
|
|
1771
|
+
* \brief Reallocate block of \a n objects starting at \a b to \a m objects of type \a T from the space heap
|
|
1772
|
+
*
|
|
1773
|
+
* Note that this function implements C++ semantics: the copy constructor
|
|
1774
|
+
* of \a T is run for all \f$\min(n,m)\f$ objects, the default
|
|
1775
|
+
* constructor of \a T is run for all remaining
|
|
1776
|
+
* \f$\max(n,m)-\min(n,m)\f$ objects, and the destrucor of \a T is
|
|
1777
|
+
* run for all \a n objects in \a b.
|
|
1778
|
+
*
|
|
1779
|
+
* Returns the address of the new block.
|
|
1780
|
+
*/
|
|
1781
|
+
template<class T>
|
|
1782
|
+
T* realloc(T* b, long int n, long int m);
|
|
1783
|
+
/**
|
|
1784
|
+
* \brief Reallocate block of \a n objects starting at \a b to \a m objects of type \a T from the space heap
|
|
1785
|
+
*
|
|
1786
|
+
* Note that this function implements C++ semantics: the copy constructor
|
|
1787
|
+
* of \a T is run for all \f$\min(n,m)\f$ objects, the default
|
|
1788
|
+
* constructor of \a T is run for all remaining
|
|
1789
|
+
* \f$\max(n,m)-\min(n,m)\f$ objects, and the destrucor of \a T is
|
|
1790
|
+
* run for all \a n objects in \a b.
|
|
1791
|
+
*
|
|
1792
|
+
* Returns the address of the new block.
|
|
1793
|
+
*/
|
|
1794
|
+
template<class T>
|
|
1795
|
+
T* realloc(T* b, unsigned int n, unsigned int m);
|
|
1796
|
+
/**
|
|
1797
|
+
* \brief Reallocate block of \a n objects starting at \a b to \a m objects of type \a T from the space heap
|
|
1798
|
+
*
|
|
1799
|
+
* Note that this function implements C++ semantics: the copy constructor
|
|
1800
|
+
* of \a T is run for all \f$\min(n,m)\f$ objects, the default
|
|
1801
|
+
* constructor of \a T is run for all remaining
|
|
1802
|
+
* \f$\max(n,m)-\min(n,m)\f$ objects, and the destrucor of \a T is
|
|
1803
|
+
* run for all \a n objects in \a b.
|
|
1804
|
+
*
|
|
1805
|
+
* Returns the address of the new block.
|
|
1806
|
+
*/
|
|
1807
|
+
template<class T>
|
|
1808
|
+
T* realloc(T* b, int n, int m);
|
|
1809
|
+
/**
|
|
1810
|
+
* \brief Reallocate block of \a n pointers starting at \a b to \a m objects of type \a T* from the space heap
|
|
1811
|
+
*
|
|
1812
|
+
* Returns the address of the new block.
|
|
1813
|
+
*
|
|
1814
|
+
* This is a specialization for performance.
|
|
1815
|
+
*/
|
|
1816
|
+
template<class T>
|
|
1817
|
+
T** realloc(T** b, long unsigned int n, long unsigned int m);
|
|
1818
|
+
/**
|
|
1819
|
+
* \brief Reallocate block of \a n pointers starting at \a b to \a m objects of type \a T* from the space heap
|
|
1820
|
+
*
|
|
1821
|
+
* Returns the address of the new block.
|
|
1822
|
+
*
|
|
1823
|
+
* This is a specialization for performance.
|
|
1824
|
+
*/
|
|
1825
|
+
template<class T>
|
|
1826
|
+
T** realloc(T** b, long int n, long int m);
|
|
1827
|
+
/**
|
|
1828
|
+
* \brief Reallocate block of \a n pointers starting at \a b to \a m objects of type \a T* from the space heap
|
|
1829
|
+
*
|
|
1830
|
+
* Returns the address of the new block.
|
|
1831
|
+
*
|
|
1832
|
+
* This is a specialization for performance.
|
|
1833
|
+
*/
|
|
1834
|
+
template<class T>
|
|
1835
|
+
T** realloc(T** b, unsigned int n, unsigned int m);
|
|
1836
|
+
/**
|
|
1837
|
+
* \brief Reallocate block of \a n pointers starting at \a b to \a m objects of type \a T* from the space heap
|
|
1838
|
+
*
|
|
1839
|
+
* Returns the address of the new block.
|
|
1840
|
+
*
|
|
1841
|
+
* This is a specialization for performance.
|
|
1842
|
+
*/
|
|
1843
|
+
template<class T>
|
|
1844
|
+
T** realloc(T** b, int n, int m);
|
|
1845
|
+
/// Allocate memory on space heap
|
|
1846
|
+
void* ralloc(size_t s);
|
|
1847
|
+
/// Free memory previously allocated with alloc (might be reused later)
|
|
1848
|
+
void rfree(void* p, size_t s);
|
|
1849
|
+
/// Reallocate memory block starting at \a b from size \a n to size \a s
|
|
1850
|
+
void* rrealloc(void* b, size_t n, size_t m);
|
|
1851
|
+
/// Allocate from freelist-managed memory
|
|
1852
|
+
template<size_t> void* fl_alloc(void);
|
|
1853
|
+
/**
|
|
1854
|
+
* \brief Return freelist-managed memory to freelist
|
|
1855
|
+
*
|
|
1856
|
+
* The first list element to be retuned is \a f, the last is \a l.
|
|
1857
|
+
*/
|
|
1858
|
+
template<size_t> void fl_dispose(FreeList* f, FreeList* l);
|
|
1859
|
+
/**
|
|
1860
|
+
* \brief Return how much heap memory is allocated
|
|
1861
|
+
*
|
|
1862
|
+
* Note that is includes both the memory allocated for the space heap
|
|
1863
|
+
* as well as additional memory allocated by actors.
|
|
1864
|
+
*/
|
|
1865
|
+
size_t allocated(void) const;
|
|
1866
|
+
/**
|
|
1867
|
+
* \brief Flush cached memory blocks and AFC information
|
|
1868
|
+
*
|
|
1869
|
+
* All spaces that are obtained as non-shared clones from some same space
|
|
1870
|
+
* try to cache memory blocks from failed spaces. To minimize memory
|
|
1871
|
+
* consumption, these blocks can be flushed.
|
|
1872
|
+
*
|
|
1873
|
+
* Also, the numbers for AFC are reset to zero.
|
|
1874
|
+
*/
|
|
1875
|
+
GECODE_KERNEL_EXPORT void flush(void);
|
|
1876
|
+
//@}
|
|
1877
|
+
/// Construction routines
|
|
1878
|
+
//@{
|
|
1879
|
+
/**
|
|
1880
|
+
* \brief Constructs a single object of type \a T from space heap using the default constructor.
|
|
1881
|
+
*/
|
|
1882
|
+
template<class T>
|
|
1883
|
+
T& construct(void);
|
|
1884
|
+
/**
|
|
1885
|
+
* \brief Constructs a single object of type \a T from space heap using a unary constructor.
|
|
1886
|
+
*
|
|
1887
|
+
* The parameter is passed as a const reference.
|
|
1888
|
+
*/
|
|
1889
|
+
template<class T, typename A1>
|
|
1890
|
+
T& construct(A1 const& a1);
|
|
1891
|
+
/**
|
|
1892
|
+
* \brief Constructs a single object of type \a T from space heap using a binary constructor.
|
|
1893
|
+
*
|
|
1894
|
+
* The parameters are passed as const references.
|
|
1895
|
+
*/
|
|
1896
|
+
template<class T, typename A1, typename A2>
|
|
1897
|
+
T& construct(A1 const& a1, A2 const& a2);
|
|
1898
|
+
/**
|
|
1899
|
+
* \brief Constructs a single object of type \a T from space heap using a ternary constructor.
|
|
1900
|
+
*
|
|
1901
|
+
* The parameters are passed as const references.
|
|
1902
|
+
*/
|
|
1903
|
+
template<class T, typename A1, typename A2, typename A3>
|
|
1904
|
+
T& construct(A1 const& a1, A2 const& a2, A3 const& a3);
|
|
1905
|
+
/**
|
|
1906
|
+
* \brief Constructs a single object of type \a T from space heap using a quaternary constructor.
|
|
1907
|
+
*
|
|
1908
|
+
* The parameters are passed as const references.
|
|
1909
|
+
*/
|
|
1910
|
+
template<class T, typename A1, typename A2, typename A3, typename A4>
|
|
1911
|
+
T& construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4);
|
|
1912
|
+
/**
|
|
1913
|
+
* \brief Constructs a single object of type \a T from space heap using a quinary constructor.
|
|
1914
|
+
*
|
|
1915
|
+
* The parameters are passed as const references.
|
|
1916
|
+
*/
|
|
1917
|
+
template<class T, typename A1, typename A2, typename A3, typename A4, typename A5>
|
|
1918
|
+
T& construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5);
|
|
1919
|
+
//@}
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* \brief Class to iterate over propagators of a space
|
|
1923
|
+
*
|
|
1924
|
+
* Note that the iterator cannot be used during cloning.
|
|
1925
|
+
*/
|
|
1926
|
+
class Propagators {
|
|
1927
|
+
private:
|
|
1928
|
+
/// current space
|
|
1929
|
+
const Space& home;
|
|
1930
|
+
/// current queue
|
|
1931
|
+
const ActorLink* q;
|
|
1932
|
+
/// current propagator
|
|
1933
|
+
const ActorLink* c;
|
|
1934
|
+
/// end mark
|
|
1935
|
+
const ActorLink* e;
|
|
1936
|
+
public:
|
|
1937
|
+
/// Initialize
|
|
1938
|
+
Propagators(const Space& home);
|
|
1939
|
+
/// Test whether there are propagators left
|
|
1940
|
+
bool operator ()(void) const;
|
|
1941
|
+
/// Move iterator to next propagator
|
|
1942
|
+
void operator ++(void);
|
|
1943
|
+
/// Return propagator
|
|
1944
|
+
const Propagator& propagator(void) const;
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
/**
|
|
1948
|
+
* \brief Class to iterate over branchers of a space
|
|
1949
|
+
*
|
|
1950
|
+
* Note that the iterator cannot be used during cloning.
|
|
1951
|
+
*/
|
|
1952
|
+
class Branchers {
|
|
1953
|
+
private:
|
|
1954
|
+
/// current brancher
|
|
1955
|
+
const ActorLink* c;
|
|
1956
|
+
/// end mark
|
|
1957
|
+
const ActorLink* e;
|
|
1958
|
+
public:
|
|
1959
|
+
/// Initialize
|
|
1960
|
+
Branchers(const Space& home);
|
|
1961
|
+
/// Test whether there are branchers left
|
|
1962
|
+
bool operator ()(void) const;
|
|
1963
|
+
/// Move iterator to next brancher
|
|
1964
|
+
void operator ++(void);
|
|
1965
|
+
/// Return propagator
|
|
1966
|
+
const Brancher& brancher(void) const;
|
|
1967
|
+
};
|
|
1968
|
+
};
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
/*
|
|
1974
|
+
* Memory management
|
|
1975
|
+
*
|
|
1976
|
+
*/
|
|
1977
|
+
|
|
1978
|
+
// Heap allocated
|
|
1979
|
+
forceinline void*
|
|
1980
|
+
SharedHandle::Object::operator new(size_t s) {
|
|
1981
|
+
return heap.ralloc(s);
|
|
1982
|
+
}
|
|
1983
|
+
forceinline void
|
|
1984
|
+
SharedHandle::Object::operator delete(void* p) {
|
|
1985
|
+
heap.rfree(p);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
forceinline void*
|
|
1989
|
+
Space::operator new(size_t s) {
|
|
1990
|
+
return heap.ralloc(s);
|
|
1991
|
+
}
|
|
1992
|
+
forceinline void
|
|
1993
|
+
Space::operator delete(void* p) {
|
|
1994
|
+
heap.rfree(p);
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
forceinline void
|
|
1998
|
+
Choice::operator delete(void* p) {
|
|
1999
|
+
heap.rfree(p);
|
|
2000
|
+
}
|
|
2001
|
+
forceinline void*
|
|
2002
|
+
Choice::operator new(size_t s) {
|
|
2003
|
+
return heap.ralloc(s);
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
// Space allocation: general space heaps and free lists
|
|
2007
|
+
forceinline void*
|
|
2008
|
+
Space::ralloc(size_t s) {
|
|
2009
|
+
return mm.alloc(sm,s);
|
|
2010
|
+
}
|
|
2011
|
+
forceinline void
|
|
2012
|
+
Space::rfree(void* p, size_t s) {
|
|
2013
|
+
return mm.reuse(p,s);
|
|
2014
|
+
}
|
|
2015
|
+
forceinline void*
|
|
2016
|
+
Space::rrealloc(void* _b, size_t n, size_t m) {
|
|
2017
|
+
char* b = static_cast<char*>(_b);
|
|
2018
|
+
if (n < m) {
|
|
2019
|
+
char* p = static_cast<char*>(ralloc(m));
|
|
2020
|
+
memcpy(p,b,n);
|
|
2021
|
+
rfree(b,n);
|
|
2022
|
+
return p;
|
|
2023
|
+
} else {
|
|
2024
|
+
rfree(b+m,m-n);
|
|
2025
|
+
return b;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
template<size_t s>
|
|
2030
|
+
forceinline void*
|
|
2031
|
+
Space::fl_alloc(void) {
|
|
2032
|
+
return mm.template fl_alloc<s>(sm);
|
|
2033
|
+
}
|
|
2034
|
+
template<size_t s>
|
|
2035
|
+
forceinline void
|
|
2036
|
+
Space::fl_dispose(FreeList* f, FreeList* l) {
|
|
2037
|
+
mm.template fl_dispose<s>(f,l);
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
forceinline size_t
|
|
2041
|
+
Space::allocated(void) const {
|
|
2042
|
+
size_t s = mm.allocated();
|
|
2043
|
+
for (Actor** a = d_fst; a < d_cur; a++)
|
|
2044
|
+
s += (*a)->allocated();
|
|
2045
|
+
return s;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/*
|
|
2049
|
+
* Typed allocation routines
|
|
2050
|
+
*
|
|
2051
|
+
*/
|
|
2052
|
+
template<class T>
|
|
2053
|
+
forceinline T*
|
|
2054
|
+
Space::alloc(long unsigned int n) {
|
|
2055
|
+
T* p = static_cast<T*>(ralloc(sizeof(T)*n));
|
|
2056
|
+
for (long unsigned int i=n; i--; )
|
|
2057
|
+
(void) new (p+i) T();
|
|
2058
|
+
return p;
|
|
2059
|
+
}
|
|
2060
|
+
template<class T>
|
|
2061
|
+
forceinline T*
|
|
2062
|
+
Space::alloc(long int n) {
|
|
2063
|
+
assert(n >= 0);
|
|
2064
|
+
return alloc<T>(static_cast<long unsigned int>(n));
|
|
2065
|
+
}
|
|
2066
|
+
template<class T>
|
|
2067
|
+
forceinline T*
|
|
2068
|
+
Space::alloc(unsigned int n) {
|
|
2069
|
+
return alloc<T>(static_cast<long unsigned int>(n));
|
|
2070
|
+
}
|
|
2071
|
+
template<class T>
|
|
2072
|
+
forceinline T*
|
|
2073
|
+
Space::alloc(int n) {
|
|
2074
|
+
assert(n >= 0);
|
|
2075
|
+
return alloc<T>(static_cast<long unsigned int>(n));
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
template<class T>
|
|
2079
|
+
forceinline void
|
|
2080
|
+
Space::free(T* b, long unsigned int n) {
|
|
2081
|
+
for (long unsigned int i=n; i--; )
|
|
2082
|
+
b[i].~T();
|
|
2083
|
+
rfree(b,n*sizeof(T));
|
|
2084
|
+
}
|
|
2085
|
+
template<class T>
|
|
2086
|
+
forceinline void
|
|
2087
|
+
Space::free(T* b, long int n) {
|
|
2088
|
+
assert(n >= 0);
|
|
2089
|
+
free<T>(b,static_cast<long unsigned int>(n));
|
|
2090
|
+
}
|
|
2091
|
+
template<class T>
|
|
2092
|
+
forceinline void
|
|
2093
|
+
Space::free(T* b, unsigned int n) {
|
|
2094
|
+
free<T>(b,static_cast<long unsigned int>(n));
|
|
2095
|
+
}
|
|
2096
|
+
template<class T>
|
|
2097
|
+
forceinline void
|
|
2098
|
+
Space::free(T* b, int n) {
|
|
2099
|
+
assert(n >= 0);
|
|
2100
|
+
free<T>(b,static_cast<long unsigned int>(n));
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
template<class T>
|
|
2104
|
+
forceinline T*
|
|
2105
|
+
Space::realloc(T* b, long unsigned int n, long unsigned int m) {
|
|
2106
|
+
if (n < m) {
|
|
2107
|
+
T* p = static_cast<T*>(ralloc(sizeof(T)*m));
|
|
2108
|
+
for (long unsigned int i=n; i--; )
|
|
2109
|
+
(void) new (p+i) T(b[i]);
|
|
2110
|
+
for (long unsigned int i=n; i<m; i++)
|
|
2111
|
+
(void) new (p+i) T();
|
|
2112
|
+
free<T>(b,n);
|
|
2113
|
+
return p;
|
|
2114
|
+
} else {
|
|
2115
|
+
free<T>(b+m,m-n);
|
|
2116
|
+
return b;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
template<class T>
|
|
2120
|
+
forceinline T*
|
|
2121
|
+
Space::realloc(T* b, long int n, long int m) {
|
|
2122
|
+
assert((n >= 0) && (m >= 0));
|
|
2123
|
+
return realloc<T>(b,static_cast<long unsigned int>(n),
|
|
2124
|
+
static_cast<long unsigned int>(m));
|
|
2125
|
+
}
|
|
2126
|
+
template<class T>
|
|
2127
|
+
forceinline T*
|
|
2128
|
+
Space::realloc(T* b, unsigned int n, unsigned int m) {
|
|
2129
|
+
return realloc<T>(b,static_cast<long unsigned int>(n),
|
|
2130
|
+
static_cast<long unsigned int>(m));
|
|
2131
|
+
}
|
|
2132
|
+
template<class T>
|
|
2133
|
+
forceinline T*
|
|
2134
|
+
Space::realloc(T* b, int n, int m) {
|
|
2135
|
+
assert((n >= 0) && (m >= 0));
|
|
2136
|
+
return realloc<T>(b,static_cast<long unsigned int>(n),
|
|
2137
|
+
static_cast<long unsigned int>(m));
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
#define GECODE_KERNEL_REALLOC(T) \
|
|
2141
|
+
template<> \
|
|
2142
|
+
forceinline T* \
|
|
2143
|
+
Space::realloc<T>(T* b, long unsigned int n, long unsigned int m) { \
|
|
2144
|
+
return static_cast<T*>(rrealloc(b,n*sizeof(T),m*sizeof(T))); \
|
|
2145
|
+
} \
|
|
2146
|
+
template<> \
|
|
2147
|
+
forceinline T* \
|
|
2148
|
+
Space::realloc<T>(T* b, long int n, long int m) { \
|
|
2149
|
+
assert((n >= 0) && (m >= 0)); \
|
|
2150
|
+
return realloc<T>(b,static_cast<long unsigned int>(n), \
|
|
2151
|
+
static_cast<long unsigned int>(m)); \
|
|
2152
|
+
} \
|
|
2153
|
+
template<> \
|
|
2154
|
+
forceinline T* \
|
|
2155
|
+
Space::realloc<T>(T* b, unsigned int n, unsigned int m) { \
|
|
2156
|
+
return realloc<T>(b,static_cast<long unsigned int>(n), \
|
|
2157
|
+
static_cast<long unsigned int>(m)); \
|
|
2158
|
+
} \
|
|
2159
|
+
template<> \
|
|
2160
|
+
forceinline T* \
|
|
2161
|
+
Space::realloc<T>(T* b, int n, int m) { \
|
|
2162
|
+
assert((n >= 0) && (m >= 0)); \
|
|
2163
|
+
return realloc<T>(b,static_cast<long unsigned int>(n), \
|
|
2164
|
+
static_cast<long unsigned int>(m)); \
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
GECODE_KERNEL_REALLOC(bool)
|
|
2168
|
+
GECODE_KERNEL_REALLOC(signed char)
|
|
2169
|
+
GECODE_KERNEL_REALLOC(unsigned char)
|
|
2170
|
+
GECODE_KERNEL_REALLOC(signed short int)
|
|
2171
|
+
GECODE_KERNEL_REALLOC(unsigned short int)
|
|
2172
|
+
GECODE_KERNEL_REALLOC(signed int)
|
|
2173
|
+
GECODE_KERNEL_REALLOC(unsigned int)
|
|
2174
|
+
GECODE_KERNEL_REALLOC(signed long int)
|
|
2175
|
+
GECODE_KERNEL_REALLOC(unsigned long int)
|
|
2176
|
+
GECODE_KERNEL_REALLOC(float)
|
|
2177
|
+
GECODE_KERNEL_REALLOC(double)
|
|
2178
|
+
|
|
2179
|
+
#undef GECODE_KERNEL_REALLOC
|
|
2180
|
+
|
|
2181
|
+
template<class T>
|
|
2182
|
+
forceinline T**
|
|
2183
|
+
Space::realloc(T** b, long unsigned int n, long unsigned int m) {
|
|
2184
|
+
return static_cast<T**>(rrealloc(b,n*sizeof(T),m*sizeof(T*)));
|
|
2185
|
+
}
|
|
2186
|
+
template<class T>
|
|
2187
|
+
forceinline T**
|
|
2188
|
+
Space::realloc(T** b, long int n, long int m) {
|
|
2189
|
+
assert((n >= 0) && (m >= 0));
|
|
2190
|
+
return realloc<T*>(b,static_cast<long unsigned int>(n),
|
|
2191
|
+
static_cast<long unsigned int>(m));
|
|
2192
|
+
}
|
|
2193
|
+
template<class T>
|
|
2194
|
+
forceinline T**
|
|
2195
|
+
Space::realloc(T** b, unsigned int n, unsigned int m) {
|
|
2196
|
+
return realloc<T*>(b,static_cast<long unsigned int>(n),
|
|
2197
|
+
static_cast<long unsigned int>(m));
|
|
2198
|
+
}
|
|
2199
|
+
template<class T>
|
|
2200
|
+
forceinline T**
|
|
2201
|
+
Space::realloc(T** b, int n, int m) {
|
|
2202
|
+
assert((n >= 0) && (m >= 0));
|
|
2203
|
+
return realloc<T*>(b,static_cast<long unsigned int>(n),
|
|
2204
|
+
static_cast<long unsigned int>(m));
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
#ifdef GECODE_HAS_VAR_DISPOSE
|
|
2209
|
+
template<class VIC>
|
|
2210
|
+
forceinline VarImpBase*
|
|
2211
|
+
Space::vars_d(void) const {
|
|
2212
|
+
return _vars_d[VIC::idx_d];
|
|
2213
|
+
}
|
|
2214
|
+
template<class VIC>
|
|
2215
|
+
forceinline void
|
|
2216
|
+
Space::vars_d(VarImpBase* x) {
|
|
2217
|
+
_vars_d[VIC::idx_d] = x;
|
|
2218
|
+
}
|
|
2219
|
+
#endif
|
|
2220
|
+
|
|
2221
|
+
// Space allocated entities: Actors, variable implementations, and advisors
|
|
2222
|
+
forceinline void
|
|
2223
|
+
Actor::operator delete(void*) {}
|
|
2224
|
+
forceinline void
|
|
2225
|
+
Actor::operator delete(void*, Space&) {}
|
|
2226
|
+
forceinline void*
|
|
2227
|
+
Actor::operator new(size_t s, Space& home) {
|
|
2228
|
+
return home.ralloc(s);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
template<class VIC>
|
|
2232
|
+
forceinline void
|
|
2233
|
+
VarImp<VIC>::operator delete(void*) {}
|
|
2234
|
+
template<class VIC>
|
|
2235
|
+
forceinline void
|
|
2236
|
+
VarImp<VIC>::operator delete(void*, Space&) {}
|
|
2237
|
+
template<class VIC>
|
|
2238
|
+
forceinline void*
|
|
2239
|
+
VarImp<VIC>::operator new(size_t s, Space& home) {
|
|
2240
|
+
return home.ralloc(s);
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
#ifndef __GNUC__
|
|
2244
|
+
forceinline void
|
|
2245
|
+
Advisor::operator delete(void*) {}
|
|
2246
|
+
#endif
|
|
2247
|
+
forceinline void
|
|
2248
|
+
Advisor::operator delete(void*, Space&) {}
|
|
2249
|
+
forceinline void*
|
|
2250
|
+
Advisor::operator new(size_t s, Space& home) {
|
|
2251
|
+
return home.ralloc(s);
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/*
|
|
2255
|
+
* Shared objects and handles
|
|
2256
|
+
*
|
|
2257
|
+
*/
|
|
2258
|
+
forceinline
|
|
2259
|
+
SharedHandle::Object::Object(void)
|
|
2260
|
+
: next(NULL), fwd(NULL), use_cnt(0) {}
|
|
2261
|
+
forceinline
|
|
2262
|
+
SharedHandle::Object::~Object(void) {
|
|
2263
|
+
assert(use_cnt == 0);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
forceinline SharedHandle::Object*
|
|
2267
|
+
SharedHandle::object(void) const {
|
|
2268
|
+
return o;
|
|
2269
|
+
}
|
|
2270
|
+
forceinline void
|
|
2271
|
+
SharedHandle::subscribe(void) {
|
|
2272
|
+
if (o != NULL) o->use_cnt++;
|
|
2273
|
+
}
|
|
2274
|
+
forceinline void
|
|
2275
|
+
SharedHandle::cancel(void) {
|
|
2276
|
+
if ((o != NULL) && (--o->use_cnt == 0))
|
|
2277
|
+
delete o;
|
|
2278
|
+
o=NULL;
|
|
2279
|
+
}
|
|
2280
|
+
forceinline void
|
|
2281
|
+
SharedHandle::object(SharedHandle::Object* n) {
|
|
2282
|
+
if (n != o) {
|
|
2283
|
+
cancel(); o=n; subscribe();
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
forceinline
|
|
2287
|
+
SharedHandle::SharedHandle(void) : o(NULL) {}
|
|
2288
|
+
forceinline
|
|
2289
|
+
SharedHandle::SharedHandle(SharedHandle::Object* so) : o(so) {
|
|
2290
|
+
subscribe();
|
|
2291
|
+
}
|
|
2292
|
+
forceinline
|
|
2293
|
+
SharedHandle::SharedHandle(const SharedHandle& sh) : o(sh.o) {
|
|
2294
|
+
subscribe();
|
|
2295
|
+
}
|
|
2296
|
+
forceinline SharedHandle&
|
|
2297
|
+
SharedHandle::operator =(const SharedHandle& sh) {
|
|
2298
|
+
if (&sh != this) {
|
|
2299
|
+
cancel(); o=sh.o; subscribe();
|
|
2300
|
+
}
|
|
2301
|
+
return *this;
|
|
2302
|
+
}
|
|
2303
|
+
forceinline void
|
|
2304
|
+
SharedHandle::update(Space& home, bool share, SharedHandle& sh) {
|
|
2305
|
+
if (sh.o == NULL) {
|
|
2306
|
+
o=NULL; return;
|
|
2307
|
+
} else if (share) {
|
|
2308
|
+
o=sh.o;
|
|
2309
|
+
} else if (sh.o->fwd != NULL) {
|
|
2310
|
+
o=sh.o->fwd;
|
|
2311
|
+
} else {
|
|
2312
|
+
o = sh.o->copy();
|
|
2313
|
+
sh.o->fwd = o;
|
|
2314
|
+
sh.o->next = home.pc.c.shared;
|
|
2315
|
+
home.pc.c.shared = sh.o;
|
|
2316
|
+
}
|
|
2317
|
+
subscribe();
|
|
2318
|
+
}
|
|
2319
|
+
forceinline
|
|
2320
|
+
SharedHandle::~SharedHandle(void) {
|
|
2321
|
+
cancel();
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
/*
|
|
2327
|
+
* ActorLink
|
|
2328
|
+
*
|
|
2329
|
+
*/
|
|
2330
|
+
forceinline ActorLink*
|
|
2331
|
+
ActorLink::prev(void) const {
|
|
2332
|
+
return _prev;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
forceinline ActorLink*
|
|
2336
|
+
ActorLink::next(void) const {
|
|
2337
|
+
return _next;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
forceinline ActorLink**
|
|
2341
|
+
ActorLink::next_ref(void) {
|
|
2342
|
+
return &_next;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
forceinline void
|
|
2346
|
+
ActorLink::prev(ActorLink* al) {
|
|
2347
|
+
_prev = al;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
forceinline void
|
|
2351
|
+
ActorLink::next(ActorLink* al) {
|
|
2352
|
+
_next = al;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
forceinline void
|
|
2356
|
+
ActorLink::unlink(void) {
|
|
2357
|
+
ActorLink* p = _prev; ActorLink* n = _next;
|
|
2358
|
+
p->_next = n; n->_prev = p;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
forceinline void
|
|
2362
|
+
ActorLink::init(void) {
|
|
2363
|
+
_next = this; _prev =this;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
forceinline void
|
|
2367
|
+
ActorLink::head(ActorLink* a) {
|
|
2368
|
+
// Inserts al at head of link-chain (that is, after this)
|
|
2369
|
+
ActorLink* n = _next;
|
|
2370
|
+
this->_next = a; a->_prev = this;
|
|
2371
|
+
a->_next = n; n->_prev = a;
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
forceinline void
|
|
2375
|
+
ActorLink::tail(ActorLink* a) {
|
|
2376
|
+
// Inserts al at tail of link-chain (that is, before this)
|
|
2377
|
+
ActorLink* p = _prev;
|
|
2378
|
+
a->_next = this; this->_prev = a;
|
|
2379
|
+
p->_next = a; a->_prev = p;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
forceinline bool
|
|
2383
|
+
ActorLink::empty(void) const {
|
|
2384
|
+
return _next == this;
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
template<class T>
|
|
2388
|
+
forceinline ActorLink*
|
|
2389
|
+
ActorLink::cast(T* a) {
|
|
2390
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2391
|
+
GECODE_NOT_NULL(a);
|
|
2392
|
+
ActorLink& t = *a;
|
|
2393
|
+
return static_cast<ActorLink*>(&t);
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
template<class T>
|
|
2397
|
+
forceinline const ActorLink*
|
|
2398
|
+
ActorLink::cast(const T* a) {
|
|
2399
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2400
|
+
GECODE_NOT_NULL(a);
|
|
2401
|
+
const ActorLink& t = *a;
|
|
2402
|
+
return static_cast<const ActorLink*>(&t);
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
/*
|
|
2407
|
+
* Actor
|
|
2408
|
+
*
|
|
2409
|
+
*/
|
|
2410
|
+
forceinline Actor*
|
|
2411
|
+
Actor::cast(ActorLink* al) {
|
|
2412
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2413
|
+
GECODE_NOT_NULL(al);
|
|
2414
|
+
ActorLink& t = *al;
|
|
2415
|
+
return static_cast<Actor*>(&t);
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
forceinline const Actor*
|
|
2419
|
+
Actor::cast(const ActorLink* al) {
|
|
2420
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2421
|
+
GECODE_NOT_NULL(al);
|
|
2422
|
+
const ActorLink& t = *al;
|
|
2423
|
+
return static_cast<const Actor*>(&t);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
forceinline void
|
|
2427
|
+
Space::notice(Actor& a, ActorProperty p) {
|
|
2428
|
+
if (p & AP_DISPOSE) {
|
|
2429
|
+
if (d_cur == d_lst)
|
|
2430
|
+
d_resize();
|
|
2431
|
+
*(d_cur++) = &a;
|
|
2432
|
+
}
|
|
2433
|
+
if (p & AP_WEAKLY) {
|
|
2434
|
+
if (n_wmp == 0)
|
|
2435
|
+
n_wmp = 2;
|
|
2436
|
+
else
|
|
2437
|
+
n_wmp++;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
forceinline void
|
|
2442
|
+
Home::notice(Actor& a, ActorProperty p) {
|
|
2443
|
+
s.notice(a,p);
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
forceinline void
|
|
2447
|
+
Space::ignore(Actor& a, ActorProperty p) {
|
|
2448
|
+
if (p & AP_DISPOSE) {
|
|
2449
|
+
// Check wether array has already been discarded as space
|
|
2450
|
+
// deletion is already in progress
|
|
2451
|
+
Actor** f = d_fst;
|
|
2452
|
+
if (f != NULL) {
|
|
2453
|
+
while (&a != *f)
|
|
2454
|
+
f++;
|
|
2455
|
+
*f = *(--d_cur);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
if (p & AP_WEAKLY) {
|
|
2459
|
+
assert(n_wmp > 1);
|
|
2460
|
+
n_wmp--;
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
forceinline Space*
|
|
2465
|
+
Space::clone(bool share, CloneStatistics&) const {
|
|
2466
|
+
// Clone is only const for search engines. During cloning, several data
|
|
2467
|
+
// structures are updated (e.g. forwarding pointers), so we have to
|
|
2468
|
+
// cast away the constness.
|
|
2469
|
+
return const_cast<Space*>(this)->_clone(share);
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
forceinline void
|
|
2473
|
+
Space::commit(const Choice& c, unsigned int a, CommitStatistics&) {
|
|
2474
|
+
_commit(c,a);
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
forceinline size_t
|
|
2478
|
+
Actor::dispose(Space&) {
|
|
2479
|
+
return sizeof(*this);
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
/*
|
|
2484
|
+
* Home for posting actors
|
|
2485
|
+
*
|
|
2486
|
+
*/
|
|
2487
|
+
forceinline
|
|
2488
|
+
Home::Home(Space& s0, Propagator* p0) : s(s0), p(p0) {}
|
|
2489
|
+
forceinline
|
|
2490
|
+
Home::operator Space&(void) {
|
|
2491
|
+
return s;
|
|
2492
|
+
}
|
|
2493
|
+
forceinline Home
|
|
2494
|
+
Home::operator ()(Propagator& p) {
|
|
2495
|
+
return Home(s,&p);
|
|
2496
|
+
}
|
|
2497
|
+
forceinline Home
|
|
2498
|
+
Space::operator ()(Propagator& p) {
|
|
2499
|
+
return Home(*this,&p);
|
|
2500
|
+
}
|
|
2501
|
+
forceinline Propagator*
|
|
2502
|
+
Home::propagator(void) const {
|
|
2503
|
+
return p;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/*
|
|
2507
|
+
* Propagator
|
|
2508
|
+
*
|
|
2509
|
+
*/
|
|
2510
|
+
forceinline Propagator*
|
|
2511
|
+
Propagator::cast(ActorLink* al) {
|
|
2512
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2513
|
+
GECODE_NOT_NULL(al);
|
|
2514
|
+
ActorLink& t = *al;
|
|
2515
|
+
return static_cast<Propagator*>(&t);
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
forceinline const Propagator*
|
|
2519
|
+
Propagator::cast(const ActorLink* al) {
|
|
2520
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2521
|
+
GECODE_NOT_NULL(al);
|
|
2522
|
+
const ActorLink& t = *al;
|
|
2523
|
+
return static_cast<const Propagator*>(&t);
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
forceinline
|
|
2527
|
+
Propagator::Propagator(Home home)
|
|
2528
|
+
: pi((home.propagator() != NULL) ?
|
|
2529
|
+
// Inherit propagator information
|
|
2530
|
+
home.propagator()->pi :
|
|
2531
|
+
// New propagator information
|
|
2532
|
+
static_cast<Space&>(home).gpi.allocate()) {
|
|
2533
|
+
u.advisors = NULL;
|
|
2534
|
+
assert((u.med == 0) && (u.size == 0));
|
|
2535
|
+
static_cast<Space&>(home).pl.head(this);
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
forceinline
|
|
2539
|
+
Propagator::Propagator(Space&, bool, Propagator& p)
|
|
2540
|
+
: pi(p.pi) {
|
|
2541
|
+
u.advisors = NULL;
|
|
2542
|
+
assert((u.med == 0) && (u.size == 0));
|
|
2543
|
+
// Set forwarding pointer
|
|
2544
|
+
p.prev(this);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
forceinline ModEventDelta
|
|
2548
|
+
Propagator::modeventdelta(void) const {
|
|
2549
|
+
return u.med;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
forceinline double
|
|
2553
|
+
Propagator::afc(void) const {
|
|
2554
|
+
return pi.afc();
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
forceinline ExecStatus
|
|
2558
|
+
Space::ES_SUBSUMED_DISPOSED(Propagator& p, size_t s) {
|
|
2559
|
+
p.u.size = s;
|
|
2560
|
+
return __ES_SUBSUMED;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
forceinline ExecStatus
|
|
2564
|
+
Space::ES_SUBSUMED(Propagator& p) {
|
|
2565
|
+
p.u.size = p.dispose(*this);
|
|
2566
|
+
return __ES_SUBSUMED;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
forceinline ExecStatus
|
|
2570
|
+
Space::ES_FIX_PARTIAL(Propagator& p, const ModEventDelta& med) {
|
|
2571
|
+
p.u.med = med;
|
|
2572
|
+
assert(p.u.med != 0);
|
|
2573
|
+
return __ES_PARTIAL;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
forceinline ExecStatus
|
|
2577
|
+
Space::ES_NOFIX_PARTIAL(Propagator& p, const ModEventDelta& med) {
|
|
2578
|
+
p.u.med = AllVarConf::med_combine(p.u.med,med);
|
|
2579
|
+
assert(p.u.med != 0);
|
|
2580
|
+
return __ES_PARTIAL;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
/*
|
|
2586
|
+
* Brancher
|
|
2587
|
+
*
|
|
2588
|
+
*/
|
|
2589
|
+
forceinline Brancher*
|
|
2590
|
+
Brancher::cast(ActorLink* al) {
|
|
2591
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2592
|
+
GECODE_NOT_NULL(al);
|
|
2593
|
+
ActorLink& t = *al;
|
|
2594
|
+
return static_cast<Brancher*>(&t);
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
forceinline const Brancher*
|
|
2598
|
+
Brancher::cast(const ActorLink* al) {
|
|
2599
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2600
|
+
GECODE_NOT_NULL(al);
|
|
2601
|
+
const ActorLink& t = *al;
|
|
2602
|
+
return static_cast<const Brancher*>(&t);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
forceinline
|
|
2606
|
+
Brancher::Brancher(Home home) :
|
|
2607
|
+
_id(static_cast<Space&>(home).pc.p.branch_id++) {
|
|
2608
|
+
if (static_cast<Space&>(home).pc.p.branch_id == 0U)
|
|
2609
|
+
throw TooManyBranchers("Brancher::Brancher");
|
|
2610
|
+
// If no brancher available, make it the first one
|
|
2611
|
+
if (static_cast<Space&>(home).b_status == &static_cast<Space&>(home).bl) {
|
|
2612
|
+
static_cast<Space&>(home).b_status = this;
|
|
2613
|
+
if (static_cast<Space&>(home).b_commit == &static_cast<Space&>(home).bl)
|
|
2614
|
+
static_cast<Space&>(home).b_commit = this;
|
|
2615
|
+
}
|
|
2616
|
+
static_cast<Space&>(home).bl.tail(this);
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
forceinline
|
|
2620
|
+
Brancher::Brancher(Space&, bool, Brancher& b)
|
|
2621
|
+
: _id(b._id) {
|
|
2622
|
+
// Set forwarding pointer
|
|
2623
|
+
b.prev(this);
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
forceinline unsigned int
|
|
2627
|
+
Brancher::id(void) const {
|
|
2628
|
+
return _id;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
/*
|
|
2632
|
+
* Local objects
|
|
2633
|
+
*
|
|
2634
|
+
*/
|
|
2635
|
+
|
|
2636
|
+
forceinline LocalObject*
|
|
2637
|
+
LocalObject::cast(ActorLink* al) {
|
|
2638
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2639
|
+
GECODE_NOT_NULL(al);
|
|
2640
|
+
ActorLink& t = *al;
|
|
2641
|
+
return static_cast<LocalObject*>(&t);
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
forceinline const LocalObject*
|
|
2645
|
+
LocalObject::cast(const ActorLink* al) {
|
|
2646
|
+
// Turning al into a reference is for gcc, assume is for MSVC
|
|
2647
|
+
GECODE_NOT_NULL(al);
|
|
2648
|
+
const ActorLink& t = *al;
|
|
2649
|
+
return static_cast<const LocalObject*>(&t);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
forceinline
|
|
2653
|
+
LocalObject::LocalObject(Home) {
|
|
2654
|
+
ActorLink::cast(this)->prev(NULL);
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
forceinline
|
|
2658
|
+
LocalObject::LocalObject(Space&,bool,LocalObject&) {
|
|
2659
|
+
ActorLink::cast(this)->prev(NULL);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
forceinline LocalObject*
|
|
2663
|
+
LocalObject::fwd(Space& home, bool share) {
|
|
2664
|
+
if (prev() == NULL)
|
|
2665
|
+
fwdcopy(home,share);
|
|
2666
|
+
return LocalObject::cast(prev());
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
forceinline
|
|
2670
|
+
LocalHandle::LocalHandle(void) : o(NULL) {}
|
|
2671
|
+
forceinline
|
|
2672
|
+
LocalHandle::LocalHandle(LocalObject* lo) : o(lo) {}
|
|
2673
|
+
forceinline
|
|
2674
|
+
LocalHandle::LocalHandle(const LocalHandle& lh) : o(lh.o) {}
|
|
2675
|
+
forceinline LocalHandle&
|
|
2676
|
+
LocalHandle::operator =(const LocalHandle& lh) {
|
|
2677
|
+
o = lh.o;
|
|
2678
|
+
return *this;
|
|
2679
|
+
}
|
|
2680
|
+
forceinline
|
|
2681
|
+
LocalHandle::~LocalHandle(void) {}
|
|
2682
|
+
forceinline LocalObject*
|
|
2683
|
+
LocalHandle::object(void) const { return o; }
|
|
2684
|
+
forceinline void
|
|
2685
|
+
LocalHandle::object(LocalObject* n) { o = n; }
|
|
2686
|
+
forceinline void
|
|
2687
|
+
LocalHandle::update(Space& home, bool share, LocalHandle& lh) {
|
|
2688
|
+
object(lh.object()->fwd(home,share));
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
|
|
2692
|
+
/*
|
|
2693
|
+
* Choices
|
|
2694
|
+
*
|
|
2695
|
+
*/
|
|
2696
|
+
forceinline
|
|
2697
|
+
Choice::Choice(const Brancher& b, const unsigned int a)
|
|
2698
|
+
: _id(b.id()), _alt(a) {}
|
|
2699
|
+
|
|
2700
|
+
forceinline unsigned int
|
|
2701
|
+
Choice::alternatives(void) const {
|
|
2702
|
+
return _alt;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
forceinline unsigned int
|
|
2706
|
+
Choice::id(void) const {
|
|
2707
|
+
return _id;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
forceinline
|
|
2711
|
+
Choice::~Choice(void) {}
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
/*
|
|
2716
|
+
* Advisor
|
|
2717
|
+
*
|
|
2718
|
+
*/
|
|
2719
|
+
template<class A>
|
|
2720
|
+
forceinline
|
|
2721
|
+
Advisor::Advisor(Space&, Propagator& p, Council<A>& c) {
|
|
2722
|
+
// Store propagator and forwarding in prev()
|
|
2723
|
+
ActorLink::prev(&p);
|
|
2724
|
+
// Link to next advisor in next()
|
|
2725
|
+
ActorLink::next(c.advisors); c.advisors = static_cast<A*>(this);
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
forceinline
|
|
2729
|
+
Advisor::Advisor(Space&, bool, Advisor&) {}
|
|
2730
|
+
|
|
2731
|
+
forceinline bool
|
|
2732
|
+
Advisor::disposed(void) const {
|
|
2733
|
+
return prev() == NULL;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
forceinline Advisor*
|
|
2737
|
+
Advisor::cast(ActorLink* al) {
|
|
2738
|
+
return static_cast<Advisor*>(al);
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
forceinline const Advisor*
|
|
2742
|
+
Advisor::cast(const ActorLink* al) {
|
|
2743
|
+
return static_cast<const Advisor*>(al);
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
forceinline Propagator&
|
|
2747
|
+
Advisor::propagator(void) const {
|
|
2748
|
+
assert(!disposed());
|
|
2749
|
+
return *Propagator::cast(ActorLink::prev());
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
template<class A>
|
|
2753
|
+
forceinline void
|
|
2754
|
+
Advisor::dispose(Space&,Council<A>&) {
|
|
2755
|
+
assert(!disposed());
|
|
2756
|
+
ActorLink::prev(NULL);
|
|
2757
|
+
// Shorten chains of disposed advisors by one, if possible
|
|
2758
|
+
Advisor* n = Advisor::cast(next());
|
|
2759
|
+
if ((n != NULL) && n->disposed())
|
|
2760
|
+
next(n->next());
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
template<class A>
|
|
2764
|
+
forceinline ExecStatus
|
|
2765
|
+
Space::ES_FIX_DISPOSE(Council<A>& c, A& a) {
|
|
2766
|
+
a.dispose(*this,c);
|
|
2767
|
+
return ES_FIX;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
template<class A>
|
|
2771
|
+
forceinline ExecStatus
|
|
2772
|
+
Space::ES_NOFIX_DISPOSE(Council<A>& c, A& a) {
|
|
2773
|
+
a.dispose(*this,c);
|
|
2774
|
+
return ES_NOFIX;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
template<class A>
|
|
2778
|
+
forceinline ExecStatus
|
|
2779
|
+
Space::ES_NOFIX_DISPOSE_FORCE(Council<A>& c, A& a) {
|
|
2780
|
+
a.dispose(*this,c);
|
|
2781
|
+
return ES_NOFIX_FORCE;
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
/*
|
|
2787
|
+
* Advisor council
|
|
2788
|
+
*
|
|
2789
|
+
*/
|
|
2790
|
+
template<class A>
|
|
2791
|
+
forceinline
|
|
2792
|
+
Council<A>::Council(void) {}
|
|
2793
|
+
|
|
2794
|
+
template<class A>
|
|
2795
|
+
forceinline
|
|
2796
|
+
Council<A>::Council(Space&)
|
|
2797
|
+
: advisors(NULL) {}
|
|
2798
|
+
|
|
2799
|
+
template<class A>
|
|
2800
|
+
forceinline bool
|
|
2801
|
+
Council<A>::empty(void) const {
|
|
2802
|
+
ActorLink* a = advisors;
|
|
2803
|
+
while ((a != NULL) && static_cast<A*>(a)->disposed())
|
|
2804
|
+
a = a->next();
|
|
2805
|
+
advisors = a;
|
|
2806
|
+
return a == NULL;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
template<class A>
|
|
2810
|
+
forceinline void
|
|
2811
|
+
Council<A>::update(Space& home, bool share, Council<A>& c) {
|
|
2812
|
+
// Skip all disposed advisors
|
|
2813
|
+
{
|
|
2814
|
+
ActorLink* a = c.advisors;
|
|
2815
|
+
while ((a != NULL) && static_cast<A*>(a)->disposed())
|
|
2816
|
+
a = a->next();
|
|
2817
|
+
c.advisors = a;
|
|
2818
|
+
}
|
|
2819
|
+
// Are there any advisors to be cloned?
|
|
2820
|
+
if (c.advisors != NULL) {
|
|
2821
|
+
// The propagator in from-space
|
|
2822
|
+
Propagator* p_f = &static_cast<A*>(c.advisors)->propagator();
|
|
2823
|
+
// The propagator in to-space
|
|
2824
|
+
Propagator* p_t = Propagator::cast(p_f->prev());
|
|
2825
|
+
// Advisors in from-space
|
|
2826
|
+
ActorLink** a_f = &c.advisors;
|
|
2827
|
+
// Advisors in to-space
|
|
2828
|
+
A* a_t = NULL;
|
|
2829
|
+
while (*a_f != NULL) {
|
|
2830
|
+
if (static_cast<A*>(*a_f)->disposed()) {
|
|
2831
|
+
*a_f = (*a_f)->next();
|
|
2832
|
+
} else {
|
|
2833
|
+
// Run specific copying part
|
|
2834
|
+
A* a = new (home) A(home,share,*static_cast<A*>(*a_f));
|
|
2835
|
+
// Set propagator pointer
|
|
2836
|
+
a->prev(p_t);
|
|
2837
|
+
// Set forwarding pointer
|
|
2838
|
+
(*a_f)->prev(a);
|
|
2839
|
+
// Link
|
|
2840
|
+
a->next(a_t);
|
|
2841
|
+
a_t = a;
|
|
2842
|
+
a_f = (*a_f)->next_ref();
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
advisors = a_t;
|
|
2846
|
+
// Enter advisor link for reset
|
|
2847
|
+
assert(p_f->u.advisors == NULL);
|
|
2848
|
+
p_f->u.advisors = c.advisors;
|
|
2849
|
+
} else {
|
|
2850
|
+
advisors = NULL;
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
template<class A>
|
|
2855
|
+
forceinline void
|
|
2856
|
+
Council<A>::dispose(Space& home) {
|
|
2857
|
+
ActorLink* a = advisors;
|
|
2858
|
+
while (a != NULL) {
|
|
2859
|
+
if (!static_cast<A*>(a)->disposed())
|
|
2860
|
+
static_cast<A*>(a)->dispose(home,*this);
|
|
2861
|
+
a = a->next();
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
|
|
2866
|
+
|
|
2867
|
+
/*
|
|
2868
|
+
* Advisor iterator
|
|
2869
|
+
*
|
|
2870
|
+
*/
|
|
2871
|
+
template<class A>
|
|
2872
|
+
forceinline
|
|
2873
|
+
Advisors<A>::Advisors(const Council<A>& c)
|
|
2874
|
+
: a(c.advisors) {
|
|
2875
|
+
while ((a != NULL) && static_cast<A*>(a)->disposed())
|
|
2876
|
+
a = a->next();
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
template<class A>
|
|
2880
|
+
forceinline bool
|
|
2881
|
+
Advisors<A>::operator ()(void) const {
|
|
2882
|
+
return a != NULL;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
template<class A>
|
|
2886
|
+
forceinline void
|
|
2887
|
+
Advisors<A>::operator ++(void) {
|
|
2888
|
+
do {
|
|
2889
|
+
a = a->next();
|
|
2890
|
+
} while ((a != NULL) && static_cast<A*>(a)->disposed());
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
template<class A>
|
|
2894
|
+
forceinline A&
|
|
2895
|
+
Advisors<A>::advisor(void) const {
|
|
2896
|
+
return *static_cast<A*>(a);
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
/*
|
|
2902
|
+
* Space
|
|
2903
|
+
*
|
|
2904
|
+
*/
|
|
2905
|
+
forceinline void
|
|
2906
|
+
Space::enqueue(Propagator* p) {
|
|
2907
|
+
ActorLink::cast(p)->unlink();
|
|
2908
|
+
ActorLink* c = &pc.p.queue[p->cost(*this,p->u.med).ac];
|
|
2909
|
+
c->tail(ActorLink::cast(p));
|
|
2910
|
+
if (c > pc.p.active)
|
|
2911
|
+
pc.p.active = c;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
forceinline void
|
|
2915
|
+
Space::fail(void) {
|
|
2916
|
+
/*
|
|
2917
|
+
* Now active points beyond the last queue. This is essential as
|
|
2918
|
+
* enqueuing a propagator in a failed space keeps the space
|
|
2919
|
+
* failed.
|
|
2920
|
+
*/
|
|
2921
|
+
pc.p.active = &pc.p.queue[PropCost::AC_MAX+1]+1;
|
|
2922
|
+
}
|
|
2923
|
+
forceinline void
|
|
2924
|
+
Home::fail(void) {
|
|
2925
|
+
s.fail();
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
forceinline bool
|
|
2929
|
+
Space::failed(void) const {
|
|
2930
|
+
return pc.p.active > &pc.p.queue[PropCost::AC_MAX+1];
|
|
2931
|
+
}
|
|
2932
|
+
forceinline bool
|
|
2933
|
+
Home::failed(void) const {
|
|
2934
|
+
return s.failed();
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
forceinline bool
|
|
2938
|
+
Space::stable(void) const {
|
|
2939
|
+
return ((pc.p.active < &pc.p.queue[0]) ||
|
|
2940
|
+
(pc.p.active > &pc.p.queue[PropCost::AC_MAX+1]));
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
/*
|
|
2946
|
+
* Variable implementation
|
|
2947
|
+
*
|
|
2948
|
+
*/
|
|
2949
|
+
template<class VIC>
|
|
2950
|
+
forceinline ActorLink**
|
|
2951
|
+
VarImp<VIC>::actor(PropCond pc) {
|
|
2952
|
+
assert((pc >= 0) && (pc < pc_max+2));
|
|
2953
|
+
return (pc == 0) ? b.base : b.base+u.idx[pc-1];
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
template<class VIC>
|
|
2957
|
+
forceinline ActorLink**
|
|
2958
|
+
VarImp<VIC>::actorNonZero(PropCond pc) {
|
|
2959
|
+
assert((pc > 0) && (pc < pc_max+2));
|
|
2960
|
+
return b.base+u.idx[pc-1];
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
template<class VIC>
|
|
2964
|
+
forceinline unsigned int&
|
|
2965
|
+
VarImp<VIC>::idx(PropCond pc) {
|
|
2966
|
+
assert((pc > 0) && (pc < pc_max+2));
|
|
2967
|
+
return u.idx[pc-1];
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
template<class VIC>
|
|
2971
|
+
forceinline unsigned int
|
|
2972
|
+
VarImp<VIC>::idx(PropCond pc) const {
|
|
2973
|
+
assert((pc > 0) && (pc < pc_max+2));
|
|
2974
|
+
return u.idx[pc-1];
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
template<class VIC>
|
|
2978
|
+
forceinline
|
|
2979
|
+
VarImp<VIC>::VarImp(Space&) {
|
|
2980
|
+
b.base = NULL; entries = 0;
|
|
2981
|
+
for (PropCond pc=1; pc<pc_max+2; pc++)
|
|
2982
|
+
idx(pc) = 0;
|
|
2983
|
+
free_and_bits = 0;
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
template<class VIC>
|
|
2987
|
+
forceinline
|
|
2988
|
+
VarImp<VIC>::VarImp(void) {
|
|
2989
|
+
b.base = NULL; entries = 0;
|
|
2990
|
+
for (PropCond pc=1; pc<pc_max+2; pc++)
|
|
2991
|
+
idx(pc) = 0;
|
|
2992
|
+
free_and_bits = 0;
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
template<class VIC>
|
|
2996
|
+
forceinline unsigned int
|
|
2997
|
+
VarImp<VIC>::degree(void) const {
|
|
2998
|
+
assert(!copied());
|
|
2999
|
+
return entries;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
template<class VIC>
|
|
3003
|
+
forceinline double
|
|
3004
|
+
VarImp<VIC>::afc(void) const {
|
|
3005
|
+
if (degree() == 0)
|
|
3006
|
+
return 0.0;
|
|
3007
|
+
double d = degree();
|
|
3008
|
+
// Count the afc of each propagator
|
|
3009
|
+
{
|
|
3010
|
+
ActorLink** a = const_cast<VarImp<VIC>*>(this)->actor(0);
|
|
3011
|
+
ActorLink** e = const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
|
|
3012
|
+
while (a < e) {
|
|
3013
|
+
d += Propagator::cast(*a)->afc(); a++;
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
// Count the afc of each advisor's propagator
|
|
3017
|
+
{
|
|
3018
|
+
ActorLink** a = const_cast<VarImp<VIC>*>(this)->actorNonZero(pc_max+1);
|
|
3019
|
+
ActorLink** e = const_cast<VarImp<VIC>*>(this)->b.base+entries;
|
|
3020
|
+
while (a < e) {
|
|
3021
|
+
d += Advisor::cast(*a)->propagator().afc(); a++;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
return d;
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
template<class VIC>
|
|
3028
|
+
forceinline ModEvent
|
|
3029
|
+
VarImp<VIC>::modevent(const Delta& d) {
|
|
3030
|
+
return d.me;
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
template<class VIC>
|
|
3034
|
+
forceinline unsigned int
|
|
3035
|
+
VarImp<VIC>::bits(void) const {
|
|
3036
|
+
return free_and_bits;
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
template<class VIC>
|
|
3040
|
+
forceinline unsigned int&
|
|
3041
|
+
VarImp<VIC>::bits(void) {
|
|
3042
|
+
return free_and_bits;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
#ifdef GECODE_HAS_VAR_DISPOSE
|
|
3046
|
+
template<class VIC>
|
|
3047
|
+
forceinline VarImp<VIC>*
|
|
3048
|
+
VarImp<VIC>::vars_d(Space& home) {
|
|
3049
|
+
return static_cast<VarImp<VIC>*>(home.vars_d<VIC>());
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
template<class VIC>
|
|
3053
|
+
forceinline void
|
|
3054
|
+
VarImp<VIC>::vars_d(Space& home, VarImp<VIC>* x) {
|
|
3055
|
+
home.vars_d<VIC>(x);
|
|
3056
|
+
}
|
|
3057
|
+
#endif
|
|
3058
|
+
|
|
3059
|
+
template<class VIC>
|
|
3060
|
+
forceinline bool
|
|
3061
|
+
VarImp<VIC>::copied(void) const {
|
|
3062
|
+
return Support::marked(b.fwd);
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
template<class VIC>
|
|
3066
|
+
forceinline VarImp<VIC>*
|
|
3067
|
+
VarImp<VIC>::forward(void) const {
|
|
3068
|
+
assert(copied());
|
|
3069
|
+
return static_cast<VarImp<VIC>*>(Support::unmark(b.fwd));
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
template<class VIC>
|
|
3073
|
+
forceinline VarImp<VIC>*
|
|
3074
|
+
VarImp<VIC>::next(void) const {
|
|
3075
|
+
assert(copied());
|
|
3076
|
+
return u.next;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
template<class VIC>
|
|
3080
|
+
forceinline
|
|
3081
|
+
VarImp<VIC>::VarImp(Space& home, bool, VarImp<VIC>& x) {
|
|
3082
|
+
VarImpBase** reg;
|
|
3083
|
+
free_and_bits = x.free_and_bits & ((1 << free_bits) - 1);
|
|
3084
|
+
if (x.b.base == NULL) {
|
|
3085
|
+
// Variable implementation needs no index structure
|
|
3086
|
+
reg = &home.pc.c.vars_noidx;
|
|
3087
|
+
assert(x.degree() == 0);
|
|
3088
|
+
} else {
|
|
3089
|
+
reg = &home.pc.c.vars_u[idx_c];
|
|
3090
|
+
}
|
|
3091
|
+
// Save subscriptions in copy
|
|
3092
|
+
b.base = x.b.base;
|
|
3093
|
+
entries = x.entries;
|
|
3094
|
+
for (PropCond pc=1; pc<pc_max+2; pc++)
|
|
3095
|
+
idx(pc) = x.idx(pc);
|
|
3096
|
+
|
|
3097
|
+
// Set forwarding pointer
|
|
3098
|
+
x.b.fwd = static_cast<VarImp<VIC>*>(Support::mark(this));
|
|
3099
|
+
// Register original
|
|
3100
|
+
x.u.next = static_cast<VarImp<VIC>*>(*reg); *reg = &x;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
template<class VIC>
|
|
3104
|
+
forceinline ModEvent
|
|
3105
|
+
VarImp<VIC>::me(const ModEventDelta& med) {
|
|
3106
|
+
return static_cast<ModEvent>((med & VIC::med_mask) >> VIC::med_fst);
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
template<class VIC>
|
|
3110
|
+
forceinline ModEventDelta
|
|
3111
|
+
VarImp<VIC>::med(ModEvent me) {
|
|
3112
|
+
return static_cast<ModEventDelta>(me << VIC::med_fst);
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
template<class VIC>
|
|
3116
|
+
forceinline ModEvent
|
|
3117
|
+
VarImp<VIC>::me_combine(ModEvent me1, ModEvent me2) {
|
|
3118
|
+
return VIC::me_combine(me1,me2);
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
template<class VIC>
|
|
3122
|
+
forceinline void
|
|
3123
|
+
VarImp<VIC>::schedule(Space& home, Propagator& p, ModEvent me,
|
|
3124
|
+
bool force) {
|
|
3125
|
+
if (VIC::med_update(p.u.med,me) || force)
|
|
3126
|
+
home.enqueue(&p);
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
template<class VIC>
|
|
3130
|
+
forceinline void
|
|
3131
|
+
VarImp<VIC>::schedule(Space& home, PropCond pc1, PropCond pc2, ModEvent me) {
|
|
3132
|
+
ActorLink** b = actor(pc1);
|
|
3133
|
+
ActorLink** p = actorNonZero(pc2+1);
|
|
3134
|
+
while (p-- > b)
|
|
3135
|
+
schedule(home,*Propagator::cast(*p),me);
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
template<class VIC>
|
|
3139
|
+
forceinline void
|
|
3140
|
+
VarImp<VIC>::enter(Space& home, Propagator* p, PropCond pc) {
|
|
3141
|
+
assert(pc <= pc_max);
|
|
3142
|
+
// Count one new subscription
|
|
3143
|
+
home.pc.p.n_sub += 1;
|
|
3144
|
+
if ((free_and_bits >> free_bits) == 0)
|
|
3145
|
+
resize(home);
|
|
3146
|
+
free_and_bits -= 1 << free_bits;
|
|
3147
|
+
|
|
3148
|
+
// Enter subscription
|
|
3149
|
+
b.base[entries] = *actorNonZero(pc_max+1);
|
|
3150
|
+
entries++;
|
|
3151
|
+
for (PropCond j = pc_max; j > pc; j--) {
|
|
3152
|
+
*actorNonZero(j+1) = *actorNonZero(j);
|
|
3153
|
+
idx(j+1)++;
|
|
3154
|
+
}
|
|
3155
|
+
*actorNonZero(pc+1) = *actor(pc);
|
|
3156
|
+
idx(pc+1)++;
|
|
3157
|
+
*actor(pc) = ActorLink::cast(p);
|
|
3158
|
+
|
|
3159
|
+
#ifdef GECODE_AUDIT
|
|
3160
|
+
ActorLink** f = actor(pc);
|
|
3161
|
+
while (f < (pc == pc_max+1 ? b.base+entries : actorNonZero(pc+1)))
|
|
3162
|
+
if (*f == p)
|
|
3163
|
+
goto found;
|
|
3164
|
+
else
|
|
3165
|
+
f++;
|
|
3166
|
+
GECODE_NEVER;
|
|
3167
|
+
found: ;
|
|
3168
|
+
#endif
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
template<class VIC>
|
|
3172
|
+
forceinline void
|
|
3173
|
+
VarImp<VIC>::enter(Space& home, Advisor* a) {
|
|
3174
|
+
// Count one new subscription
|
|
3175
|
+
home.pc.p.n_sub += 1;
|
|
3176
|
+
if ((free_and_bits >> free_bits) == 0)
|
|
3177
|
+
resize(home);
|
|
3178
|
+
free_and_bits -= 1 << free_bits;
|
|
3179
|
+
|
|
3180
|
+
// Enter subscription
|
|
3181
|
+
b.base[entries++] = *actorNonZero(pc_max+1);
|
|
3182
|
+
*actorNonZero(pc_max+1) = a;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
template<class VIC>
|
|
3186
|
+
void
|
|
3187
|
+
VarImp<VIC>::resize(Space& home) {
|
|
3188
|
+
if (b.base == NULL) {
|
|
3189
|
+
assert((free_and_bits >> free_bits) == 0);
|
|
3190
|
+
// Create fresh dependency array with four entries
|
|
3191
|
+
free_and_bits += 4 << free_bits;
|
|
3192
|
+
b.base = home.alloc<ActorLink*>(4);
|
|
3193
|
+
for (int i=0; i<pc_max+1; i++)
|
|
3194
|
+
u.idx[i] = 0;
|
|
3195
|
+
} else {
|
|
3196
|
+
// Resize dependency array
|
|
3197
|
+
unsigned int n = degree();
|
|
3198
|
+
// Find out whether the area is most likely in the special area
|
|
3199
|
+
// reserved for subscriptions. If yes, just resize mildly otherwise
|
|
3200
|
+
// more agressively
|
|
3201
|
+
ActorLink** s = static_cast<ActorLink**>(home.mm.subscriptions());
|
|
3202
|
+
unsigned int m =
|
|
3203
|
+
((s <= b.base) && (b.base < s+home.pc.p.n_sub)) ?
|
|
3204
|
+
(n+4) : ((n+1)*3>>1);
|
|
3205
|
+
ActorLink** prop = home.alloc<ActorLink*>(m);
|
|
3206
|
+
free_and_bits += (m-n) << free_bits;
|
|
3207
|
+
// Copy entries
|
|
3208
|
+
Heap::copy<ActorLink*>(prop, b.base, n);
|
|
3209
|
+
home.free<ActorLink*>(b.base,n);
|
|
3210
|
+
b.base = prop;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
template<class VIC>
|
|
3215
|
+
void
|
|
3216
|
+
VarImp<VIC>::subscribe(Space& home, Propagator& p, PropCond pc,
|
|
3217
|
+
bool assigned, ModEvent me, bool schedule) {
|
|
3218
|
+
if (assigned) {
|
|
3219
|
+
// Do not subscribe, just schedule the propagator
|
|
3220
|
+
if (schedule)
|
|
3221
|
+
VarImp<VIC>::schedule(home,p,ME_GEN_ASSIGNED);
|
|
3222
|
+
} else {
|
|
3223
|
+
enter(home,&p,pc);
|
|
3224
|
+
// Schedule propagator
|
|
3225
|
+
if (schedule && (pc != PC_GEN_ASSIGNED))
|
|
3226
|
+
VarImp<VIC>::schedule(home,p,me);
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
template<class VIC>
|
|
3231
|
+
forceinline void
|
|
3232
|
+
VarImp<VIC>::subscribe(Space& home, Advisor& a, bool assigned) {
|
|
3233
|
+
if (!assigned)
|
|
3234
|
+
enter(home,&a);
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
template<class VIC>
|
|
3238
|
+
forceinline void
|
|
3239
|
+
VarImp<VIC>::remove(Space& home, Propagator* p, PropCond pc) {
|
|
3240
|
+
assert(pc <= pc_max);
|
|
3241
|
+
ActorLink* a = ActorLink::cast(p);
|
|
3242
|
+
// Find actor in dependency array
|
|
3243
|
+
ActorLink** f = actor(pc);
|
|
3244
|
+
#ifdef GECODE_AUDIT
|
|
3245
|
+
while (f < actorNonZero(pc+1))
|
|
3246
|
+
if (*f == a)
|
|
3247
|
+
goto found;
|
|
3248
|
+
else
|
|
3249
|
+
f++;
|
|
3250
|
+
GECODE_NEVER;
|
|
3251
|
+
found: ;
|
|
3252
|
+
#else
|
|
3253
|
+
while (*f != a) f++;
|
|
3254
|
+
#endif
|
|
3255
|
+
// Remove actor
|
|
3256
|
+
*f = *(actorNonZero(pc+1)-1);
|
|
3257
|
+
for (PropCond j = pc+1; j< pc_max+1; j++) {
|
|
3258
|
+
*(actorNonZero(j)-1) = *(actorNonZero(j+1)-1);
|
|
3259
|
+
idx(j)--;
|
|
3260
|
+
}
|
|
3261
|
+
*(actorNonZero(pc_max+1)-1) = b.base[entries-1];
|
|
3262
|
+
idx(pc_max+1)--;
|
|
3263
|
+
entries--;
|
|
3264
|
+
free_and_bits += 1 << free_bits;
|
|
3265
|
+
home.pc.p.n_sub -= 1;
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
template<class VIC>
|
|
3269
|
+
forceinline void
|
|
3270
|
+
VarImp<VIC>::remove(Space& home, Advisor* a) {
|
|
3271
|
+
// Find actor in dependency array
|
|
3272
|
+
ActorLink** f = actorNonZero(pc_max+1);
|
|
3273
|
+
#ifdef GECODE_AUDIT
|
|
3274
|
+
while (f < b.base+entries)
|
|
3275
|
+
if (*f == a)
|
|
3276
|
+
goto found;
|
|
3277
|
+
else
|
|
3278
|
+
f++;
|
|
3279
|
+
GECODE_NEVER;
|
|
3280
|
+
found: ;
|
|
3281
|
+
#else
|
|
3282
|
+
while (*f != a) f++;
|
|
3283
|
+
#endif
|
|
3284
|
+
// Remove actor
|
|
3285
|
+
*f = b.base[--entries];
|
|
3286
|
+
free_and_bits += 1 << free_bits;
|
|
3287
|
+
home.pc.p.n_sub -= 1;
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
template<class VIC>
|
|
3291
|
+
forceinline void
|
|
3292
|
+
VarImp<VIC>::cancel(Space& home, Propagator& p, PropCond pc, bool assigned) {
|
|
3293
|
+
if (!assigned)
|
|
3294
|
+
remove(home,&p,pc);
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
template<class VIC>
|
|
3298
|
+
forceinline void
|
|
3299
|
+
VarImp<VIC>::cancel(Space& home, Advisor& a, bool assigned) {
|
|
3300
|
+
if (!assigned)
|
|
3301
|
+
remove(home,&a);
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
template<class VIC>
|
|
3305
|
+
forceinline void
|
|
3306
|
+
VarImp<VIC>::cancel(Space& home) {
|
|
3307
|
+
unsigned int n_sub = degree();
|
|
3308
|
+
home.pc.p.n_sub -= n_sub;
|
|
3309
|
+
unsigned int n = (free_and_bits >> VIC::free_bits) + n_sub;
|
|
3310
|
+
home.free<ActorLink*>(b.base,n);
|
|
3311
|
+
// Must be NULL such that cloning works
|
|
3312
|
+
b.base = NULL;
|
|
3313
|
+
// Must be 0 such that degree works
|
|
3314
|
+
entries = 0;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
template<class VIC>
|
|
3318
|
+
forceinline bool
|
|
3319
|
+
VarImp<VIC>::advise(Space& home, ModEvent me, Delta& d) {
|
|
3320
|
+
/*
|
|
3321
|
+
* An advisor that is executed might remove itself due to subsumption.
|
|
3322
|
+
* As entries are removed from front to back, the advisors must
|
|
3323
|
+
* be iterated in forward direction.
|
|
3324
|
+
*/
|
|
3325
|
+
ActorLink** la = actorNonZero(pc_max+1);
|
|
3326
|
+
ActorLink** le = b.base+entries;
|
|
3327
|
+
if (la == le)
|
|
3328
|
+
return true;
|
|
3329
|
+
d.me = me;
|
|
3330
|
+
// An advisor that is run, might be removed during execution.
|
|
3331
|
+
// As removal is done from the back the advisors have to be executed
|
|
3332
|
+
// in inverse order.
|
|
3333
|
+
do {
|
|
3334
|
+
Advisor* a = Advisor::cast(*la);
|
|
3335
|
+
assert(!a->disposed());
|
|
3336
|
+
Propagator& p = a->propagator();
|
|
3337
|
+
switch (p.advise(home,*a,d)) {
|
|
3338
|
+
case ES_FIX:
|
|
3339
|
+
break;
|
|
3340
|
+
case ES_FAILED:
|
|
3341
|
+
p.pi.fail(home.gpi);
|
|
3342
|
+
return false;
|
|
3343
|
+
case ES_NOFIX:
|
|
3344
|
+
schedule(home,p,me);
|
|
3345
|
+
break;
|
|
3346
|
+
case ES_NOFIX_FORCE:
|
|
3347
|
+
schedule(home,p,me,true);
|
|
3348
|
+
break;
|
|
3349
|
+
default:
|
|
3350
|
+
GECODE_NEVER;
|
|
3351
|
+
}
|
|
3352
|
+
} while (++la < le);
|
|
3353
|
+
return true;
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
template<class VIC>
|
|
3357
|
+
forceinline void
|
|
3358
|
+
VarImp<VIC>::update(VarImp<VIC>* x, ActorLink**& sub) {
|
|
3359
|
+
// this refers to the variable to be updated (clone)
|
|
3360
|
+
// x refers to the original
|
|
3361
|
+
// Recover from copy
|
|
3362
|
+
x->b.base = b.base;
|
|
3363
|
+
x->u.idx[0] = u.idx[0];
|
|
3364
|
+
if (pc_max > 0 && sizeof(ActorLink**) > sizeof(unsigned int))
|
|
3365
|
+
x->u.idx[1] = u.idx[1];
|
|
3366
|
+
|
|
3367
|
+
ActorLink** f = x->b.base;
|
|
3368
|
+
unsigned int n = x->degree();
|
|
3369
|
+
ActorLink** t = sub;
|
|
3370
|
+
sub += n;
|
|
3371
|
+
b.base = t;
|
|
3372
|
+
// Set subscriptions using actor forwarding pointers
|
|
3373
|
+
while (n >= 4) {
|
|
3374
|
+
n -= 4;
|
|
3375
|
+
t[0]=f[0]->prev(); t[1]=f[1]->prev();
|
|
3376
|
+
t[2]=f[2]->prev(); t[3]=f[3]->prev();
|
|
3377
|
+
t += 4; f += 4;
|
|
3378
|
+
}
|
|
3379
|
+
if (n >= 2) {
|
|
3380
|
+
n -= 2;
|
|
3381
|
+
t[0]=f[0]->prev(); t[1]=f[1]->prev();
|
|
3382
|
+
t += 2; f += 2;
|
|
3383
|
+
}
|
|
3384
|
+
if (n > 0) {
|
|
3385
|
+
t[0]=f[0]->prev();
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
template<class VIC>
|
|
3390
|
+
forceinline void
|
|
3391
|
+
VarImp<VIC>::update(Space& home, ActorLink**& sub) {
|
|
3392
|
+
VarImp<VIC>* x = static_cast<VarImp<VIC>*>(home.pc.c.vars_u[idx_c]);
|
|
3393
|
+
while (x != NULL) {
|
|
3394
|
+
VarImp<VIC>* n = x->next(); x->forward()->update(x,sub); x = n;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
/*
|
|
3401
|
+
* Variable disposer
|
|
3402
|
+
*
|
|
3403
|
+
*/
|
|
3404
|
+
template<class VarImp>
|
|
3405
|
+
VarImpDisposer<VarImp>::VarImpDisposer(void) {
|
|
3406
|
+
#ifdef GECODE_HAS_VAR_DISPOSE
|
|
3407
|
+
Space::vd[VarImp::idx_d] = this;
|
|
3408
|
+
#endif
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
template<class VarImp>
|
|
3412
|
+
void
|
|
3413
|
+
VarImpDisposer<VarImp>::dispose(Space& home, VarImpBase* _x) {
|
|
3414
|
+
VarImp* x = static_cast<VarImp*>(_x);
|
|
3415
|
+
do {
|
|
3416
|
+
x->dispose(home); x = static_cast<VarImp*>(x->next_d());
|
|
3417
|
+
} while (x != NULL);
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
/*
|
|
3421
|
+
* Statistics
|
|
3422
|
+
*/
|
|
3423
|
+
|
|
3424
|
+
forceinline void
|
|
3425
|
+
StatusStatistics::reset(void) {
|
|
3426
|
+
propagate = 0;
|
|
3427
|
+
wmp = false;
|
|
3428
|
+
}
|
|
3429
|
+
forceinline
|
|
3430
|
+
StatusStatistics::StatusStatistics(void) {
|
|
3431
|
+
reset();
|
|
3432
|
+
}
|
|
3433
|
+
forceinline StatusStatistics&
|
|
3434
|
+
StatusStatistics::operator +=(const StatusStatistics& s) {
|
|
3435
|
+
propagate += s.propagate;
|
|
3436
|
+
wmp |= s.wmp;
|
|
3437
|
+
return *this;
|
|
3438
|
+
}
|
|
3439
|
+
forceinline StatusStatistics
|
|
3440
|
+
StatusStatistics::operator +(const StatusStatistics& s) {
|
|
3441
|
+
StatusStatistics t(s);
|
|
3442
|
+
return t += *this;
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
forceinline void
|
|
3446
|
+
CloneStatistics::reset(void) {}
|
|
3447
|
+
|
|
3448
|
+
forceinline
|
|
3449
|
+
CloneStatistics::CloneStatistics(void) {
|
|
3450
|
+
reset();
|
|
3451
|
+
}
|
|
3452
|
+
forceinline CloneStatistics
|
|
3453
|
+
CloneStatistics::operator +(const CloneStatistics&) {
|
|
3454
|
+
CloneStatistics s;
|
|
3455
|
+
return s;
|
|
3456
|
+
}
|
|
3457
|
+
forceinline CloneStatistics&
|
|
3458
|
+
CloneStatistics::operator +=(const CloneStatistics&) {
|
|
3459
|
+
return *this;
|
|
3460
|
+
}
|
|
3461
|
+
|
|
3462
|
+
forceinline void
|
|
3463
|
+
CommitStatistics::reset(void) {}
|
|
3464
|
+
|
|
3465
|
+
forceinline
|
|
3466
|
+
CommitStatistics::CommitStatistics(void) {
|
|
3467
|
+
reset();
|
|
3468
|
+
}
|
|
3469
|
+
forceinline CommitStatistics
|
|
3470
|
+
CommitStatistics::operator +(const CommitStatistics&) {
|
|
3471
|
+
CommitStatistics s;
|
|
3472
|
+
return s;
|
|
3473
|
+
}
|
|
3474
|
+
forceinline CommitStatistics&
|
|
3475
|
+
CommitStatistics::operator +=(const CommitStatistics&) {
|
|
3476
|
+
return *this;
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
/*
|
|
3480
|
+
* Cost computation
|
|
3481
|
+
*
|
|
3482
|
+
*/
|
|
3483
|
+
|
|
3484
|
+
forceinline
|
|
3485
|
+
PropCost::PropCost(PropCost::ActualCost ac0) : ac(ac0) {}
|
|
3486
|
+
|
|
3487
|
+
forceinline PropCost
|
|
3488
|
+
PropCost::cost(PropCost::Mod m,
|
|
3489
|
+
PropCost::ActualCost lo, PropCost::ActualCost hi,
|
|
3490
|
+
unsigned int n) {
|
|
3491
|
+
if (n < 2)
|
|
3492
|
+
return (m == LO) ? AC_UNARY_LO : AC_UNARY_HI;
|
|
3493
|
+
else if (n == 2)
|
|
3494
|
+
return (m == LO) ? AC_BINARY_LO : AC_BINARY_HI;
|
|
3495
|
+
else if (n == 3)
|
|
3496
|
+
return (m == LO) ? AC_TERNARY_LO : AC_TERNARY_HI;
|
|
3497
|
+
else
|
|
3498
|
+
return (m == LO) ? lo : hi;
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
forceinline PropCost
|
|
3502
|
+
PropCost::crazy(PropCost::Mod m, unsigned int n) {
|
|
3503
|
+
return cost(m,AC_CRAZY_LO,AC_CRAZY_HI,n);
|
|
3504
|
+
}
|
|
3505
|
+
forceinline PropCost
|
|
3506
|
+
PropCost::crazy(PropCost::Mod m, int n) {
|
|
3507
|
+
assert(n >= 0);
|
|
3508
|
+
return crazy(m,static_cast<unsigned int>(n));
|
|
3509
|
+
}
|
|
3510
|
+
forceinline PropCost
|
|
3511
|
+
PropCost::cubic(PropCost::Mod m, unsigned int n) {
|
|
3512
|
+
return cost(m,AC_CUBIC_LO,AC_CUBIC_HI,n);
|
|
3513
|
+
}
|
|
3514
|
+
forceinline PropCost
|
|
3515
|
+
PropCost::cubic(PropCost::Mod m, int n) {
|
|
3516
|
+
assert(n >= 0);
|
|
3517
|
+
return cubic(m,static_cast<unsigned int>(n));
|
|
3518
|
+
}
|
|
3519
|
+
forceinline PropCost
|
|
3520
|
+
PropCost::quadratic(PropCost::Mod m, unsigned int n) {
|
|
3521
|
+
return cost(m,AC_QUADRATIC_LO,AC_QUADRATIC_HI,n);
|
|
3522
|
+
}
|
|
3523
|
+
forceinline PropCost
|
|
3524
|
+
PropCost::quadratic(PropCost::Mod m, int n) {
|
|
3525
|
+
assert(n >= 0);
|
|
3526
|
+
return quadratic(m,static_cast<unsigned int>(n));
|
|
3527
|
+
}
|
|
3528
|
+
forceinline PropCost
|
|
3529
|
+
PropCost::linear(PropCost::Mod m, unsigned int n) {
|
|
3530
|
+
return cost(m,AC_LINEAR_LO,AC_LINEAR_HI,n);
|
|
3531
|
+
}
|
|
3532
|
+
forceinline PropCost
|
|
3533
|
+
PropCost::linear(PropCost::Mod m, int n) {
|
|
3534
|
+
assert(n >= 0);
|
|
3535
|
+
return linear(m,static_cast<unsigned int>(n));
|
|
3536
|
+
}
|
|
3537
|
+
forceinline PropCost
|
|
3538
|
+
PropCost::ternary(PropCost::Mod m) {
|
|
3539
|
+
return (m == LO) ? AC_TERNARY_LO : AC_TERNARY_HI;
|
|
3540
|
+
}
|
|
3541
|
+
forceinline PropCost
|
|
3542
|
+
PropCost::binary(PropCost::Mod m) {
|
|
3543
|
+
return (m == LO) ? AC_BINARY_LO : AC_BINARY_HI;
|
|
3544
|
+
}
|
|
3545
|
+
forceinline PropCost
|
|
3546
|
+
PropCost::unary(PropCost::Mod m) {
|
|
3547
|
+
return (m == LO) ? AC_UNARY_LO : AC_UNARY_HI;
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
/*
|
|
3551
|
+
* Iterators for propagators and branchers of a space
|
|
3552
|
+
*
|
|
3553
|
+
*/
|
|
3554
|
+
forceinline
|
|
3555
|
+
Space::Propagators::Propagators(const Space& home0)
|
|
3556
|
+
: home(home0), q(home.pc.p.active) {
|
|
3557
|
+
while (q >= &home.pc.p.queue[0]) {
|
|
3558
|
+
if (q->next() != q) {
|
|
3559
|
+
c = q->next(); e = q; q--;
|
|
3560
|
+
return;
|
|
3561
|
+
}
|
|
3562
|
+
q--;
|
|
3563
|
+
}
|
|
3564
|
+
q = NULL;
|
|
3565
|
+
if (!home.pl.empty()) {
|
|
3566
|
+
c = Propagator::cast(home.pl.next());
|
|
3567
|
+
e = Propagator::cast(&home.pl);
|
|
3568
|
+
} else {
|
|
3569
|
+
c = e = NULL;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
forceinline bool
|
|
3573
|
+
Space::Propagators::operator ()(void) const {
|
|
3574
|
+
return c != NULL;
|
|
3575
|
+
}
|
|
3576
|
+
forceinline void
|
|
3577
|
+
Space::Propagators::operator ++(void) {
|
|
3578
|
+
c = c->next();
|
|
3579
|
+
if (c == e) {
|
|
3580
|
+
if (q == NULL) {
|
|
3581
|
+
c = NULL;
|
|
3582
|
+
} else {
|
|
3583
|
+
while (q >= &home.pc.p.queue[0]) {
|
|
3584
|
+
if (q->next() != q) {
|
|
3585
|
+
c = q->next(); e = q; q--;
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
q--;
|
|
3589
|
+
}
|
|
3590
|
+
q = NULL;
|
|
3591
|
+
if (!home.pl.empty()) {
|
|
3592
|
+
c = Propagator::cast(home.pl.next());
|
|
3593
|
+
e = Propagator::cast(&home.pl);
|
|
3594
|
+
} else {
|
|
3595
|
+
c = NULL;
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
forceinline const Propagator&
|
|
3601
|
+
Space::Propagators::propagator(void) const {
|
|
3602
|
+
return *Propagator::cast(c);
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
forceinline
|
|
3606
|
+
Space::Branchers::Branchers(const Space& home)
|
|
3607
|
+
: c(Brancher::cast(home.bl.next())), e(&home.bl) {}
|
|
3608
|
+
forceinline bool
|
|
3609
|
+
Space::Branchers::operator ()(void) const {
|
|
3610
|
+
return c != e;
|
|
3611
|
+
}
|
|
3612
|
+
forceinline void
|
|
3613
|
+
Space::Branchers::operator ++(void) {
|
|
3614
|
+
c = c->next();
|
|
3615
|
+
}
|
|
3616
|
+
forceinline const Brancher&
|
|
3617
|
+
Space::Branchers::brancher(void) const {
|
|
3618
|
+
return *Brancher::cast(c);
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
/*
|
|
3622
|
+
* Space construction support
|
|
3623
|
+
*
|
|
3624
|
+
*/
|
|
3625
|
+
template<class T>
|
|
3626
|
+
forceinline T&
|
|
3627
|
+
Space::construct(void) {
|
|
3628
|
+
return alloc<T>(1);
|
|
3629
|
+
}
|
|
3630
|
+
template<class T, typename A1>
|
|
3631
|
+
forceinline T&
|
|
3632
|
+
Space::construct(A1 const& a1) {
|
|
3633
|
+
T& t = *static_cast<T*>(ralloc(sizeof(T)));
|
|
3634
|
+
new (&t) T(a1);
|
|
3635
|
+
return t;
|
|
3636
|
+
}
|
|
3637
|
+
template<class T, typename A1, typename A2>
|
|
3638
|
+
forceinline T&
|
|
3639
|
+
Space::construct(A1 const& a1, A2 const& a2) {
|
|
3640
|
+
T& t = *static_cast<T*>(ralloc(sizeof(T)));
|
|
3641
|
+
new (&t) T(a1,a2);
|
|
3642
|
+
return t;
|
|
3643
|
+
}
|
|
3644
|
+
template<class T, typename A1, typename A2, typename A3>
|
|
3645
|
+
forceinline T&
|
|
3646
|
+
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3) {
|
|
3647
|
+
T& t = *static_cast<T*>(ralloc(sizeof(T)));
|
|
3648
|
+
new (&t) T(a1,a2,a3);
|
|
3649
|
+
return t;
|
|
3650
|
+
}
|
|
3651
|
+
template<class T, typename A1, typename A2, typename A3, typename A4>
|
|
3652
|
+
forceinline T&
|
|
3653
|
+
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4) {
|
|
3654
|
+
T& t = *static_cast<T*>(ralloc(sizeof(T)));
|
|
3655
|
+
new (&t) T(a1,a2,a3,a4);
|
|
3656
|
+
return t;
|
|
3657
|
+
}
|
|
3658
|
+
template<class T, typename A1, typename A2, typename A3, typename A4, typename A5>
|
|
3659
|
+
forceinline T&
|
|
3660
|
+
Space::construct(A1 const& a1, A2 const& a2, A3 const& a3, A4 const& a4, A5 const& a5) {
|
|
3661
|
+
T& t = *static_cast<T*>(ralloc(sizeof(T)));
|
|
3662
|
+
new (&t) T(a1,a2,a3,a4,a5);
|
|
3663
|
+
return t;
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
// STATISTICS: kernel-core
|