Skip to content

Commit

Permalink
Merge pull request #12 from gsdlab/develop
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
mantkiew committed Jul 29, 2015
2 parents 1266cb4 + 8d652e0 commit 4a765fb
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ clean:
install:
mkdir -p $(to)
cp -f README.md $(to)/ClaferChocoIG-README.md
cp -f target/claferchocoig-0.3.10.1-jar-with-dependencies.jar $(to)/claferchocoig.jar
cp -f target/claferchocoig-0.4.0-jar-with-dependencies.jar $(to)/claferchocoig.jar

snapshotInstall:
mkdir -p $(to)
cp -f README.md $(to)/ClaferChocoIG-README.md
mv -f target/claferchocoig-0.3.10.1-SNAPSHOT-jar-with-dependencies.jar $(to)/claferchocoig.jar
mv -f target/claferchocoig-0.4.0-SNAPSHOT-jar-with-dependencies.jar $(to)/claferchocoig.jar
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ClaferChocoIG
=============

v0.3.10.1
v0.4.0

A backend for [ClaferIDE](https://github.com/gsdlab/ClaferIDE), [ClaferMooVisualizer](https://github.com/gsdlab/ClaferMooVisalizer), and [ClaferConfigurator](https://github.com/gsdlab/ClaferConfigurator), as well as a stand-alone command-line tool.
It uses [ChocoSolver](https://github.com/gsdlab/chocosolver) to generate arbitrary or optimal instances from a Javascript-based representation of Clafer models generated by the Clafer compiler using the option `--mode=choco`.
Expand Down Expand Up @@ -245,8 +245,8 @@ Development versions from branches `develop` should work well together but this
* `mvn install`

Two binaries will appear in the `target` subfolder:
`claferchocoig-0.3.10.1-jar-with-dependencies.jar` that is standalone and contains all the required dependencies,
and `claferchocoig-0.3.10.1.jar` that is not.
`claferchocoig-0.4.0-jar-with-dependencies.jar` that is standalone and contains all the required dependencies,
and `claferchocoig-0.4.0.jar` that is not.

### Installation

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>claferchoco</groupId>
<artifactId>claferchocoig</artifactId>
<version>0.3.10.1</version>
<version>0.4.0</version>
<name>ChocoInstanceGenerator</name>
<dependencies>
<dependency>
<groupId>org.clafer</groupId>
<artifactId>chocosolver</artifactId>
<version>0.3.10.1</version>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
Expand Down
23 changes: 17 additions & 6 deletions src/main/java/MOO.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Properties;

Expand All @@ -21,7 +22,7 @@

public class MOO {

public static void runOptimization(File inputFile, OptionSet options) throws Exception
public static void runOptimization(File inputFile, OptionSet options, PrintStream outStream) throws Exception
{
//----------------------------------------
// Running the model itself(instantiating)
Expand Down Expand Up @@ -121,18 +122,28 @@ else if (key.equals("maxInt"))
System.out.println("Generating optimal instances...");

int index = 0; // optimal instance id
boolean prettify = options.has("prettify");
while (solver.find())
{
System.out.println("=== Instance " + (++index) + " Begin ===\n");
outStream.println("=== Instance " + (++index) + " Begin ===\n");
InstanceModel instance = solver.instance();
for (InstanceClafer c : instance.getTopClafers())

if (prettify)
{
instance.print(outStream);
}
else
{
Utils.printClafer(c, System.out);
for (InstanceClafer c : instance.getTopClafers())
{
Utils.printClafer(c, outStream);
}
}
System.out.println("--- Instance " + (index) + " End ---\n");

outStream.println("--- Instance " + (index) + " End ---\n");
}

System.out.println("All optimal instances within the scope generated\n");
System.out.println("All (" + index + ") optimal instances within the scope generated\n");

}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static void main(String[] args) throws Exception {

if (options.has( "moo" ) )
{
MOO.runOptimization(inputFile, options);
MOO.runOptimization(inputFile, options, outStream);
}
else if (options.has( "repl" ) )
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.clafer.ast.AstClafer;
import org.clafer.ast.AstConcreteClafer;
import org.clafer.ast.AstModel;
import org.clafer.ast.AstUtil;
import org.clafer.instance.InstanceClafer;


Expand Down Expand Up @@ -191,7 +192,7 @@ private static void printClafer(InstanceClafer clafer, String indent, Appendable
}

if(clafer.hasRef()) {
out.append(" -> " + clafer.getType().getRef().getTargetType().getName() + " = ");
out.append(" -> " + AstUtil.getInheritedRef(clafer.getType()).getTargetType().getName() + " = ");
if (clafer.getRef() instanceof InstanceClafer) {
InstanceClafer refClafer = (InstanceClafer) clafer.getRef();
out.append(refClafer.getType().getName()).append('$').append(Integer.toString(refClafer.getId()));
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
releasedate = 05-13-2015
version = 0.3.10.1
releasedate = 07-29-2015
version = 0.4.0
name = ClaferChocoIG

0 comments on commit 4a765fb

Please sign in to comment.