gecoder-with-gecode 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +15 -0
- data/README +6 -2
- data/example/equation_system.rb +15 -0
- data/example/magic_sequence.rb +7 -7
- data/example/money.rb +36 -0
- data/example/queens.rb +7 -8
- data/example/send_most_money.rb +1 -1
- data/example/square_tiling.rb +2 -2
- data/example/sudoku-set.rb +11 -12
- data/example/sudoku.rb +40 -45
- data/ext/extconf.rb +0 -0
- data/ext/gecode-2.1.1/LICENSE +0 -0
- data/ext/gecode-2.1.1/configure +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/SDFVariableHeuristic.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/SDFVariableHeuristic.hh +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/configure +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/extensivecomparator.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/extensivecomparator.hh +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/heap.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/implicative.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/implicative.hh +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/myspace.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/myspace.hh +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/qecore.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/qecore.hh +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/warner.cc +0 -0
- data/ext/gecode-2.1.1/contribs/qecode/warner.hh +0 -0
- data/ext/gecode-2.1.1/gecode/cpltset/var-imp/cpltset.vis +0 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/abs.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/max.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/mult.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/sqr.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/arithmetic/sqrt.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/array.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/array.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/bool/base.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/bool/eq.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/bool/eqv.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/bool/lq.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/bool/or.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/branch/select-val.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/branch/select-view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/branch.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/branch.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/base.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-multi.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-multi.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-single.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/link-single.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel/val.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/channel.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/base.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/circuit/val.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/circuit.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/circuit.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/count/int.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/count/rel.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/count/view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/bilink.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/bnd.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/combptr.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/edge.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/node.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/ter-dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/distinct/val.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/dom/range.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/dom/spec.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/dom.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/dom.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/element/int.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/element/view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/element.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/element.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/exception.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/dfa.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/dfa.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/extensional/layered-graph.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/gccbndsup.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/lbc.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc/ubc.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/gcc.hh +0 -0
- data/ext/gecode-2.1.1/gecode/int/int-set.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/int-set.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-int.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-post.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-scale.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/bool-view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-bin.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-dom.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-nary.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-post.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/int-ter.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/linear/post.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/propagator.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/rel/eq.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/rel/lex.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/rel/lq-le.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/rel/nq.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/unshare.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var/bool.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/bool.vis +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/delta.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/int.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/var-imp/int.vis +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/bool.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/constint.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/int.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/iter.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/minus.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/offset.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/print.cc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/rtest.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/scale.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view/zero.icc +0 -0
- data/ext/gecode-2.1.1/gecode/int/view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-add.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-append.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-array.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-cache.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-compl.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-diff.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-empty.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-inter.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-minmax.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-minus.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-offset.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-operations.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-scale.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-singleton-append.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-singleton.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-union.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/ranges-values.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-array.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-minus.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-offset.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-ranges.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-singleton.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter/values-unique.icc +0 -0
- data/ext/gecode-2.1.1/gecode/iter.hh +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/advisor.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/array.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/branching.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/exception.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/macros.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/memory-manager.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/modevent.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/propagator.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/shared-array.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/var-traits.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/var.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel/view.icc +0 -0
- data/ext/gecode-2.1.1/gecode/kernel.hh +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/arithmetic.cc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-expr.cc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-expr.icc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/bool-rel.icc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/lin-expr.icc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/lin-rel.icc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel/reg.cc +0 -0
- data/ext/gecode-2.1.1/gecode/minimodel.hh +0 -0
- data/ext/gecode-2.1.1/gecode/search/bab.cc +0 -0
- data/ext/gecode-2.1.1/gecode/search/bab.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/dfs.cc +0 -0
- data/ext/gecode-2.1.1/gecode/search/dfs.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/engine-ctrl.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/lds.cc +0 -0
- data/ext/gecode-2.1.1/gecode/search/lds.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/options.cc +0 -0
- data/ext/gecode-2.1.1/gecode/search/options.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/reco-stack.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/restart.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/statistics.icc +0 -0
- data/ext/gecode-2.1.1/gecode/search/stop.cc +0 -0
- data/ext/gecode-2.1.1/gecode/search/stop.icc +0 -0
- data/ext/gecode-2.1.1/gecode/set/var-imp/set.vis +0 -0
- data/ext/gecode-2.1.1/gecode/support/block-allocator.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/cast.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/exception.cc +0 -0
- data/ext/gecode-2.1.1/gecode/support/exception.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/macros.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/marked-pointer.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/memory.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/sentinel-stack.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/static-stack.icc +0 -0
- data/ext/gecode-2.1.1/gecode/support/symbol.cc +0 -0
- data/ext/gecode-2.1.1/gecode/support.hh +0 -0
- data/ext/gecode-2.1.1/install-sh +0 -0
- data/ext/gecode-2.1.1/misc/debian/rules +0 -0
- data/ext/gecode-2.1.1/misc/doxygen/back.png +0 -0
- data/ext/gecode-2.1.1/misc/doxygen/gecode-logo-100.png +0 -0
- data/ext/gecode-2.1.1/misc/genchangelog.perl +0 -0
- data/ext/gecode-2.1.1/misc/genlicense.perl +0 -0
- data/ext/gecode-2.1.1/misc/genstatistics.perl +0 -0
- data/ext/gecode-2.1.1/misc/genvariables.perl +0 -0
- data/ext/gecode-2.1.1/misc/getrevision.perl +0 -0
- data/ext/gecode-2.1.1/misc/makedepend.perl +0 -0
- data/ext/gecode-2.1.1/misc/svn-ignore.txt +0 -0
- data/ext/gecode-2.1.1/variables.vsl +0 -0
- data/lib/gecoder/bindings/bindings.rb +16 -0
- data/lib/gecoder/bindings.rb +42 -0
- data/lib/gecoder/interface/branch.rb +16 -9
- data/lib/gecoder/interface/constraints/bool/boolean.rb +205 -213
- data/lib/gecoder/interface/constraints/bool/channel.rb +4 -5
- data/lib/gecoder/interface/constraints/bool/linear.rb +192 -21
- data/lib/gecoder/interface/constraints/bool_enum/channel.rb +43 -39
- data/lib/gecoder/interface/constraints/bool_enum/extensional.rb +43 -49
- data/lib/gecoder/interface/constraints/bool_enum/relation.rb +38 -71
- data/lib/gecoder/interface/constraints/bool_enum_constraints.rb +73 -22
- data/lib/gecoder/interface/constraints/bool_var_constraints.rb +140 -61
- data/lib/gecoder/interface/constraints/extensional_regexp.rb +4 -4
- data/lib/gecoder/interface/constraints/fixnum_enum/element.rb +63 -0
- data/lib/gecoder/interface/constraints/fixnum_enum/operation.rb +65 -0
- data/lib/gecoder/interface/constraints/fixnum_enum_constraints.rb +42 -0
- data/lib/gecoder/interface/constraints/int/arithmetic.rb +131 -130
- data/lib/gecoder/interface/constraints/int/channel.rb +21 -31
- data/lib/gecoder/interface/constraints/int/domain.rb +45 -42
- data/lib/gecoder/interface/constraints/int/linear.rb +85 -239
- data/lib/gecoder/interface/constraints/int/relation.rb +141 -0
- data/lib/gecoder/interface/constraints/int_enum/arithmetic.rb +55 -64
- data/lib/gecoder/interface/constraints/int_enum/channel.rb +35 -37
- data/lib/gecoder/interface/constraints/int_enum/count.rb +53 -78
- data/lib/gecoder/interface/constraints/int_enum/distinct.rb +36 -46
- data/lib/gecoder/interface/constraints/int_enum/element.rb +39 -57
- data/lib/gecoder/interface/constraints/int_enum/equality.rb +15 -19
- data/lib/gecoder/interface/constraints/int_enum/extensional.rb +65 -72
- data/lib/gecoder/interface/constraints/int_enum/sort.rb +42 -45
- data/lib/gecoder/interface/constraints/int_enum_constraints.rb +79 -22
- data/lib/gecoder/interface/constraints/int_var_constraints.rb +215 -44
- data/lib/gecoder/interface/constraints/reifiable_constraints.rb +14 -14
- data/lib/gecoder/interface/constraints/selected_set/select.rb +120 -0
- data/lib/gecoder/interface/constraints/selected_set_constraints.rb +75 -0
- data/lib/gecoder/interface/constraints/set/cardinality.rb +43 -53
- data/lib/gecoder/interface/constraints/set/channel.rb +26 -29
- data/lib/gecoder/interface/constraints/set/connection.rb +89 -152
- data/lib/gecoder/interface/constraints/set/domain.rb +112 -65
- data/lib/gecoder/interface/constraints/set/include.rb +36 -0
- data/lib/gecoder/interface/constraints/set/operation.rb +96 -110
- data/lib/gecoder/interface/constraints/set/relation.rb +114 -137
- data/lib/gecoder/interface/constraints/set_elements/relation.rb +116 -0
- data/lib/gecoder/interface/constraints/set_elements_constraints.rb +97 -0
- data/lib/gecoder/interface/constraints/set_enum/channel.rb +23 -27
- data/lib/gecoder/interface/constraints/set_enum/distinct.rb +18 -19
- data/lib/gecoder/interface/constraints/set_enum/operation.rb +62 -53
- data/lib/gecoder/interface/constraints/set_enum/select.rb +79 -0
- data/lib/gecoder/interface/constraints/set_enum_constraints.rb +73 -23
- data/lib/gecoder/interface/constraints/set_var_constraints.rb +222 -57
- data/lib/gecoder/interface/constraints.rb +410 -451
- data/lib/gecoder/interface/enum_matrix.rb +4 -4
- data/lib/gecoder/interface/enum_wrapper.rb +71 -22
- data/lib/gecoder/interface/model.rb +167 -12
- data/lib/gecoder/interface/model_sugar.rb +84 -0
- data/lib/gecoder/interface/search.rb +30 -18
- data/lib/gecoder/interface/variables.rb +103 -33
- data/lib/gecoder/interface.rb +2 -1
- data/lib/gecoder/version.rb +2 -2
- data/specs/bool_var.rb +19 -12
- data/specs/constraints/{boolean.rb → bool/boolean.rb} +103 -28
- data/specs/constraints/bool/boolean_properties.rb +51 -0
- data/specs/constraints/bool/linear.rb +213 -0
- data/specs/constraints/bool_enum/bool_enum_relation.rb +117 -0
- data/specs/constraints/bool_enum/channel.rb +102 -0
- data/specs/constraints/{extensional.rb → bool_enum/extensional.rb} +32 -101
- data/specs/constraints/constraint_helper.rb +149 -179
- data/specs/constraints/constraint_receivers.rb +103 -0
- data/specs/constraints/constraints.rb +6 -63
- data/specs/constraints/fixnum_enum/element.rb +58 -0
- data/specs/constraints/fixnum_enum/operation.rb +67 -0
- data/specs/constraints/int/arithmetic.rb +149 -0
- data/specs/constraints/int/channel.rb +101 -0
- data/specs/constraints/int/domain.rb +106 -0
- data/specs/constraints/int/linear.rb +183 -0
- data/specs/constraints/int/linear_properties.rb +97 -0
- data/specs/constraints/int/relation.rb +84 -0
- data/specs/constraints/int_enum/arithmetic.rb +72 -0
- data/specs/constraints/int_enum/channel.rb +57 -0
- data/specs/constraints/int_enum/count.rb +72 -0
- data/specs/constraints/int_enum/distinct.rb +80 -0
- data/specs/constraints/int_enum/element.rb +61 -0
- data/specs/constraints/int_enum/equality.rb +29 -0
- data/specs/constraints/int_enum/extensional.rb +224 -0
- data/specs/constraints/int_enum/sort.rb +167 -0
- data/specs/constraints/operands.rb +264 -0
- data/specs/constraints/property_helper.rb +443 -0
- data/specs/constraints/reification_sugar.rb +4 -5
- data/specs/constraints/selected_set/select.rb +56 -0
- data/specs/constraints/selected_set/select_properties.rb +157 -0
- data/specs/constraints/set/cardinality.rb +58 -0
- data/specs/constraints/set/cardinality_properties.rb +46 -0
- data/specs/constraints/set/channel.rb +77 -0
- data/specs/constraints/set/connection.rb +176 -0
- data/specs/constraints/set/domain.rb +197 -0
- data/specs/constraints/set/include.rb +36 -0
- data/specs/constraints/set/operation.rb +132 -0
- data/specs/constraints/set/relation.rb +117 -0
- data/specs/constraints/set_elements/relation.rb +84 -0
- data/specs/constraints/set_enum/channel.rb +80 -0
- data/specs/constraints/set_enum/distinct.rb +59 -0
- data/specs/constraints/set_enum/operation.rb +111 -0
- data/specs/constraints/set_enum/select.rb +73 -0
- data/specs/enum_wrapper.rb +53 -3
- data/specs/int_var.rb +44 -25
- data/specs/model.rb +58 -1
- data/specs/model_sugar.rb +30 -0
- data/specs/search.rb +24 -5
- data/specs/selected_set.rb +39 -0
- data/specs/set_elements.rb +34 -0
- data/specs/set_var.rb +22 -8
- data/specs/spec_helper.rb +206 -6
- data/tasks/distribution.rake +22 -7
- data/tasks/svn.rake +3 -1
- metadata +219 -135
- data/lib/gecoder/interface/constraints/set_enum/selection.rb +0 -217
- data/specs/constraints/arithmetic.rb +0 -351
- data/specs/constraints/bool_enum_relation.rb +0 -160
- data/specs/constraints/cardinality.rb +0 -157
- data/specs/constraints/channel.rb +0 -454
- data/specs/constraints/connection.rb +0 -369
- data/specs/constraints/count.rb +0 -146
- data/specs/constraints/distinct.rb +0 -164
- data/specs/constraints/element.rb +0 -108
- data/specs/constraints/equality.rb +0 -31
- data/specs/constraints/int_domain.rb +0 -70
- data/specs/constraints/int_relation.rb +0 -82
- data/specs/constraints/linear.rb +0 -340
- data/specs/constraints/selection.rb +0 -292
- data/specs/constraints/set_domain.rb +0 -185
- data/specs/constraints/set_operation.rb +0 -285
- data/specs/constraints/set_relation.rb +0 -197
- data/specs/constraints/sort.rb +0 -179
@@ -1,149 +1,150 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
module Gecode::Int
|
2
|
+
module IntOperand
|
3
|
+
# Produces an IntOperand representing the absolute value of this
|
4
|
+
# operand.
|
5
|
+
#
|
6
|
+
# ==== Examples
|
7
|
+
#
|
8
|
+
# # The absolute value of +int_op+.
|
9
|
+
# int_op.abs
|
10
|
+
def abs
|
11
|
+
Arithmetic::IntAbsOperand.new(@model, self)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Produces an IntOperand representing this operand squared.
|
15
|
+
#
|
16
|
+
# ==== Examples
|
17
|
+
#
|
18
|
+
# # The value of +int_op*int_op+.
|
19
|
+
# int_op.squared
|
20
|
+
def squared
|
21
|
+
Arithmetic::IntSquaredOperand.new(@model, self)
|
22
|
+
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
# Produces an IntOperand representing the square root of this
|
25
|
+
# operand rounded down.
|
26
|
+
#
|
27
|
+
# ==== Examples
|
28
|
+
#
|
29
|
+
# # The square root of +int_op+, rounded down.
|
30
|
+
# int_op.square_root
|
31
|
+
def square_root
|
32
|
+
Arithmetic::IntSquareRootOperand.new(@model, self)
|
31
33
|
end
|
32
|
-
|
33
|
-
end
|
34
|
+
alias_method :sqrt, :square_root
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
lhs = @params[:lhs]
|
51
|
-
if constrain
|
52
|
-
bounds = [lhs.min.abs, lhs.max.abs]
|
53
|
-
variable.must_be.in bounds.min..bounds.max
|
36
|
+
|
37
|
+
alias_method :pre_arith_mult, :*
|
38
|
+
|
39
|
+
# Produces a new IntOperand representing this operand times
|
40
|
+
# +int_operand+.
|
41
|
+
#
|
42
|
+
# ==== Examples
|
43
|
+
#
|
44
|
+
# # The value of +int_op1+ times +int_op2+.
|
45
|
+
# int_op1 * int_op2
|
46
|
+
def *(int_operand)
|
47
|
+
if int_operand.respond_to? :to_int_var
|
48
|
+
Arithmetic::IntMultOperand.new(@model, self, int_operand)
|
49
|
+
else
|
50
|
+
pre_arith_mult(int_operand)
|
54
51
|
end
|
55
|
-
|
56
|
-
Gecode::Raw::abs(@model.active_space, lhs.bind, variable.bind,
|
57
|
-
*propagation_options)
|
58
52
|
end
|
59
53
|
end
|
60
54
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#
|
69
|
-
# # The value of +x*y+ must be less than 17, with +bool+ as reification
|
70
|
-
# # variable and +domain+ as strength.
|
71
|
-
# (x*y).must_be.less_than(17, :reify => bool, :strength => :domain)
|
72
|
-
class MultExpressionStub < Gecode::Constraints::Int::CompositeStub
|
73
|
-
def constrain_equal(variable, params, constrain)
|
74
|
-
lhs, lhs2 = @params.values_at(:lhs, :var)
|
75
|
-
if constrain
|
76
|
-
a_min = lhs.min; a_max = lhs.max
|
77
|
-
b_min = lhs2.min; b_max = lhs2.max
|
78
|
-
products = [a_min*b_min, a_min*b_max, a_max*b_min, a_max*b_max]
|
79
|
-
variable.must_be.in products.min..products.max
|
55
|
+
# A module that gathers the classes and modules used by arithmetic
|
56
|
+
# constraints.
|
57
|
+
module Arithmetic #:nodoc:
|
58
|
+
class IntAbsOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc:
|
59
|
+
def initialize(model, int_op)
|
60
|
+
super model
|
61
|
+
@int = int_op
|
80
62
|
end
|
81
63
|
|
82
|
-
|
83
|
-
|
64
|
+
def constrain_equal(int_operand, constrain, propagation_options)
|
65
|
+
int_op = @int.to_int_var
|
66
|
+
if constrain
|
67
|
+
bounds = [int_op.min.abs, int_op.max.abs]
|
68
|
+
bounds << 0 if int_op.min < 0
|
69
|
+
int_operand.must_be.in bounds.min..bounds.max
|
70
|
+
end
|
71
|
+
|
72
|
+
Gecode::Raw::abs(@model.active_space, int_op.to_int_var.bind,
|
73
|
+
int_operand.to_int_var.bind, *propagation_options)
|
74
|
+
end
|
84
75
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
#
|
92
|
-
# # The value of +x*x+ must be equal to y.
|
93
|
-
# x.squared.must == y
|
94
|
-
#
|
95
|
-
# # The value of +x*x+ must be less than or equal to 16, with +bool+ as
|
96
|
-
# # reification variable and +domain+ as strength.
|
97
|
-
# x.squared.must_be.less_or_equal(16, :reify => bool, :strength => :domain)
|
98
|
-
class SquaredExpressionStub < Gecode::Constraints::Int::CompositeStub
|
99
|
-
def constrain_equal(variable, params, constrain)
|
100
|
-
lhs = @params[:lhs]
|
101
|
-
if constrain
|
102
|
-
min = lhs.min; max = lhs.max
|
103
|
-
products = [min*max, min*min, max*max]
|
104
|
-
variable.must_be.in products.min..products.max
|
76
|
+
|
77
|
+
class IntMultOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc:
|
78
|
+
def initialize(model, op1, op2)
|
79
|
+
super model
|
80
|
+
@op1 = op1
|
81
|
+
@op2 = op2
|
105
82
|
end
|
106
83
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
#
|
115
|
-
# == Examples
|
116
|
-
#
|
117
|
-
# # The square root of +x+, rounded down, must equal y.
|
118
|
-
# x.square_root.must == y
|
119
|
-
#
|
120
|
-
# # The square root of +x+, rounded down, must be larger than 17, with
|
121
|
-
# # +bool+ as reification variable and +domain+ as strength.
|
122
|
-
# x.square_root.must_be.larger_than(17, :reify => bool, :strength => :domain)
|
123
|
-
class SquareRootExpressionStub < Gecode::Constraints::Int::CompositeStub
|
124
|
-
def constrain_equal(variable, params, constrain)
|
125
|
-
lhs = @params[:lhs]
|
126
|
-
if constrain
|
127
|
-
max = lhs.max
|
128
|
-
if max < 0
|
129
|
-
# The left hand side does not have a real valued square root.
|
130
|
-
upper_bound = 0
|
131
|
-
else
|
132
|
-
upper_bound = Math.sqrt(max).floor;
|
84
|
+
def constrain_equal(int_operand, constrain, propagation_options)
|
85
|
+
int_op1, int_op2 = @op1.to_int_var, @op2.to_int_var
|
86
|
+
if constrain
|
87
|
+
a_min = int_op1.min; a_max = int_op1.max
|
88
|
+
b_min = int_op2.min; b_max = int_op2.max
|
89
|
+
products = [a_min*b_min, a_min*b_max, a_max*b_min, a_max*b_max]
|
90
|
+
int_operand.must_be.in products.min..products.max
|
133
91
|
end
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
92
|
+
|
93
|
+
Gecode::Raw::mult(@model.active_space, int_op1.to_int_var.bind,
|
94
|
+
int_op2.to_int_var.bind, int_operand.to_int_var.bind,
|
95
|
+
*propagation_options)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class IntSquaredOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc:
|
100
|
+
def initialize(model, int_op)
|
101
|
+
super model
|
102
|
+
@int = int_op
|
103
|
+
end
|
104
|
+
|
105
|
+
def constrain_equal(int_operand, constrain, propagation_options)
|
106
|
+
int_op = @int.to_int_var
|
107
|
+
if constrain
|
108
|
+
min = int_op.min; max = int_op.max
|
109
|
+
products = [min*max, min*min, max*max]
|
110
|
+
int_operand.must_be.in products.min..products.max
|
140
111
|
end
|
141
|
-
|
142
|
-
|
112
|
+
|
113
|
+
Gecode::Raw::sqr(@model.active_space, int_op.to_int_var.bind,
|
114
|
+
int_operand.to_int_var.bind, *propagation_options)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class IntSquareRootOperand < Gecode::Int::ShortCircuitEqualityOperand #:nodoc:
|
119
|
+
def initialize(model, int_op)
|
120
|
+
super model
|
121
|
+
@int = int_op
|
143
122
|
end
|
144
123
|
|
145
|
-
|
146
|
-
|
124
|
+
def constrain_equal(int_operand, constrain, propagation_options)
|
125
|
+
int_op = @int.to_int_var
|
126
|
+
if constrain
|
127
|
+
max = int_op.max
|
128
|
+
if max < 0
|
129
|
+
# The left hand side does not have a real valued square root.
|
130
|
+
upper_bound = 0
|
131
|
+
else
|
132
|
+
upper_bound = Math.sqrt(max).floor;
|
133
|
+
end
|
134
|
+
|
135
|
+
min = int_op.min
|
136
|
+
if min < 0
|
137
|
+
lower_bound = 0
|
138
|
+
else
|
139
|
+
lower_bound = Math.sqrt(min).floor;
|
140
|
+
end
|
141
|
+
|
142
|
+
int_operand.must_be.in lower_bound..upper_bound
|
143
|
+
end
|
144
|
+
|
145
|
+
Gecode::Raw::sqrt(@model.active_space, int_op.to_int_var.bind,
|
146
|
+
int_operand.to_int_var.bind, *propagation_options)
|
147
|
+
end
|
147
148
|
end
|
148
149
|
end
|
149
150
|
end
|
@@ -1,13 +1,19 @@
|
|
1
|
-
module Gecode::
|
2
|
-
class
|
1
|
+
module Gecode::Int
|
2
|
+
class IntConstraintReceiver
|
3
3
|
alias_method :pre_channel_equals, :==
|
4
4
|
|
5
|
-
# Constrains the integer
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# Constrains the integer operand to be equal to the specified boolean
|
6
|
+
# operand. I.e. constrains the integer operand to be 1 when the boolean
|
7
|
+
# operand is true and 0 if the boolean operand is false.
|
8
|
+
#
|
9
|
+
# ==== Examples
|
10
|
+
#
|
11
|
+
# # The integer operand +int+ must be one exactly when the boolean
|
12
|
+
# # operand +bool+ is true.
|
13
|
+
# int.must == bool
|
8
14
|
def ==(bool, options = {})
|
9
|
-
unless @params[:lhs].
|
10
|
-
bool.
|
15
|
+
unless @params[:lhs].respond_to? :to_int_var and
|
16
|
+
bool.respond_to? :to_bool_var
|
11
17
|
return pre_channel_equals(bool, options)
|
12
18
|
end
|
13
19
|
|
@@ -20,42 +26,26 @@ module Gecode::Constraints::Int
|
|
20
26
|
'constraint.'
|
21
27
|
end
|
22
28
|
|
23
|
-
@params.update(Gecode::
|
29
|
+
@params.update(Gecode::Util.decode_options(options))
|
24
30
|
@params[:rhs] = bool
|
25
31
|
@model.add_constraint Channel::ChannelConstraint.new(@model, @params)
|
26
32
|
end
|
27
33
|
|
28
34
|
alias_comparison_methods
|
29
35
|
|
30
|
-
#
|
31
|
-
|
32
|
-
# channel constraint can also take the following option:
|
33
|
-
#
|
34
|
-
# [:offset] Specifies an offset for the integer variable. If the offset is
|
35
|
-
# set to k then the integer variable takes value i+k exactly
|
36
|
-
# when the variable at index i in the boolean enumration is true
|
37
|
-
# and the rest are false.
|
38
|
-
provide_commutivity(:channel){ |rhs, _| rhs.respond_to? :to_bool_var_array }
|
36
|
+
# Provides commutativity with BoolEnumConstraintReceiver#channel .
|
37
|
+
provide_commutativity(:channel){ |rhs, _| rhs.respond_to? :to_bool_enum }
|
39
38
|
end
|
40
39
|
|
41
40
|
# A module that gathers the classes and modules used in channel constraints
|
42
|
-
# involving a single integer
|
41
|
+
# involving a single integer operand.
|
43
42
|
module Channel #:nodoc:
|
44
|
-
|
45
|
-
# 1 if a boolean variable is true, and 0 when the boolean variable is false.
|
46
|
-
# Does not support negation nor reification.
|
47
|
-
#
|
48
|
-
# == Examples
|
49
|
-
#
|
50
|
-
# # The integer variable +x+ must be one exactly when the boolean
|
51
|
-
# # variable +bool+ is true.
|
52
|
-
# x.must == bool
|
53
|
-
class ChannelConstraint < Gecode::Constraints::Constraint
|
43
|
+
class ChannelConstraint < Gecode::Constraint #:nodoc:
|
54
44
|
def post
|
55
45
|
lhs, rhs = @params.values_at(:lhs, :rhs)
|
56
|
-
Gecode::Raw::channel(@model.active_space, lhs.bind,
|
57
|
-
*propagation_options)
|
46
|
+
Gecode::Raw::channel(@model.active_space, lhs.to_int_var.bind,
|
47
|
+
rhs.to_bool_var.bind, *propagation_options)
|
58
48
|
end
|
59
49
|
end
|
60
50
|
end
|
61
|
-
end
|
51
|
+
end
|
@@ -1,8 +1,34 @@
|
|
1
|
-
module Gecode::
|
2
|
-
class
|
3
|
-
# Creates a domain constraint using the specified domain
|
1
|
+
module Gecode::Int
|
2
|
+
class IntConstraintReceiver
|
3
|
+
# Creates a domain constraint using the specified domain, specified
|
4
|
+
# as an enumeration of integers. The integer operand is constrained
|
5
|
+
# to take a value in the domain. Domains should be specified as
|
6
|
+
# ranges if possible.
|
7
|
+
#
|
8
|
+
# ==== Examples
|
9
|
+
#
|
10
|
+
# # +x+ must be in the range 1..10
|
11
|
+
# x.must_be.in 1..10
|
12
|
+
#
|
13
|
+
# # +x+ must not be in the range -5...5
|
14
|
+
# x.must_not_be.in -5...5
|
15
|
+
#
|
16
|
+
# # Specifies the above, but reifies the constraint with the boolean
|
17
|
+
# # operand +bool+ and specified +value+ as strength.
|
18
|
+
# x.must_not_be.in(-5...5, :reify => bool, :strength => :value)
|
19
|
+
#
|
20
|
+
# # +x+ must be in the enumeration [3,5,7].
|
21
|
+
# x.must_be.in [3,5,7]
|
22
|
+
#
|
23
|
+
# # +x+ must not be in the enumeration [5,6,7,17].
|
24
|
+
# x.must_not_be.in [5,6,7,17]
|
25
|
+
#
|
26
|
+
# # Specifies the above, but reifies the constraint with the boolean
|
27
|
+
# # operand +bool+ and specified +value+ as strength.
|
28
|
+
# x.must_not_be.in([5,6,7,17], :reify => bool, :strength => :value)
|
29
|
+
#
|
4
30
|
def in(domain, options = {})
|
5
|
-
@params.update(Gecode::
|
31
|
+
@params.update(Gecode::Util.decode_options(options))
|
6
32
|
@params[:domain] = domain
|
7
33
|
if domain.kind_of? Range
|
8
34
|
@model.add_constraint Domain::RangeDomainConstraint.new(@model, @params)
|
@@ -17,28 +43,17 @@ module Gecode::Constraints::Int
|
|
17
43
|
|
18
44
|
# A module that gathers the classes and modules used in domain constraints.
|
19
45
|
module Domain #:nodoc:
|
20
|
-
# Range domain constraints specify that an integer
|
21
|
-
# contained within a specified range of integers.
|
22
|
-
|
23
|
-
#
|
24
|
-
# == Examples
|
25
|
-
#
|
26
|
-
# # +x+ must be in the range 1..10
|
27
|
-
# x.must_be.in 1..10
|
28
|
-
#
|
29
|
-
# # +x+ must not be in the range -5...5
|
30
|
-
# x.must_not_be.in -5...5
|
31
|
-
#
|
32
|
-
# # Specifies the above, but but reifies the constraint with the boolean
|
33
|
-
# # variable +bool+ and specified +value+ as strength.
|
34
|
-
# x.must_not_be.in(-5...5, :reify => bool, :strength => :value)
|
35
|
-
class RangeDomainConstraint < Gecode::Constraints::ReifiableConstraint
|
46
|
+
# Range domain constraints specify that an integer operand must be
|
47
|
+
# contained within a specified range of integers.
|
48
|
+
class RangeDomainConstraint < Gecode::ReifiableConstraint #:nodoc:
|
36
49
|
def post
|
37
50
|
var, domain, reif_var = @params.values_at(:lhs, :domain, :reif)
|
38
51
|
|
39
|
-
(params = []) << var.bind
|
40
|
-
|
41
|
-
|
52
|
+
(params = []) << var.to_int_var.bind
|
53
|
+
last = domain.last
|
54
|
+
last -= 1 if domain.exclude_end?
|
55
|
+
params << domain.first << last
|
56
|
+
params << reif_var.to_bool_var.bind if reif_var.respond_to? :to_bool_var
|
42
57
|
params.concat propagation_options
|
43
58
|
|
44
59
|
Gecode::Raw::dom(@model.active_space, *params)
|
@@ -46,27 +61,15 @@ module Gecode::Constraints::Int
|
|
46
61
|
negate_using_reification
|
47
62
|
end
|
48
63
|
|
49
|
-
# Enum domain constraints specify that an integer
|
50
|
-
# in an enumeration of integers.
|
51
|
-
|
52
|
-
# == Examples
|
53
|
-
#
|
54
|
-
# # +x+ must be in the enumeration [3,5,7].
|
55
|
-
# x.must_be.in [3,5,7]
|
56
|
-
#
|
57
|
-
# # +x+ must not be in the enumeration [5,6,7,17].
|
58
|
-
# x.must_not_be.in [5,6,7,17]
|
59
|
-
#
|
60
|
-
# # Specifies the above, but but reifies the constraint with the boolean
|
61
|
-
# # variable +bool+ and specified +value+ as strength.
|
62
|
-
# x.must_not_be.in(-[5,6,7,17], :reify => bool, :strength => :value)
|
63
|
-
class EnumDomainConstraint < Gecode::Constraints::ReifiableConstraint
|
64
|
+
# Enum domain constraints specify that an integer operand must be contained
|
65
|
+
# in an enumeration of integers.
|
66
|
+
class EnumDomainConstraint < Gecode::ReifiableConstraint #:nodoc:
|
64
67
|
def post
|
65
68
|
var, domain, reif_var = @params.values_at(:lhs, :domain, :reif)
|
66
69
|
|
67
|
-
(params = []) << var.bind
|
68
|
-
params << Gecode::
|
69
|
-
params << reif_var.bind if reif_var.respond_to? :
|
70
|
+
(params = []) << var.to_int_var.bind
|
71
|
+
params << Gecode::Util.constant_set_to_int_set(domain)
|
72
|
+
params << reif_var.to_bool_var.bind if reif_var.respond_to? :to_bool_var
|
70
73
|
params.concat propagation_options
|
71
74
|
|
72
75
|
Gecode::Raw::dom(@model.active_space, *params)
|
@@ -74,4 +77,4 @@ module Gecode::Constraints::Int
|
|
74
77
|
negate_using_reification
|
75
78
|
end
|
76
79
|
end
|
77
|
-
end
|
80
|
+
end
|