Skip to content

Commit

Permalink
Merge tag 'choco-geost-3.3.2' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cprudhom committed Dec 18, 2015
2 parents b35dd6f + 990b87d commit 918053b
Show file tree
Hide file tree
Showing 19 changed files with 1,062 additions and 507 deletions.
97 changes: 32 additions & 65 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.chocosolver</groupId>
<groupId>org.choco-solver</groupId>
<artifactId>choco-geost</artifactId>
<version>3.3.0</version>
<version>3.3.2</version>
<packaging>jar</packaging>

<name>Geost constraint, developed for Choco3</name>
Expand Down Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>org.choco-solver</groupId>
<artifactId>choco-solver</artifactId>
<version>3.3.0</version>
<version>3.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -86,42 +86,56 @@
</activation>
<build>
<plugins>
<!-- We need the GPG Plugin to self-sign the jar files. A valid signature
for the jar files is a requirement for deploying to Maven Central. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<doctitle>${project.groupId}-${project.artifactId} ${project.version} API</doctitle>
<windowtitle>${project.groupId}-${project.artifactId} ${project.version} API</windowtitle>
<!--<quiet />-->
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<doctitle>${project.groupId}-${project.artifactId} ${project.version} API</doctitle>
<windowtitle>${project.groupId}-${project.artifactId} ${project.version} API</windowtitle>
<!--<quiet />-->
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- We need the GPG Plugin to self-sign the jar files. A valid signature
for the jar files is a requirement for deploying to Maven Central. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -158,53 +172,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<doctitle>${project.groupId}-${project.artifactId} ${project.version} API</doctitle>
<windowtitle>${project.groupId}-${project.artifactId} ${project.version} API</windowtitle>
<!--<quiet />-->
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion src/main/bash/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ git ls-remote --exit-code --tags origin ${TAG} && quit "tag ${TAG} already exist

#Working version ?
# Well, we assume the tests have been run before, and everything is OK for the release
mvn clean test ||exit 1
#mvn clean test ||exit 1

git fetch origin master:refs/remotes/origin/master||quit "Unable to fetch master"
#Integrate with master and tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public PropGeost(IntVar[] vars, int k, List<GeostObject> objects, List<ShiftedBo
}

@Override
protected int getPropagationConditions(int vIdx) {
public int getPropagationConditions(int vIdx) {
return IntEventType.ALL_EVENTS;
}

Expand All @@ -172,7 +172,7 @@ public void propagate(int evtmask) throws ContradictionException {
// for (int i=0; i<l; i++)
// LOGGER.info("Geost_Constraint:propagate():vars["+i+"]:"+vars[i]+","+vars[i].getInf()+","+vars[i].getSup());
// LOGGER.info("----propagate"); ^
if (stp.opt.debug) LOGGER.info("GeostConstraint:propagate()");
if (stp.opt.debug) System.out.println("GeostConstraint:propagate()");
filter();
}

Expand Down Expand Up @@ -209,7 +209,7 @@ public void filter() throws ContradictionException {
}

private void filterWithGreedyMode() throws ContradictionException {
if (stp.opt.debug) LOGGER.info("Geost_Constraint:filterWithGreedyMode()");
if (stp.opt.debug) System.out.println("Geost_Constraint:filterWithGreedyMode()");
s.getEnvironment().worldPush(); //Starts a new branch in the search tree
boolean result = false;

Expand Down Expand Up @@ -242,14 +242,14 @@ private void filterWithGreedyMode() throws ContradictionException {
tmpTime = (System.nanoTime() / 1000000);
//s.getSearchStrategy().restoreBestSolution();

sol.restore();
sol.restore(solver);
stp.opt.handleSolution3 += ((System.nanoTime() / 1000000) - tmpTime);
}
}


private void filterWithoutGreedyMode() throws ContradictionException {
if (stp.opt.debug) LOGGER.info("Geost_Constraint:filterWithoutGreedyMode()");
if (stp.opt.debug) System.out.println("Geost_Constraint:filterWithoutGreedyMode()");
if (!geometricKernel.filterCtrs(cst.getDIM(), oIDs, stp.getConstraints()))
this.contradiction(null, "geost");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
package org.chocosolver.solver.constraints.nary.geost;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.chocosolver.solver.constraints.nary.geost.dataStructures.HeapAscending;
import org.chocosolver.solver.constraints.nary.geost.dataStructures.HeapDescending;
import org.chocosolver.solver.constraints.nary.geost.externalConstraints.ExternalConstraint;
Expand All @@ -51,9 +49,7 @@
*/

public final class Setup {

private static final Logger LOGGER = LoggerFactory.getLogger("geost");


private final Constants cst;

public GeostOptions opt = new GeostOptions();
Expand Down Expand Up @@ -219,7 +215,7 @@ void addShiftedBox(ShiftedBox sb) {

void addObject(GeostObject o) {
if (objects.containsKey(o.getObjectId())) {
LOGGER.info("Trying to add an already existing object. In addObject in Setup");
System.out.println("Trying to add an already existing object. In addObject in Setup");
} else {
objects.put(o.getObjectId(), o);
}
Expand Down Expand Up @@ -250,28 +246,28 @@ public void print() {
while (itr.hasNext()) {
int id = itr.next();
GeostObject o = objects.get(id);
LOGGER.info("object id: " + id);
LOGGER.info(" shape id: " + o.getShapeId().getLB());
System.out.println("object id: " + id);
System.out.println(" shape id: " + o.getShapeId().getLB());
for (int i = 0; i < cst.getDIM(); i++) {
LOGGER.info(" Coords x" + i + " : " + o.getCoord(i).getLB() + " " + o.getCoord(i).getUB());
System.out.println(" Coords x" + i + " : " + o.getCoord(i).getLB() + " " + o.getCoord(i).getUB());
}
}

itr = shapes.keySet().iterator();
while (itr.hasNext()) {
int sid = itr.next();
List<ShiftedBox> sb = shapes.get(sid);
LOGGER.info("shape id: " + sid);
System.out.println("shape id: " + sid);
for (int i = 0; i < sb.size(); i++) {
StringBuilder offset = new StringBuilder();
StringBuilder size = new StringBuilder();
for (int j = 0; j < cst.getDIM(); j++) {
offset.append(sb.get(i).getOffset(j)).append(" ");
size.append(sb.get(i).getSize(j)).append(" ");
}
LOGGER.info(" sb" + i + ": ");
LOGGER.info(" Offset: " + offset.toString());
LOGGER.info(" Size: " + size.toString());
System.out.println(" sb" + i + ": ");
System.out.println(" Offset: " + offset.toString());
System.out.println(" Size: " + size.toString());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@

package org.chocosolver.solver.constraints.nary.geost.geometricPrim;

import org.chocosolver.solver.constraints.nary.geost.internalConstraints.Outbox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.chocosolver.solver.constraints.nary.geost.externalConstraints.ExternalConstraint;
import org.chocosolver.solver.constraints.nary.geost.internalConstraints.InternalConstraint;
import org.chocosolver.solver.constraints.nary.geost.internalConstraints.Outbox;
import org.chocosolver.solver.variables.IntVar;

import java.io.Externalizable;
Expand All @@ -47,8 +45,6 @@
*/
public final class GeostObject implements Externalizable {

private static final Logger LOGGER = LoggerFactory.getLogger("geost");

private int oid; //Object id
private IntVar sid; // the shape id that corresponds to this object
private IntVar[] coords;
Expand Down Expand Up @@ -295,9 +291,9 @@ public boolean sameDomain(GeostObject o) {
public void print() {
for (int i = 0; i < this.coords.length; i++) {
if (!this.getCoord(i).isInstantiated())
LOGGER.info(this.getCoord(i).getLB() + " " + this.getCoord(i).getUB() + ",");
System.out.println(this.getCoord(i).getLB() + " " + this.getCoord(i).getUB() + ",");
else
LOGGER.info(this.getCoord(i).getLB() + " ");
System.out.println(this.getCoord(i).getLB() + " ");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

package org.chocosolver.solver.constraints.nary.geost.geometricPrim;

import org.slf4j.LoggerFactory;

import java.io.Serializable;

import static java.lang.System.arraycopy;
Expand All @@ -38,15 +36,14 @@
*/
public final class Point implements Serializable {

private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger("geost");
//this class serves as Point object. The dimension of the point is d Dimensional.

private int coords[];
private int dim;

public void print() {
for (int i = 0; i < this.dim; i++) {
LOGGER.info(this.coords[i] + " ");
System.out.println(this.coords[i] + " ");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@

package org.chocosolver.solver.constraints.nary.geost.internalConstraints;

import org.chocosolver.solver.constraints.nary.geost.geometricPrim.Region;
import org.slf4j.LoggerFactory;
import org.chocosolver.solver.constraints.nary.geost.Constants;
import org.chocosolver.solver.constraints.nary.geost.Setup;
import org.chocosolver.solver.constraints.nary.geost.geometricPrim.Point;
import org.chocosolver.solver.constraints.nary.geost.geometricPrim.Region;
import org.chocosolver.solver.exception.ContradictionException;
import org.chocosolver.solver.exception.SolverException;
import org.chocosolver.solver.variables.IntVar;
Expand All @@ -45,8 +44,6 @@
*/
public final class DistGeqIC extends ForbiddenRegion {

private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger("geost");

public int q, D, s1, s2, o1, o2;
IntVar DVar = null; //DVar is the distance variable; valid only if (D_init_lower_bnd!=null && D_init_upper_bnd!=null)

Expand Down Expand Up @@ -278,7 +275,7 @@ public boolean updateDistance(int k) throws ContradictionException {
if (oldSup <= newSup) return false;
DVar.updateUpperBound(newSup, this.stp.g_constraint);
if (stp.opt.debug) {
LOGGER.info("DistGeqIC:" + this + " updateDistance:[" + DVar.getLB() + "," + DVar.getUB() + "]");
System.out.println("DistGeqIC:" + this + " updateDistance:[" + DVar.getLB() + "," + DVar.getUB() + "]");
}
if ((DVar.getLB() > DVar.getUB()) || (DVar.getUB() < DVar.getLB())) {
stp.g_constraint.contradiction(null, "geost");
Expand Down
Loading

0 comments on commit 918053b

Please sign in to comment.