I'm new to the LPSolve and the toolkit. I'm trying to use the LPSolve IDE to stitch 4 image 1024x1024 tiles. To simplify the task, I use only the x coordinates of the tiles.
-------------------------------
| Tile1 |Tile2 |
| | |
| | |
| | |
--------------------------------
| Tile3 | Tile4 |
| | |
| | |
| | |
--------------------------------
If I define the relationships in the following way
min: +d1 +d3 +d4 +d6;
-x1 +x2 -1024 +d1 <=0.1;
-x1 +x2 -1024 +d1 >=-0.1;
-x1 +x3 +1 +d2 <=0.1;
-x1 +x3 +1 +d2 >=-0.1;
-x2 +x4 +d3 <=0.1;
-x2 +x4 +d3 >=-0.1;
-x3 +x4 -1024 +d4 <=0.1;
-x3 +x4 -1024 +d4 >=-0.1;
x1=1024;
x2=2048;
x3=1023;
x4=2047;
The LPSolve produces a correct result
d1=0
d2=0
d3=0.900000000000091
d4=0
x1=1024
x2=2048
x3=1023
x4=2047
If I change the model to the following, i.e. move the Tile4 by one pixel
min: +d1 +d2 +d3 +d4;
-x1 +x2 -1024 +d1 <=0.1;
-x1 +x2 -1024 +d1 >=-0.1;
-x1 +x3 +1 +d2 <=0.1;
-x1 +x3 +1 +d2 >=-0.1;
-x2 +x4 +d3 <=0.1;
-x2 +x4 +d3 >=-0.1;
-x3 +x4 -1024 +1 +d4 <=0.1;
-x3 +x4 -1024 +1 +d4 >=-0.1;
x1=1024;
x2=2048;
x3=1023;
x4=2047;
the LPSolve responds with "model is INFEASIBLE", while, I think the respond should be
d1=1
d2=0
d3=0.900000000000091
d4=1
What am I doing wrong?