From 0533d962bc83630cb80af2b60ecfd4083811f0fb Mon Sep 17 00:00:00 2001 From: Koen van der Heijden Date: Sun, 11 Dec 2016 18:45:16 +0100 Subject: Removed package for easier compiling --- packing_pallets_in_trucks/src/PackingPallets.java | 189 +++++++++++++++++++++ .../src/nl/tue/PackingPallets.java | 180 -------------------- 2 files changed, 189 insertions(+), 180 deletions(-) create mode 100644 packing_pallets_in_trucks/src/PackingPallets.java delete mode 100644 packing_pallets_in_trucks/src/nl/tue/PackingPallets.java (limited to 'packing_pallets_in_trucks') diff --git a/packing_pallets_in_trucks/src/PackingPallets.java b/packing_pallets_in_trucks/src/PackingPallets.java new file mode 100644 index 0000000..baf850a --- /dev/null +++ b/packing_pallets_in_trucks/src/PackingPallets.java @@ -0,0 +1,189 @@ + +public class PackingPallets { + + private static final int NR_OF_TRUCKS = 8; + private static final int NR_OF_COOLING_TRUCKS = 3; + private static final int TRUCK_CAPACITY = 8000; + private static final int TRUCK_PALLET_CAPACITY = 8; + + private static final int NR_OF_NUZZLES = 4; + private static final int NUZZLES_WEIGHT = 700; + + private static final int NR_OF_PRITTLES_A = 14; + private static final int NR_OF_PRITTLES_B = 15; + private static final int PRITTLES_WEIGHT = 400; + + private static final int NR_OF_SKIPPLES = 8; + private static final int SKIPPLES_WEIGHT = 1000; + + private static final int NR_OF_CROTTLES = 10; + private static final int CROTTLES_WEIGHT = 2500; + + private static final int NR_OF_DUPPLES = 20; + private static final int DUPPLES_WEIGHT = 200; + + private static void assignmentA() { + System.out.println("(benchmark packing_pallets_a.smt"); + System.out.println(":logic QF_UFLIA"); + System.out.println(":extrafuns ("); + print_predicates(NR_OF_PRITTLES_A); + System.out.println(")"); + System.out.print(":formula ("); + print_formula(NR_OF_PRITTLES_A); + System.out.println("))"); + } + + private static void assignmentB() { + System.out.println("(benchmark packing_pallets_b.smt"); + System.out.println(":logic QF_UFLIA"); + System.out.println(":extrafuns ("); + print_predicates(NR_OF_PRITTLES_B); + System.out.println(")"); + System.out.print(":formula ("); + print_formula(NR_OF_PRITTLES_B); + print_formula_b(NR_OF_PRITTLES_B); + System.out.println("))"); + } + + private static void print_predicates(int prittles) { + for(int i = 1; i <= NR_OF_NUZZLES; i++) { + System.out.print("(n" + i + " Int) "); + } + System.out.println(); + for(int i = 1; i <= prittles; i++) { + System.out.print("(p" + i + " Int) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_SKIPPLES; i++) { + System.out.print("(s" + i + " Int) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_CROTTLES; i++) { + System.out.print("(c" + i + " Int) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_DUPPLES; i++) { + System.out.print("(d" + i + " Int) "); + } + System.out.println(); + } + + private static void print_formula(int prittles) { + /* valid truck assignment */ + System.out.println("and "); + for(int i = 1; i <= NR_OF_NUZZLES; i++) { + System.out.print("(<= n" + i + " " + NR_OF_TRUCKS +") (> n" + i + " 0) "); + } + System.out.println(); + for(int i = 1; i <= prittles; i++) { + System.out.print("(<= p" + i + " " + NR_OF_TRUCKS +") (> p" + i + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_SKIPPLES; i++) { + System.out.print("(<= s" + i + " " + NR_OF_COOLING_TRUCKS +") (> s" + i + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_CROTTLES; i++) { + System.out.print("(<= c" + i + " " + NR_OF_TRUCKS +") (> c" + i + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_DUPPLES; i++) { + System.out.print("(<= d" + i + " " + NR_OF_TRUCKS +") (> d" + i + " 0) "); + } + System.out.println(); + + /* assignment constraints */ + for(int j = 1; j <= NR_OF_TRUCKS; j++) { + System.out.println("(< (+ "); + for(int i = 1; i <= NR_OF_NUZZLES; i++) { + System.out.print("(ite (= n" + i + " " + j + ") " + NUZZLES_WEIGHT + " 0)" ); + } + System.out.println(); + for(int i = 1; i <= prittles; i++) { + System.out.print("(ite (= p" + i + " " + j + ") " + PRITTLES_WEIGHT + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_SKIPPLES; i++) { + System.out.print("(ite (= s" + i + " " + j + ") " + SKIPPLES_WEIGHT + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_CROTTLES; i++) { + System.out.print("(ite (= c" + i + " " + j + ") " + CROTTLES_WEIGHT + " 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_DUPPLES; i++) { + System.out.print("(ite (= d" + i + " " + j + ") " + DUPPLES_WEIGHT + " 0) "); + } + System.out.println(") " + TRUCK_CAPACITY + ")"); + } + + for(int j = 1; j <= NR_OF_TRUCKS; j++) { + System.out.println("(< (+ "); + for(int i = 1; i <= NR_OF_NUZZLES; i++) { + System.out.print("(ite (= n" + i + " " + j + ") 1 0) "); + } + System.out.println(); + for(int i = 1; i <= prittles; i++) { + System.out.print("(ite (= p" + i + " " + j + ") 1 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_SKIPPLES; i++) { + System.out.print("(ite (= s" + i + " " + j + ") 1 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_CROTTLES; i++) { + System.out.print("(ite (= c" + i + " " + j + ") 1 0) "); + } + System.out.println(); + for(int i = 1; i <= NR_OF_DUPPLES; i++) { + System.out.print("(ite (= d" + i + " " + j + ") 1 0) "); + } + System.out.println(") " + TRUCK_PALLET_CAPACITY + ")"); + } + + for(int i = 1; i <= NR_OF_NUZZLES; i++) { + for(int j = i + 1; j <= NR_OF_NUZZLES; j++ ) { + System.out.println("(not (= n" + i + " n" + j +"))"); + } + } + } + + private static void print_formula_b(int prittles) { + for(int i = 1; i <= NR_OF_TRUCKS; i++) { + System.out.print("(=> (or "); + for(int j = 1; j <= prittles; j++) { + System.out.print("(= p" + j + " " + i + ") "); + } + System.out.print(") (not (or "); + for(int j = 1; j <= NR_OF_CROTTLES; j++) { + System.out.print("(= c" + j + " " + i + ") "); + } + System.out.println(")))"); + + System.out.print("(=> (or "); + for(int j = 1; j <= NR_OF_CROTTLES; j++) { + System.out.print("(= c" + j + " " + i + ") "); + } + System.out.print(") (not (or "); + for(int j = 1; j <= prittles; j++) { + System.out.print("(= p" + j + " " + i + ") "); + } + System.out.println(")))"); + } + } + + public static void main(String... args) { + assert(args.length > 0); + switch(args[0]) { + case "a": + assignmentA(); + break; + case "b": + assignmentB(); + break; + default: + System.err.println("Specify assignment a or b!"); + break; + } + } +} diff --git a/packing_pallets_in_trucks/src/nl/tue/PackingPallets.java b/packing_pallets_in_trucks/src/nl/tue/PackingPallets.java deleted file mode 100644 index 0d2afc1..0000000 --- a/packing_pallets_in_trucks/src/nl/tue/PackingPallets.java +++ /dev/null @@ -1,180 +0,0 @@ -package nl.tue; - -public class PackingPallets { - - private static final int NR_OF_TRUCKS = 8; - private static final int NR_OF_COOLING_TRUCKS = 3; - private static final int TRUCK_CAPACITY = 8000; - private static final int TRUCK_PALLET_CAPACITY = 8; - - private static final int NR_OF_NUZZLES = 4; - private static final int NUZZLES_WEIGHT = 700; - - private static final int NR_OF_PRITTLES_A = 5; - private static final int NR_OF_PRITTLES_B = 5; - private static final int PRITTLES_WEIGHT = 400; - - private static final int NR_OF_SKIPPLES = 8; - private static final int SKIPPLES_WEIGHT = 1000; - - private static final int NR_OF_CROTTLES = 10; - private static final int CROTTLES_WEIGHT = 2500; - - private static final int NR_OF_DUPPLES = 20; - private static final int DUPPLES_WEIGHT = 200; - - private static void assignmentA() { - System.out.println("(benchmark packing_pallets_a.smt"); - System.out.println(":logic QF_UFLIA"); - System.out.println(":extrafuns ("); - print_predicates(NR_OF_PRITTLES_A); - System.out.println(")"); - System.out.print(":formula ("); - print_formula(NR_OF_PRITTLES_A); - System.out.println("))"); - } - - private static void assignmentB() { - System.out.println("(benchmark packing_pallets_b.smt"); - System.out.println(":logic QF_UFLIA"); - System.out.println(":extrafuns ("); - print_predicates(NR_OF_PRITTLES_B); - System.out.println(")"); - System.out.print(":formula ("); - print_formula(NR_OF_PRITTLES_B); - print_formula_b(NR_OF_PRITTLES_B); - System.out.println("))"); - } - - private static void print_predicates(int prittles) { - for(int i = 1; i <= NR_OF_NUZZLES; i++) { - System.out.print("(n" + i + " Int) "); - } - System.out.println(); - for(int i = 1; i <= prittles; i++) { - System.out.print("(p" + i + " Int) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_SKIPPLES; i++) { - System.out.print("(s" + i + " Int) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_CROTTLES; i++) { - System.out.print("(c" + i + " Int) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_DUPPLES; i++) { - System.out.print("(d" + i + " Int) "); - } - System.out.println(); - } - - private static void print_formula(int prittles) { - /* valid truck assignment */ - System.out.println("and "); - for(int i = 1; i <= NR_OF_NUZZLES; i++) { - System.out.print("(<= n" + i + " " + NR_OF_TRUCKS +") (> n" + i + " 0) "); - } - System.out.println(); - for(int i = 1; i <= prittles; i++) { - System.out.print("(<= p" + i + " " + NR_OF_TRUCKS +") (> p" + i + " 0) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_SKIPPLES; i++) { - System.out.print("(<= s" + i + " " + NR_OF_COOLING_TRUCKS +") (> s" + i + " 0) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_CROTTLES; i++) { - System.out.print("(<= c" + i + " " + NR_OF_TRUCKS +") (> c" + i + " 0) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_DUPPLES; i++) { - System.out.print("(<= d" + i + " " + NR_OF_TRUCKS +") (> d" + i + " 0) "); - } - System.out.println(); - - /* assignment constraints */ - for(int j = 1; j <= NR_OF_TRUCKS; j++) { - System.out.println("(< (+ "); - for(int i = 1; i <= NR_OF_NUZZLES; i++) { - System.out.print("(ite (= n" + i + " " + j + ") (" + NUZZLES_WEIGHT + ") (0))" ); - } - System.out.println(); - for(int i = 1; i <= prittles; i++) { - System.out.print("(ite (= p" + i + " " + j + ") (" + PRITTLES_WEIGHT + ") (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_SKIPPLES; i++) { - System.out.print("(ite (= s" + i + " " + j + ") (" + SKIPPLES_WEIGHT + ") (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_CROTTLES; i++) { - System.out.print("(ite (= c" + i + " " + j + ") (" + CROTTLES_WEIGHT + ") (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_DUPPLES; i++) { - System.out.print("(ite (= d" + i + " " + j + ") (" + DUPPLES_WEIGHT + ") (0)) "); - } - System.out.println(") " + TRUCK_CAPACITY + ")"); - } - - for(int j = 1; j <= NR_OF_TRUCKS; j++) { - System.out.println("(< (+ "); - for(int i = 1; i <= NR_OF_NUZZLES; i++) { - System.out.print("(ite (= n" + i + " " + j + ") (1) (0)) "); - } - System.out.println(); - for(int i = 1; i <= prittles; i++) { - System.out.print("(ite (= p" + i + " " + j + ") (1) (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_SKIPPLES; i++) { - System.out.print("(ite (= s" + i + " " + j + ") (1) (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_CROTTLES; i++) { - System.out.print("(ite (= c" + i + " " + j + ") (1) (0)) "); - } - System.out.println(); - for(int i = 1; i <= NR_OF_DUPPLES; i++) { - System.out.print("(ite (= d" + i + " " + j + ") (1) (0)) "); - } - System.out.println(") " + TRUCK_PALLET_CAPACITY + ")"); - } - - for(int i = 1; i <= NR_OF_NUZZLES; i++) { - for(int j = i + 1; j <= NR_OF_NUZZLES; j++ ) { - System.out.println("(not (= n" + i + " n" + j +"))"); - } - } - } - - private static void print_formula_b(int prittles) { - for(int i = 1; i <= NR_OF_TRUCKS; i++) { - System.out.print("(=> (or "); - for(int j = 1; j <= prittles; j++) { - System.out.print("(= p" + j + " " + i + ") "); - } - System.out.print(") (not (or "); - for(int j = 1; j <= NR_OF_CROTTLES; j++) { - System.out.print("(= c" + j + " " + i + ") "); - } - System.out.println(")))"); - } - } - - public static void main(String... args) { - assert(args.length > 0); - switch(args[0]) { - case "a": - assignmentA(); - break; - case "b": - assignmentB(); - break; - default: - System.err.println("Specify assignment a or b!"); - break; - } - } -} -- cgit v1.2.1