gecoder 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +14 -0
- data/ext/gecoder.cpp +181 -0
- data/ext/gecoder.h +94 -0
- data/ext/vararray.cpp +3 -3
- data/lib/gecoder/bindings/bindings.rb +104 -46
- data/lib/gecoder/interface/binding_changes.rb +1 -301
- data/lib/gecoder/interface/branch.rb +15 -11
- data/lib/gecoder/interface/constraints/bool/boolean.rb +56 -52
- data/lib/gecoder/interface/constraints/bool/channel.rb +1 -16
- data/lib/gecoder/interface/constraints/bool_enum/channel.rb +13 -8
- data/lib/gecoder/interface/constraints/bool_enum/extensional.rb +48 -0
- data/lib/gecoder/interface/constraints/extensional_regexp.rb +101 -0
- data/lib/gecoder/interface/constraints/int/channel.rb +1 -13
- data/lib/gecoder/interface/constraints/int_enum/channel.rb +15 -35
- data/lib/gecoder/interface/constraints/int_enum/extensional.rb +130 -0
- data/lib/gecoder/interface/constraints/set/channel.rb +54 -0
- data/lib/gecoder/interface/constraints/set_enum/channel.rb +37 -6
- data/lib/gecoder/interface/constraints/set_var_constraints.rb +1 -0
- data/lib/gecoder/interface/constraints.rb +38 -0
- data/lib/gecoder/interface/model.rb +110 -85
- data/lib/gecoder/interface/variables.rb +3 -21
- data/lib/gecoder/version.rb +1 -1
- data/specs/branch.rb +16 -1
- data/specs/constraints/bool_enum_relation.rb +6 -6
- data/specs/constraints/boolean.rb +31 -25
- data/specs/constraints/channel.rb +102 -4
- data/specs/constraints/extensional.rb +185 -2
- data/specs/constraints/reification_sugar.rb +2 -46
- data/specs/model.rb +85 -7
- data/tasks/dependencies.txt +1 -0
- data/vendor/rust/rust/class.rb +33 -35
- data/vendor/rust/rust/templates/ClassDeclarations.rusttpl +1 -1
- data/vendor/rust/rust/templates/CxxClassDefinitions.rusttpl +10 -1
- metadata +185 -184
- data/example/raw_bindings.rb +0 -44
- data/ext/missing.cpp +0 -328
- data/ext/missing.h +0 -120
- data/specs/binding_changes.rb +0 -76
data/CHANGES
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== Version 0.8.3
|
2
|
+
This release adds regular expression constraints, the last channel
|
3
|
+
constraint and various minor convenience improvements. It also fixes a
|
4
|
+
rather serious bug that occurs when using the latest patchlevels of Ruby
|
5
|
+
1.8.6.
|
6
|
+
|
7
|
+
* [#20888] Fixed a GC bug causing problems with Ruby 1.8.6 at patchlevels around 230.
|
8
|
+
* Boolean constraints can no longer be specified using the form "bool.must == true". Only the "bool.must_be.true" form can now be used.
|
9
|
+
* Added constants in Model that contain the limits of the variables' domains.
|
10
|
+
* The domain when construction arrays and matrices of int variables now default to the same as when creating single variables (the largest possible domain).
|
11
|
+
* Model#branch_on now accepts single variables as well as enums.
|
12
|
+
* Added channel constraints between single set variables and enumerations of boolean variables.
|
13
|
+
* Added integer and boolean regular expression constraints. Thanks goes to Eivind Eklund for providing the idea for the syntax used to specify the regular expressions.
|
14
|
+
|
1
15
|
== Version 0.8.2
|
2
16
|
This release adds search statistics along with some new arithmetic constraints
|
3
17
|
and channel constraints between boolean and integer variables.
|
data/ext/gecoder.cpp
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
/**
|
2
|
+
* Gecode/R, a Ruby interface to Gecode.
|
3
|
+
* Copyright (C) 2007 The Gecode/R development team.
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
**/
|
19
|
+
|
20
|
+
#include "gecoder.h"
|
21
|
+
#include "gecode.hh"
|
22
|
+
|
23
|
+
#include <iostream>
|
24
|
+
#include <map>
|
25
|
+
|
26
|
+
namespace Gecode {
|
27
|
+
MSpace::MSpace() {
|
28
|
+
}
|
29
|
+
|
30
|
+
MSpace::MSpace(bool share, MSpace& s) : Gecode::Space(share, s) {
|
31
|
+
int_variables.update(this, share, s.int_variables);
|
32
|
+
bool_variables.update(this, share, s.bool_variables);
|
33
|
+
set_variables.update(this, share, s.set_variables);
|
34
|
+
}
|
35
|
+
|
36
|
+
MSpace::~MSpace() {
|
37
|
+
#ifdef DEBUG
|
38
|
+
fprintf(stderr, "gecoder: destructing MSpace %p\n", this);
|
39
|
+
#endif
|
40
|
+
}
|
41
|
+
|
42
|
+
Gecode::Space* MSpace::copy(bool share) {
|
43
|
+
return new MSpace(share, *this);
|
44
|
+
}
|
45
|
+
|
46
|
+
/*
|
47
|
+
* Creates a new integer variable with the specified domain and
|
48
|
+
* returns its identifier.
|
49
|
+
*/
|
50
|
+
int MSpace::new_int_var(int min, int max) {
|
51
|
+
int id = int_variables.size();
|
52
|
+
Gecode::IntVar* var = new IntVar(this, min, max);
|
53
|
+
int_variables.add(this, *var);
|
54
|
+
return id;
|
55
|
+
}
|
56
|
+
int MSpace::new_int_var(IntSet domain) {
|
57
|
+
int id = int_variables.size();
|
58
|
+
Gecode::IntVar* var = new IntVar(this, domain);
|
59
|
+
int_variables.add(this, *var);
|
60
|
+
return id;
|
61
|
+
}
|
62
|
+
|
63
|
+
/*
|
64
|
+
* Creates a new boolean variable and returns its identifier.
|
65
|
+
*/
|
66
|
+
int MSpace::new_bool_var() {
|
67
|
+
int id = bool_variables.size();
|
68
|
+
Gecode::BoolVar* var = new BoolVar(this, 0, 1);
|
69
|
+
bool_variables.add(this, *var);
|
70
|
+
return id;
|
71
|
+
}
|
72
|
+
|
73
|
+
/*
|
74
|
+
* Creates a new set variable with the specified domain and returns
|
75
|
+
* its identifier.
|
76
|
+
*/
|
77
|
+
int MSpace::new_set_var(const IntSet& glb, const IntSet& lub, unsigned int card_min, unsigned int card_max) {
|
78
|
+
int id = set_variables.size();
|
79
|
+
Gecode::SetVar* var = new SetVar(this, glb, lub, card_min, card_max);
|
80
|
+
set_variables.add(this, *var);
|
81
|
+
return id;
|
82
|
+
}
|
83
|
+
|
84
|
+
/*
|
85
|
+
* Fetches the integer variable with the specified identifier.
|
86
|
+
*/
|
87
|
+
Gecode::IntVar* MSpace::int_var(int id) {
|
88
|
+
return &int_variables[id];
|
89
|
+
}
|
90
|
+
|
91
|
+
/*
|
92
|
+
* Fetches the integer variable with the specified identifier.
|
93
|
+
*/
|
94
|
+
Gecode::BoolVar* MSpace::bool_var(int id) {
|
95
|
+
return &bool_variables[id];
|
96
|
+
}
|
97
|
+
|
98
|
+
/*
|
99
|
+
* Fetches the integer variable with the specified identifier.
|
100
|
+
*/
|
101
|
+
Gecode::SetVar* MSpace::set_var(int id) {
|
102
|
+
return &set_variables[id];
|
103
|
+
}
|
104
|
+
|
105
|
+
void MSpace::gc_mark() {
|
106
|
+
for(int i = 0; i < int_variables.size(); i++) {
|
107
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&int_variables[i], false, false));
|
108
|
+
}
|
109
|
+
for(int i = 0; i < bool_variables.size(); i++) {
|
110
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&bool_variables[i], false, false));
|
111
|
+
}
|
112
|
+
for(int i = 0; i < set_variables.size(); i++) {
|
113
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&set_variables[i], false, false));
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
// For BAB.
|
118
|
+
void MSpace::constrain(MSpace* s) {
|
119
|
+
// Call Ruby's constrain.
|
120
|
+
rb_funcall(Rust_gecode::cxx2ruby(this), rb_intern("constrain"), 1,
|
121
|
+
Rust_gecode::cxx2ruby(s, false));
|
122
|
+
}
|
123
|
+
|
124
|
+
/*
|
125
|
+
* MDFS is the same as DFS but with the size of a space inferred from the
|
126
|
+
* other arguments, since it can't be done from the Ruby side.
|
127
|
+
*/
|
128
|
+
MDFS::MDFS(MSpace* space, unsigned int c_d, unsigned int a_d, Search::Stop* st) : Gecode::Search::DFS(space, c_d, a_d, st, sizeof(space)) {
|
129
|
+
}
|
130
|
+
|
131
|
+
MDFS::~MDFS() {
|
132
|
+
}
|
133
|
+
|
134
|
+
/*
|
135
|
+
* MBAB is the same as BAB but with the size of a space inferred from the
|
136
|
+
* other arguments, since it can't be done from the Ruby side.
|
137
|
+
*/
|
138
|
+
MBAB::MBAB(MSpace* space, const Search::Options &o) : Gecode::BAB<MSpace>(space, o) {
|
139
|
+
}
|
140
|
+
|
141
|
+
MBAB::~MBAB() {
|
142
|
+
}
|
143
|
+
|
144
|
+
namespace Search {
|
145
|
+
/*
|
146
|
+
* MStop combines the time stop and fail stop, but for what reason?
|
147
|
+
* TODO: Try removing MStop, replacing it with plain Stop objects.
|
148
|
+
*/
|
149
|
+
|
150
|
+
struct MStop::Private {
|
151
|
+
Gecode::Search::TimeStop* ts;
|
152
|
+
Gecode::Search::FailStop* fs;
|
153
|
+
};
|
154
|
+
|
155
|
+
MStop::MStop() : d(new Private) {
|
156
|
+
d->ts = 0;
|
157
|
+
d->fs = 0;
|
158
|
+
}
|
159
|
+
|
160
|
+
MStop::MStop(int fails, int time) : d(new Private) {
|
161
|
+
d->ts = new Search::TimeStop(time);
|
162
|
+
d->fs = new Search::FailStop(fails);
|
163
|
+
}
|
164
|
+
|
165
|
+
MStop::~MStop() {
|
166
|
+
}
|
167
|
+
|
168
|
+
bool MStop::stop(const Gecode::Search::Statistics &s) {
|
169
|
+
if (!d->fs && !d->ts) return false;
|
170
|
+
return d->fs->stop(s) || d->ts->stop(s);
|
171
|
+
}
|
172
|
+
|
173
|
+
Gecode::Search::Stop* MStop::create(int fails, int time) {
|
174
|
+
if (fails < 0 && time < 0) return 0;
|
175
|
+
if (fails < 0) return new Search::TimeStop(time);
|
176
|
+
if (time < 0) return new Search::FailStop(fails);
|
177
|
+
|
178
|
+
return new MStop(fails, time);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
data/ext/gecoder.h
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
/**
|
2
|
+
* Gecode/R, a Ruby interface to Gecode.
|
3
|
+
* Copyright (C) 2007 The Gecode/R development team.
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
**/
|
19
|
+
|
20
|
+
#ifndef __GECODER_H
|
21
|
+
#define __GECODER_H
|
22
|
+
|
23
|
+
#include <ruby.h>
|
24
|
+
|
25
|
+
#include <gecode/kernel.hh>
|
26
|
+
#include <gecode/int.hh>
|
27
|
+
#include <gecode/search.hh>
|
28
|
+
#include <gecode/minimodel.hh>
|
29
|
+
#include <gecode/set.hh>
|
30
|
+
|
31
|
+
#include "vararray.h"
|
32
|
+
|
33
|
+
namespace Gecode {
|
34
|
+
class MSpace : public Space {
|
35
|
+
public:
|
36
|
+
MSpace();
|
37
|
+
MSpace(bool share, MSpace& s);
|
38
|
+
~MSpace();
|
39
|
+
Gecode::Space *copy(bool share);
|
40
|
+
|
41
|
+
int new_int_var(int min, int max);
|
42
|
+
int new_int_var(IntSet domain);
|
43
|
+
Gecode::IntVar* int_var(int id);
|
44
|
+
|
45
|
+
int new_bool_var();
|
46
|
+
Gecode::BoolVar* bool_var(int id);
|
47
|
+
|
48
|
+
int new_set_var(const IntSet& glb, const IntSet& lub, unsigned int card_min, unsigned int card_max);
|
49
|
+
Gecode::SetVar* set_var(int id);
|
50
|
+
|
51
|
+
void gc_mark();
|
52
|
+
|
53
|
+
void constrain(MSpace* s);
|
54
|
+
|
55
|
+
private:
|
56
|
+
Gecode::IntVarArray int_variables;
|
57
|
+
Gecode::BoolVarArray bool_variables;
|
58
|
+
Gecode::SetVarArray set_variables;
|
59
|
+
};
|
60
|
+
|
61
|
+
class MDFS : public Gecode::Search::DFS {
|
62
|
+
public:
|
63
|
+
MDFS(MSpace *space, unsigned int c_d, unsigned int a_d, Search::Stop* st = 0);
|
64
|
+
~MDFS();
|
65
|
+
};
|
66
|
+
|
67
|
+
class MBAB : public Gecode::BAB<MSpace> {
|
68
|
+
public:
|
69
|
+
MBAB(MSpace* space, const Search::Options &o);
|
70
|
+
~MBAB();
|
71
|
+
};
|
72
|
+
|
73
|
+
namespace Search {
|
74
|
+
class MStop : public Gecode::Search::Stop {
|
75
|
+
private:
|
76
|
+
MStop(int fails, int time);
|
77
|
+
|
78
|
+
public:
|
79
|
+
MStop();
|
80
|
+
~MStop();
|
81
|
+
|
82
|
+
bool stop (const Gecode::Search::Statistics &s);
|
83
|
+
static Gecode::Search::Stop* create(int fails, int time);
|
84
|
+
|
85
|
+
private:
|
86
|
+
struct Private;
|
87
|
+
Private *const d;
|
88
|
+
};
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
#endif
|
93
|
+
|
94
|
+
|
data/ext/vararray.cpp
CHANGED
@@ -133,7 +133,7 @@ IntVar &MIntVarArray::operator [](int index)
|
|
133
133
|
void MIntVarArray::gc_mark()
|
134
134
|
{
|
135
135
|
for(int i = size(); i--; ) {
|
136
|
-
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i])));
|
136
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i]), false, false));
|
137
137
|
}
|
138
138
|
}
|
139
139
|
|
@@ -210,7 +210,7 @@ Gecode::BoolVar &MBoolVarArray::operator[](int index)
|
|
210
210
|
void MBoolVarArray::gc_mark()
|
211
211
|
{
|
212
212
|
for(int i = size(); i--; ) {
|
213
|
-
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i])));
|
213
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i]), false, false));
|
214
214
|
}
|
215
215
|
}
|
216
216
|
|
@@ -306,7 +306,7 @@ Gecode::SetVar &MSetVarArray::operator[](int index)
|
|
306
306
|
void MSetVarArray::gc_mark()
|
307
307
|
{
|
308
308
|
for(int i = size(); i--; ) {
|
309
|
-
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i])));
|
309
|
+
rb_gc_mark(Rust_gecode::cxx2ruby(&(d->array[i]), false, false));
|
310
310
|
}
|
311
311
|
}
|
312
312
|
|
@@ -77,7 +77,7 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
77
77
|
b.include_header 'gecode/set.hh', Rust::Bindings::HeaderGlobal
|
78
78
|
b.include_header 'gecode/search.hh', Rust::Bindings::HeaderGlobal
|
79
79
|
b.include_header 'gecode/minimodel.hh', Rust::Bindings::HeaderGlobal
|
80
|
-
b.include_header '
|
80
|
+
b.include_header 'gecoder.h', Rust::Bindings::HeaderLocal
|
81
81
|
|
82
82
|
b.add_custom_definition ruby2intargs
|
83
83
|
b.add_custom_definition custom_mark_definitions
|
@@ -351,52 +351,47 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
351
351
|
klass.add_method "tuples", "int"
|
352
352
|
end
|
353
353
|
|
354
|
-
ns.add_cxx_class "MBranchingDesc" do |klass|
|
355
|
-
klass.bindname = "BranchingDesc"
|
356
|
-
klass.add_constructor
|
357
|
-
klass.add_method "alternatives", "int"
|
358
|
-
klass.add_method "size", "int"
|
359
|
-
end
|
360
|
-
|
361
354
|
ns.add_cxx_class "MSpace" do |klass|
|
362
355
|
klass.bindname = "Space"
|
363
356
|
klass.function_mark = 'Gecode_MSpace_custom_mark'
|
364
357
|
|
365
358
|
klass.add_constructor
|
366
|
-
|
367
|
-
klass.add_method "debug"
|
368
|
-
|
359
|
+
|
369
360
|
klass.add_method "constrain" do |method|
|
370
361
|
method.add_parameter "Gecode::MSpace*", "s"
|
371
362
|
end
|
372
363
|
|
373
|
-
klass.add_method "
|
374
|
-
method.add_parameter "
|
375
|
-
method.add_parameter "
|
364
|
+
klass.add_method "new_int_var", "int" do |method|
|
365
|
+
method.add_parameter "int", "min"
|
366
|
+
method.add_parameter "int", "max"
|
376
367
|
end
|
377
368
|
|
378
|
-
klass.add_method "
|
379
|
-
method.add_parameter "Gecode::
|
380
|
-
method.add_parameter "char*", "name"
|
369
|
+
klass.add_method "new_int_var", "int" do |method|
|
370
|
+
method.add_parameter "Gecode::IntSet", "domain"
|
381
371
|
end
|
382
|
-
|
383
|
-
klass.add_method "
|
384
|
-
method.add_parameter "Gecode::MSetVarArray *", "x"
|
385
|
-
method.add_parameter "char*", "name"
|
372
|
+
|
373
|
+
klass.add_method "new_bool_var", "int" do |method|
|
386
374
|
end
|
387
|
-
|
388
|
-
klass.add_method "
|
389
|
-
method.add_parameter "
|
375
|
+
|
376
|
+
klass.add_method "new_set_var", "int" do |method|
|
377
|
+
method.add_parameter "Gecode::IntSet", "glb"
|
378
|
+
method.add_parameter "Gecode::IntSet", "lub"
|
379
|
+
method.add_parameter "int", "cardMin"
|
380
|
+
method.add_parameter "int", "cardMax"
|
390
381
|
end
|
391
|
-
|
392
|
-
klass.add_method "
|
393
|
-
method.add_parameter "
|
382
|
+
|
383
|
+
klass.add_method "int_var", "Gecode::IntVar*" do |method|
|
384
|
+
method.add_parameter "int", "id"
|
394
385
|
end
|
395
|
-
|
396
|
-
klass.add_method "
|
397
|
-
method.add_parameter "
|
386
|
+
|
387
|
+
klass.add_method "bool_var", "Gecode::BoolVar*" do |method|
|
388
|
+
method.add_parameter "int", "id"
|
398
389
|
end
|
399
390
|
|
391
|
+
klass.add_method "set_var", "Gecode::SetVar*" do |method|
|
392
|
+
method.add_parameter "int", "id"
|
393
|
+
end
|
394
|
+
|
400
395
|
klass.add_method "clone", "Gecode::MSpace *" do |method|
|
401
396
|
method.add_parameter "bool", "shared"
|
402
397
|
end
|
@@ -411,13 +406,6 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
411
406
|
# description method used by rspec, and isn't used directly in the
|
412
407
|
# interface.
|
413
408
|
#klass.add_method "mdescription", "Gecode::MBranchingDesc *", "description"
|
414
|
-
|
415
|
-
klass.add_method "commit" do |method|
|
416
|
-
method.add_parameter "Gecode::MBranchingDesc", "desc" do |param|
|
417
|
-
param.custom_conversion = "ruby2Gecode_MBranchingDescPtr(desc, 1)->ptr()"
|
418
|
-
end
|
419
|
-
method.add_parameter "int", "a"
|
420
|
-
end
|
421
409
|
end
|
422
410
|
|
423
411
|
# The namespace structure doesn't completely mimic Gecode's namespace
|
@@ -659,6 +647,57 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
659
647
|
klass.add_method "next", "Gecode::MSpace *"
|
660
648
|
klass.add_method "statistics", "Gecode::Search::Statistics"
|
661
649
|
end
|
650
|
+
|
651
|
+
ns.add_cxx_class "DFA" do |klass|
|
652
|
+
klass.add_constructor
|
653
|
+
end
|
654
|
+
|
655
|
+
ns.add_cxx_class "REG" do |klass|
|
656
|
+
klass.add_constructor
|
657
|
+
|
658
|
+
klass.add_constructor do |method|
|
659
|
+
method.add_parameter "int", "s"
|
660
|
+
end
|
661
|
+
|
662
|
+
klass.add_constructor do |method|
|
663
|
+
method.add_parameter "Gecode::IntArgs&", "x"
|
664
|
+
end
|
665
|
+
|
666
|
+
klass.add_constructor do |method|
|
667
|
+
method.add_parameter "Gecode::REG&", "r"
|
668
|
+
end
|
669
|
+
|
670
|
+
klass.add_operator "+", "Gecode::REG" do |operator|
|
671
|
+
operator.add_parameter "Gecode::REG&", "r"
|
672
|
+
end
|
673
|
+
|
674
|
+
klass.add_operator "+=", "Gecode::REG&" do |operator|
|
675
|
+
operator.add_parameter "Gecode::REG&", "r"
|
676
|
+
end
|
677
|
+
|
678
|
+
klass.add_operator "|", "Gecode::REG" do |operator|
|
679
|
+
operator.add_parameter "Gecode::REG&", "r"
|
680
|
+
end
|
681
|
+
|
682
|
+
klass.add_operator "|=", "Gecode::REG&" do |operator|
|
683
|
+
operator.add_parameter "Gecode::REG&", "r"
|
684
|
+
end
|
685
|
+
|
686
|
+
klass.add_operator "*", "Gecode::REG" do |operator|
|
687
|
+
end
|
688
|
+
|
689
|
+
klass.add_operator "+", "Gecode::REG" do |operator|
|
690
|
+
end
|
691
|
+
|
692
|
+
klass.add_operator "()", "Gecode::REG" do |operator|
|
693
|
+
operator.add_parameter "int", "n"
|
694
|
+
operator.add_parameter "int", "m"
|
695
|
+
end
|
696
|
+
|
697
|
+
klass.add_operator "()", "Gecode::REG" do |operator|
|
698
|
+
operator.add_parameter "int", "n"
|
699
|
+
end
|
700
|
+
end
|
662
701
|
|
663
702
|
# SEARCH NAMESPACE
|
664
703
|
|
@@ -789,7 +828,7 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
789
828
|
method.add_parameter "Gecode::MiniModel::LinRel<Gecode::BoolVar>", "e"
|
790
829
|
end
|
791
830
|
|
792
|
-
klass.add_method "post" do |method|
|
831
|
+
klass.add_method "post", "Gecode::BoolVar" do |method|
|
793
832
|
method.add_parameter "Gecode::MSpace *", "home"
|
794
833
|
method.add_parameter "Gecode::IntConLevel", "icl"
|
795
834
|
method.add_parameter "Gecode::PropKind", "pk"
|
@@ -1276,14 +1315,25 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
1276
1315
|
func.add_parameter "Gecode::PropKind", "pk"
|
1277
1316
|
end
|
1278
1317
|
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1318
|
+
ns.add_function "extensional", "void" do |func|
|
1319
|
+
func.add_parameter "Gecode::MSpace*", "home"
|
1320
|
+
func.add_parameter "Gecode::MIntVarArray *", "x" do |param|
|
1321
|
+
param.custom_conversion = "*ruby2Gecode_MIntVarArrayPtr(argv[1], 2)->ptr()"
|
1322
|
+
end
|
1323
|
+
func.add_parameter "Gecode::REG", "dfa"
|
1324
|
+
func.add_parameter "Gecode::IntConLevel", "icl"
|
1325
|
+
func.add_parameter "Gecode::PropKind", "pk"
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
ns.add_function "extensional", "void" do |func|
|
1329
|
+
func.add_parameter "Gecode::MSpace*", "home"
|
1330
|
+
func.add_parameter "Gecode::MBoolVarArray *", "x" do |param|
|
1331
|
+
param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
|
1332
|
+
end
|
1333
|
+
func.add_parameter "Gecode::REG", "dfa"
|
1334
|
+
func.add_parameter "Gecode::IntConLevel", "icl"
|
1335
|
+
func.add_parameter "Gecode::PropKind", "pk"
|
1336
|
+
end
|
1287
1337
|
|
1288
1338
|
ns.add_function "bab", "Gecode::MSpace*" do |func|
|
1289
1339
|
func.add_parameter "Gecode::MSpace*", "home"
|
@@ -1765,6 +1815,14 @@ Rust::Bindings::create_bindings Rust::Bindings::LangCxx, "gecode" do |b|
|
|
1765
1815
|
param.custom_conversion = "*ruby2Gecode_MSetVarArrayPtr(argv[2], 3)->ptr()"
|
1766
1816
|
end
|
1767
1817
|
end
|
1818
|
+
|
1819
|
+
ns.add_function "channel" do |func|
|
1820
|
+
func.add_parameter "Gecode::MSpace*", "home"
|
1821
|
+
func.add_parameter "Gecode::MBoolVarArray", "x" do |param|
|
1822
|
+
param.custom_conversion = "*ruby2Gecode_MBoolVarArrayPtr(argv[1], 2)->ptr()"
|
1823
|
+
end
|
1824
|
+
func.add_parameter "Gecode::SetVar", "y"
|
1825
|
+
end
|
1768
1826
|
|
1769
1827
|
ns.add_function "weights" do |func|
|
1770
1828
|
func.add_parameter "Gecode::MSpace*", "home"
|