Skip to content

Commit

Permalink
Merge branch 'release/4.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
radsz committed Jan 4, 2016
2 parents c487f7d + 620e485 commit 1612d3b
Show file tree
Hide file tree
Showing 474 changed files with 5,780 additions and 3,142 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG
@@ -1,3 +1,34 @@
Version 4.4
===========

1. New selection for search variables in minizinc. Only output
variables are selected by default.

2. Adding additional pass to the flatzinc compiler. bool2int does not
generate the equality constraints on both variables. Only the first
variable is used in the model and the second one as the alias for
the first one. Decreases the number of generated constraints.

3. Sum and SumWeight are deprecated and SumInt, SumBool or LinearInt
should be used instead.

4. New circuit and subcircuit constraint definitions in minizinc that
accept arbitrary indexes (not always starting from 1).

5. New constraint SumBool.

6. Correcting a bug in OrBool constraint.

7. Xor of Linear constraint corrected. Linear is deprecated and
LinearInt should be used instead.

8. Correcting a bug in GCC.

9. Improvements and corrections in Linear, LinearInt, SumInt,
LinearIntDom and LinearFloat.

10. Bug fixes and improvements.

Version 4.3
===========
1. Implementation of constraints ArgMin and ArgMax as well connection to
Expand Down
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -43,5 +43,4 @@ us to perform extensive testing with the help of other solvers as we can compare
JaCoP is an ongoing activity. We are working on it in our free time. The most recent addition is Scala based DSL so
it is easier to create your own constraint programs even in more intuitive manner.

Currently, our focus is on providing a simple Java API for JaCoP as well as integrate it well with industrial quality
technologies like OSGi and Spring.
JaCoP is also available from maven repository. For details, please check INSTALL file.
2 changes: 1 addition & 1 deletion change.bash
@@ -1,7 +1,7 @@
#!/bin/bash
echo changing file $1;
mv $1 $1.bak;
sed -e "s/@version 4.2/@version 4.3/g" < $1.bak > $1;
sed -e "s/@version 4.3/@version 4.4/g" < $1.bak > $1;
rm $1.bak;
# command to be executed
# find src/ -name "*.java" -exec change.bash {} \;
42 changes: 39 additions & 3 deletions pom.xml
Expand Up @@ -5,7 +5,7 @@

<groupId>org.jacop</groupId>
<artifactId>jacop</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
<packaging>jar</packaging>

<name>JaCoP</name>
Expand Down Expand Up @@ -143,10 +143,32 @@ setup to run configuration. -->
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>

</plugins>
</pluginManagement>

<plugins>

<!-- Java plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgument>-Xlint:all</compilerArgument>
<!-- <showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation> -->
</configuration>
</plugin>

<!-- Scala plugin -->
<plugin>
<groupId>org.scala-tools</groupId>
Expand Down Expand Up @@ -247,15 +269,29 @@ setup to run configuration. -->
</archive>
</configuration>
</plugin>

<!-- Plugin for generating javadoc jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<!--If using less than 1.8 Java to build then this parameter has to be commented out.-->
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<!---
<additionalparam>-Xdoclint:none</additionalparam>
-->
<!--
<sourceFileExcludes>
<exclude>**/target/generated-sources/org/jacop/fz/Node.java</exclude>
<exclude>**/ParseException.java</exclude>
<exclude>**/Parser.java</exclude>
<exclude>**/ParserTokenManager.java</exclude>
<exclude>**/Token.java</exclude>
<exclude>**/TokenMgrError.java</exclude>
<exclude>**/SimpleCharStream.java</exclude>
<exclude>**/ASTSolveItem.java</exclude>
</sourceFileExcludes>
-->
</configuration>
<executions>
<execution>
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/org/jacop/constraints/AbsXeqY.java
Expand Up @@ -48,7 +48,7 @@
* Domain and bounds consistency can be used; third parameter of constructor controls this.
*
* @author Radoslaw Szymanek and Krzysztof Kuchcinski
* @version 4.3
* @version 4.4
*/

public class AbsXeqY extends PrimitiveConstraint {
Expand Down Expand Up @@ -273,9 +273,15 @@ else if (x.max() < 0) {
y.domain.in(store.level, y, -x.max(), -x.min());
}
else { // x.min() < 0 && x.max() >= 0
// int xBound = Math.max(y.min(), y.max());
int xBound = y.max(); // y is always >= 0
x.domain.in(store.level, x, -xBound, xBound);
IntervalDomain xBound;
if (y.min() == 0)
xBound = new IntervalDomain(-y.max(), y.max());
else {
xBound = new IntervalDomain(-y.max(), -y.min());
xBound.unionAdapt(new Interval(y.min(), y.max()));
}

x.domain.in(store.level, x, xBound);

store.propagationHasOccurred = false;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jacop/constraints/Alldiff.java
Expand Up @@ -55,7 +55,7 @@
* It extends basic functionality of Alldifferent constraint.
*
* @author Krzysztof Kuchcinski and Radoslaw Szymanek
* @version 4.3
* @version 4.4
*/

public class Alldiff extends Alldifferent {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jacop/constraints/Alldifferent.java
Expand Up @@ -50,7 +50,7 @@
* partial consistency technique.
*
* @author Krzysztof Kuchcinski and Radoslaw Szymanek
* @version 4.3
* @version 4.4
*/

public class Alldifferent extends Constraint {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jacop/constraints/Alldistinct.java
Expand Up @@ -61,7 +61,7 @@
* 0..1000000 will make it use few MB already and kill the efficiency.
*
* @author Radoslaw Szymanek and Krzysztof Kuchcinski
* @version 4.3
* @version 4.4
*/

public class Alldistinct extends Constraint {
Expand Down
41 changes: 29 additions & 12 deletions src/main/java/org/jacop/constraints/Among.java
Expand Up @@ -53,7 +53,7 @@
* backtracking) to improve the constraint further.
*
* @author Polina Makeeva and Radoslaw Szymanek
* @version 4.3
* @version 4.4
*/

public class Among extends Constraint {
Expand Down Expand Up @@ -221,16 +221,25 @@ public void consistency(Store store) {
System.out.println("lbS = " + currentLB);
System.out.println("ubS = " + currentUB);
System.out.println(" domain of N " + n.domain + " is in [ "
+ Math.max(n.min(), currentLB) + ", "
+ Math.min(n.max(), currentUB) + " ]");
+ currentLB + ", "
+ currentUB + " ]");
}
// ----------------------------------------------------------

if (Math.max(n.min(), currentLB) > Math.min(n.max(), currentUB))
throw Store.failException;
// Changed KK, 2015-10-17;
// Not needed, in method will fail in such case
// if (Math.max(n.min(), currentLB) > Math.min(n.max(), currentUB))
// throw Store.failException;
if (currentLB > currentUB)
throw Store.failException;

n.domain.in(store.level, n, Math.max(n.min(), currentLB), Math.min(n.max(),
currentUB));
// n.domain.in(store.level, n, Math.max(n.min(), currentLB), Math.min(n.max(),
// currentUB));

// Changed KK, 2015-10-17;
// Math.max is not needed since method in is doing
// intersection between new domain and original domain
n.domain.in(store.level, n, currentLB, currentUB);

// Just in case LB or UB have changed.
upperBorder.update(currentUB);
Expand Down Expand Up @@ -310,10 +319,16 @@ public void impose(Store store) {
int pos = 0;
position = new HashMap<IntVar, Integer>();
for (IntVar var : list) {
position.put(var, pos);
Integer varPosition = position.put(var, pos);
if (varPosition == null) {
var.putConstraint(this);
queueVariable(level, var);
pos++;
}
else {
System.err.println("ERROR: Constraint " + toString() + " must have different variables on the list");
System.exit(0);
}
}
n.putConstraint(this);

Expand Down Expand Up @@ -352,13 +367,15 @@ public String toString() {

StringBuffer result = new StringBuffer( id () );

result.append(" Among(");
result.append(": Among([");

for(IntVar var : this.list)
result.append("variable").append(var.id).append(" : ").append(var.domain).append(" ");
// result.append("variable").append(var.id).append(" : ").append(var.domain).append(" ");
result.append(var).append(" ");

result.append(")\n Kset : ").append(this.kSet).append("\n");
result.append("variable ").append(n.id).append(" : ").append(n.domain).append(")\n");
result.append("], ").append(this.kSet).append(", ");
// result.append("variable ").append(n.id).append(" : ").append(n.domain).append(")\n");
result.append(n).append(")\n");

return result.toString();
}
Expand Down
32 changes: 24 additions & 8 deletions src/main/java/org/jacop/constraints/AmongVar.java
Expand Up @@ -63,7 +63,7 @@
* function. The strength of propagation algorithm is incomporable to BC.
*
* @author Polina Makeeva and Radoslaw Szymanek
* @version 4.3
* @version 4.4
*/

public class AmongVar extends Constraint {
Expand Down Expand Up @@ -284,7 +284,7 @@ public void consistencyForX(Store store) {
* 1) If there are not enough of y to cover future domain then fail
* 2)
*
* @param store
* @param store a constraint store in which context all prunings are executed.
*/
public void consistencyWhen_LB0_EQ_UB0(Store store) {

Expand Down Expand Up @@ -1120,18 +1120,34 @@ public void impose(Store store) {

for (i = 0; i < listOfX.length; i++) {
x = listOfX[i];
x.putConstraint(this);
xIndex.put(x, i);
if (x.singleton()) gx++;

Integer varPosition = xIndex.put(x, i);
if (varPosition == null) {
x.putConstraint(this);
// xIndex.put(x, i);
if (x.singleton()) gx++;
}
else {
System.err.println("ERROR: Constraint " + toString() + " must have different variables on the list");
System.exit(0);
}
}

yIndex = new HashMap<IntVar, Integer>();

for (i = 0; i < listOfY.length; i++) {
y = listOfY[i];
y.putConstraint(this);
variableQueueY.add(i);
yIndex.put(y, i);

Integer varPosition = yIndex.put(y, i);
if (varPosition == null) {
y.putConstraint(this);
variableQueueY.add(i);
// yIndex.put(y, i);
}
else {
System.err.println("ERROR: Constraint " + toString() + " must have different variables on the list");
System.exit(0);
}
}

n.putConstraint(this);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jacop/constraints/And.java
Expand Up @@ -44,7 +44,7 @@
*
*
* @author Krzysztof Kuchcinski and Radoslaw Szymanek
* @version 4.3
* @version 4.4
*/

public class And extends PrimitiveConstraint {
Expand Down

0 comments on commit 1612d3b

Please sign in to comment.