Skip to content

Improve Expression Compilation #953

@arnaud-m

Description

@arnaud-m

Hi choco team,

I hope that you are doing well.

Is your feature request related to a problem? Please describe.

Choco provides a convenient expression builder that is then compiled into a set of constraints.
It is a complicated task, but some improvements seems possible.
For instance, reification is not needed when there is a simple conjunction of constraint.

Let us consider the following model.

Model model = new Model();
IntVar x = model.intVar("x", 1, 9);
IntVar y = model.intVar("y", 0, 9);
IntVar z = model.intVar("z", 0, 9);

x.le(y).and(z.ge(x)).post();
// x.le(y).and(z.ge(x)).decompose().post(); // do not change anything here
System.out.println(model);

The output is the following.

satisfaction  : undefined
== variables ==
x = {1..9}
y = {0..9}
z = {0..9}
LE_exp_1 = [0,1]
GE_exp_2 = [0,1]
cste -- 2 = 2
== constraints ==
BASIC_REIF ([(x < y + 1) <=> LE_exp_1])
BASIC_REIF ([(x < z + 1) <=> GE_exp_2])
ARITHM ([LE_exp_1 = [0,1] + GE_exp_2 = [0,1] = 2])

Describe the solution you'd like
I want the conjunction to be posted as independent constraints.

x.le(y).post()
z.ge(x)).post();

Describe alternatives you've considered

The immediate answer is to post multiple constraints, but, in my case, the expression is also built automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions