Skip to content

Commit 832a23d

Browse files
committed
Fix readme examples
1 parent bf53a63 commit 832a23d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ This library provides efficient algorithms and data structures for solving const
2525

2626
**Programmatic version of constraints**
2727
```
28-
m.post(x.lt(y)); // x < y
29-
m.post(y.le(z)); // y <= z
30-
m.post(z.gt(5)); // z > 5
31-
m.post(x.add(y).le(z)); // x + y <= z
32-
m.post(y.sub(x).ge(0)); // y - x >= 0
33-
m.post(x.mul(y).eq(12)); // x * y == 12
34-
m.post(z.div(y).ne(0)); // z / y != 0
28+
m.new(x.lt(y)); // x < y
29+
m.new(y.le(z)); // y <= z
30+
m.new(z.gt(5)); // z > 5
31+
m.new(x.add(y).le(z)); // x + y <= z
32+
m.new(y.sub(x).ge(0)); // y - x >= 0
33+
m.new(x.mul(y).eq(12)); // x * y == 12
34+
m.new(z.div(y).ne(0)); // z / y != 0
3535
```
3636

3737
**Mathematical syntax with post! macro**
@@ -151,16 +151,16 @@ fn main() {
151151
let y = m.int(5, 15);
152152

153153
// Add constraints using programmatic API
154-
m.post(x.lt(y)); // x < y
155-
m.post(x.add(y).eq(12)); // x + y == 12
154+
m.new(x.lt(y)); // x < y
155+
m.new(x.add(y).eq(12)); // x + y == 12
156156

157157
// Global constraints
158158
let vars = vec![m.int(1, 5), m.int(1, 5), m.int(1, 5)];
159-
m.alldiff(&vars); // All different
159+
m.new(alldiff(vars.clone())); // All different
160160

161161
// Mathematical functions
162162
let abs_result = m.abs(x);
163-
m.post(abs_result.ge(1)); // abs(x) >= 1
163+
m.new(abs_result.ge(1)); // abs(x) >= 1
164164

165165
// Solve the problem
166166
if let Ok(solution) = m.solve() {

0 commit comments

Comments
 (0)