This PR aims at merging the 3 views on IntVar, namely IntOffsetView, IntScaleView and IntMinusView, into a single one, namely IntAffineView.
Benefits are:
one class instead of 3;
merging is easier: if y = a.x + b then z = dy + c is declared as z = (d.a).x + d.b + c. This limits the depth of expressions and moves events closer to the true variable;
management of a in Z (instead of N in the current version of scale, which requires to declare a minus view first when a < 0);
only one API for view: model.intView(x, a, b).
Loss are:
only one API for view: model.intView(x, a, b), for instance, creating an offset view requires to declare two parameters (a=-1 and b=0) instead of 0 in the previous version.
In addition, it seems that the recognition of views were incorrect, on some problems, it reduces the number of views (mostly when Task are in the game).
For instance, MSPSP-easy_01.xml.lzma (xcsp) previously created 370 including 149 views where now 241 variables are created including 20 views.
Inevitably, it pertubs black-box strategies and some deterioration can be observed.
Note: most of the modifications in this PR are related to code adaptation.
The main classes to double check are IntAffineView (+ tests) and IViewFactory.
Note: I also define default behavior in IntVar for some advanced methods (like removeInterval, for example). This is related to this PR since the affine view only defines the 4 main methods.
Related to #564
This PR aims at merging the 3 views on
IntVar
, namelyIntOffsetView
,IntScaleView
andIntMinusView
, into a single one, namelyIntAffineView
. Benefits are:y = a.x + b
thenz = dy + c
is declared asz = (d.a).x + d.b + c
. This limits the depth of expressions and moves events closer to the true variable;model.intView(x, a, b)
. Loss are:model.intView(x, a, b)
, for instance, creating an offset view requires to declare two parameters (a=-1
andb=0
) instead of 0 in the previous version.In addition, it seems that the recognition of views were incorrect, on some problems, it reduces the number of views (mostly when
Task
are in the game). For instance,MSPSP-easy_01.xml.lzma
(xcsp) previously created 370 including 149 views where now 241 variables are created including 20 views. Inevitably, it pertubs black-box strategies and some deterioration can be observed.Note: most of the modifications in this PR are related to code adaptation. The main classes to double check are
IntAffineView
(+ tests) andIViewFactory
.Note: I also define default behavior in
IntVar
for some advanced methods (like removeInterval, for example). This is related to this PR since the affine view only defines the 4 main methods.