/bin/golomb --cp_model_stats --size=6 --log_prefix=false
Model has:
- 11 constraints.
* 1 AllDifferent
* 10 CastExpressionIntoVariable
- 16 integer variables.
- 10 integer expressions.
* 10 Difference
- 10 expressions casted into variables.
- 0 interval variables.
- 0 sequence variables.
- 2 model extensions.
* 1 VariableGroup
* 1 Objective
N = 6, optimal length = 17 (fails:8)
and
./bin/golomb --cp_print_model --size=6 --log_prefix=false
Model golomb {
CastExpressionIntoVariable
expression: Difference
left: X02(1..217)
right: X01(1..217)
target_variable: Difference
left: X02(1..217)
right: X01(1..217)
CastExpressionIntoVariable
expression: Difference
left: X03(1..217)
right: X01(1..217)
target_variable: Difference
left: X03(1..217)
right: X01(1..217)
CastExpressionIntoVariable
expression: Difference
left: X04(1..217)
right: X01(1..217)
target_variable: Difference
left: X04(1..217)
right: X01(1..217)
CastExpressionIntoVariable
expression: Difference
left: X05(1..217)
right: X01(1..217)
target_variable: Difference
left: X05(1..217)
right: X01(1..217)
CastExpressionIntoVariable
expression: Difference
left: X03(1..217)
right: X02(1..217)
target_variable: Difference
left: X03(1..217)
right: X02(1..217)
CastExpressionIntoVariable
expression: Difference
left: X04(1..217)
right: X02(1..217)
target_variable: Difference
left: X04(1..217)
right: X02(1..217)
CastExpressionIntoVariable
expression: Difference
left: X05(1..217)
right: X02(1..217)
target_variable: Difference
left: X05(1..217)
right: X02(1..217)
CastExpressionIntoVariable
expression: Difference
left: X04(1..217)
right: X03(1..217)
target_variable: Difference
left: X04(1..217)
right: X03(1..217)
CastExpressionIntoVariable
expression: Difference
left: X05(1..217)
right: X03(1..217)
target_variable: Difference
left: X05(1..217)
right: X03(1..217)
CastExpressionIntoVariable
expression: Difference
left: X05(1..217)
right: X04(1..217)
target_variable: Difference
left: X05(1..217)
right: X04(1..217)
AllDifferent
variables: [
X01(1..217)
X02(1..217)
X03(1..217)
X04(1..217)
X05(1..217)
Difference
left: X02(1..217)
right: X01(1..217)
Difference
left: X03(1..217)
right: X01(1..217)
Difference
left: X04(1..217)
right: X01(1..217)
Difference
left: X05(1..217)
right: X01(1..217)
Difference
left: X03(1..217)
right: X02(1..217)
Difference
left: X04(1..217)
right: X02(1..217)
Difference
left: X05(1..217)
right: X02(1..217)
Difference
left: X04(1..217)
right: X03(1..217)
Difference
left: X05(1..217)
right: X03(1..217)
Difference
left: X05(1..217)
right: X04(1..217)
]
range: 1
Objective
maximize: 0
step: 1
expression: X05(1..217)
VariableGroup
variables: [
IntConst(0)
X01(1..217)
X02(1..217)
X03(1..217)
X04(1..217)
X05(1..217)
]
}
N = 6, optimal length = 17 (fails:8)
You check the code behind these flags (src/constraint_solver/constraint_solver.cc).
You create the relevant visitor, and then run solver.Accept(visitor) after the model is created.
You can also see
./bin/golomb --cp_print_added_constraints --size=6 --log_prefix=false
cast((X02(1..217) - X01(1..217)), CastVar<0>(-216..216))
cast((X03(1..217) - X01(1..217)), CastVar<1>(-216..216))
cast((X04(1..217) - X01(1..217)), CastVar<2>(-216..216))
cast((X05(1..217) - X01(1..217)), CastVar<3>(-216..216))
cast((X03(1..217) - X02(1..217)), CastVar<4>(-216..216))
cast((X04(1..217) - X02(1..217)), CastVar<5>(-216..216))
cast((X05(1..217) - X02(1..217)), CastVar<6>(-216..216))
cast((X04(1..217) - X03(1..217)), CastVar<7>(-216..216))
cast((X05(1..217) - X03(1..217)), CastVar<8>(-216..216))
cast((X05(1..217) - X04(1..217)), CastVar<9>(-216..216))
BoundsAllDifferent(X01(1..217), X02(1..217), X03(1..217), X04(1..217), X05(1..217), CastVar<0>(1..216), CastVar<1>(1..216), CastVar<2>(1..216), CastVar<3>(1..216), CastVar<4>(1..216), CastVar<5>(1..216), CastVar<6>(1..216), CastVar<7>(1..216), CastVar<8>(1..216), CastVar<9>(1..216))
N = 6, optimal length = 17 (fails:8)
which is often more useful with the --cp_name_cast_variables
./bin/golomb --cp_print_added_constraints --size=6 --log_prefix=false --cp_name_cast_variables
cast((X02(1..217) - X01(1..217)), Var<(X02(1..217) - X01(1..217))>(-216..216))
cast((X03(1..217) - X01(1..217)), Var<(X03(1..217) - X01(1..217))>(-216..216))
cast((X04(1..217) - X01(1..217)), Var<(X04(1..217) - X01(1..217))>(-216..216))
cast((X05(1..217) - X01(1..217)), Var<(X05(1..217) - X01(1..217))>(-216..216))
cast((X03(1..217) - X02(1..217)), Var<(X03(1..217) - X02(1..217))>(-216..216))
cast((X04(1..217) - X02(1..217)), Var<(X04(1..217) - X02(1..217))>(-216..216))
cast((X05(1..217) - X02(1..217)), Var<(X05(1..217) - X02(1..217))>(-216..216))
cast((X04(1..217) - X03(1..217)), Var<(X04(1..217) - X03(1..217))>(-216..216))
cast((X05(1..217) - X03(1..217)), Var<(X05(1..217) - X03(1..217))>(-216..216))
cast((X05(1..217) - X04(1..217)), Var<(X05(1..217) - X04(1..217))>(-216..216))
BoundsAllDifferent(X01(1..217), X02(1..217), X03(1..217), X04(1..217), X05(1..217), Var<(X02(1..217) - X01(1..217))>(1..216), Var<(X03(1..217) - X01(1..217))>(1..216), Var<(X04(1..217) - X01(1..217))>(1..216), Var<(X05(1..217) - X01(1..217))>(1..216), Var<(X03(1..217) - X02(1..217))>(1..216), Var<(X04(1..217) - X02(1..217))>(1..216), Var<(X05(1..217) - X02(1..217))>(1..216), Var<(X04(1..217) - X03(1..217))>(1..216), Var<(X05(1..217) - X03(1..217))>(1..216), Var<(X05(1..217) - X04(1..217))>(1..216))
N = 6, optimal length = 17 (fails:8)
All these flags are also available as parameters to the solver (see src/constraint_solver/solver_parameters.proto
I hope this helps.
--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.