Commit 854b595e authored by Vladislav Kiselev's avatar Vladislav Kiselev

Исправлены ошибки со сборкой.

parent 5ebf5fe0
.PHONY: Conversion.jar
out_dir = temp
Conversion.jar: src/inport/**/*.java src/constraints/*.mzn
Conversion.jar:
mkdir -p $(out_dir)
javac -d $(out_dir) -encoding UTF-8 -classpath annotations-java8.jar src/inport/*.java src/inport/ConversionUtils/*.java
jar cfe Conversion.jar inport.Main -C $(out_dir) inport -C src constraints
javac -d $(out_dir) -encoding UTF-8 -cp annotations-java8.jar -cp org.sat4j.core.jar -cp org.sat4j.pb.jar src/inport/*.java src/inport/ConversionUtils/*.java
jar cfe Conversion.jar inport.Main org.sat4j.core.jar org.sat4j.pb.jar -C $(out_dir) inport -C src constraints
rm -r -f $(out_dir)
package inport.ConversionUtils;
import inport.*;
import org.jetbrains.annotations.NotNull;
import java.io.FileWriter;
import java.io.IOException;
......@@ -56,7 +55,7 @@ public class Task {
}
@Override
public int compareTo(@NotNull StorageSectionId id) {
public int compareTo(StorageSectionId id) {
if (isRealStorage != id.isRealStorage) {
return (isRealStorage ? 1 : -1);
}
......@@ -1046,7 +1045,7 @@ public class Task {
}
@Override
public int compareTo(@NotNull OperationData o) {
public int compareTo(OperationData o) {
if (opId != o.opId) {
return Integer.compare(opId, o.opId);
}
......
......@@ -12,7 +12,9 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.Optional;
import org.sat4j.core.Vec;
import org.sat4j.core.VecInt;
......@@ -242,21 +244,21 @@ public class InPort {
task.getStorages().add(storage1);
// Суда
TransportShip ship1 = new TransportShip(4, "Ship 1", 200);
TransportShip ship1 = new TransportShip(4, "Ship 1", 200, cargo0);
task.getShips().add(ship1);
// Шаблоны операций
// Перемещения
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,1.0,5+task.getTemplates().size());
MovingTemplate move101 = new MovingTemplate(ship1, berth0, berth1, new ArrayList<>(), 1.0, 5+task.getTemplates().size());
task.getTemplates().add(move101);
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,1.0,5+task.getTemplates().size());
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,new ArrayList<>(),1.0,5+task.getTemplates().size());
task.getTemplates().add(move110);
// Погрузки
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1,100.0,5+task.getTemplates().size());
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,100.0,5+task.getTemplates().size());
task.getTemplates().add(load11);
......@@ -300,21 +302,21 @@ public class InPort {
task.getStorages().add(storage1);
// Суда
TransportShip ship1 = new TransportShip(5, "Ship 1", 200);
TransportShip ship1 = new TransportShip(5, "Ship 1", 200, cargo0);
task.getShips().add(ship1);
// Шаблоны операций
// Перемещения
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,1.0,6+task.getTemplates().size());
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,new ArrayList<>(),1.0,6+task.getTemplates().size());
task.getTemplates().add(move101);
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,1.0,6+task.getTemplates().size());
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,new ArrayList<>(),1.0,6+task.getTemplates().size());
task.getTemplates().add(move110);
// Погрузки
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1,100.0,6+task.getTemplates().size());
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1,cargo0, Optional.empty(), new ArrayList<>(), false,100.0,6+task.getTemplates().size());
task.getTemplates().add(load11);
......@@ -449,9 +451,9 @@ public class InPort {
task.getStorages().add(storage1);
// Суда
TransportShip ship1 = new TransportShip(5, "Ship 1", 2000);
TransportShip ship1 = new TransportShip(5, "Ship 1", 2000, cargo0);
task.getShips().add(ship1);
TransportShip ship2 = new TransportShip(6, "Ship 2", 2000);
TransportShip ship2 = new TransportShip(6, "Ship 2", 2000, cargo0);
task.getShips().add(ship2);
......@@ -459,56 +461,56 @@ public class InPort {
// Перемещения
//1
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,1.0,7+task.getTemplates().size());
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move101);
//2
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,1.0,7+task.getTemplates().size());
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move110);
//3
MovingTemplate move102 = new MovingTemplate(ship1,berth0,berth2,1.0,7+task.getTemplates().size());
MovingTemplate move102 = new MovingTemplate(ship1,berth0,berth2,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move102);
//4
MovingTemplate move120 = new MovingTemplate(ship1,berth2,berth0,1.0,7+task.getTemplates().size());
MovingTemplate move120 = new MovingTemplate(ship1,berth2,berth0,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move120);
//5
MovingTemplate move112 = new MovingTemplate(ship1,berth1,berth2,1.0,7+task.getTemplates().size());
MovingTemplate move112 = new MovingTemplate(ship1,berth1,berth2,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move112);
//6
MovingTemplate move121 = new MovingTemplate(ship1,berth2,berth1,1.0,7+task.getTemplates().size());
MovingTemplate move121 = new MovingTemplate(ship1,berth2,berth1,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move121);
//7
MovingTemplate move201 = new MovingTemplate(ship2,berth0,berth1,1.0,7+task.getTemplates().size());
MovingTemplate move201 = new MovingTemplate(ship2,berth0,berth1,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move201);
//8
MovingTemplate move210 = new MovingTemplate(ship2,berth1,berth0,1.0,7+task.getTemplates().size());
MovingTemplate move210 = new MovingTemplate(ship2,berth1,berth0,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move210);
//9
MovingTemplate move202 = new MovingTemplate(ship2,berth0,berth2,1.0,7+task.getTemplates().size());
MovingTemplate move202 = new MovingTemplate(ship2,berth0,berth2,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move202);
//10
MovingTemplate move220 = new MovingTemplate(ship2,berth2,berth0,1.0,7+task.getTemplates().size());
MovingTemplate move220 = new MovingTemplate(ship2,berth2,berth0,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move220);
//11
MovingTemplate move212 = new MovingTemplate(ship2,berth1,berth2,1.0,7+task.getTemplates().size());
MovingTemplate move212 = new MovingTemplate(ship2,berth1,berth2,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move212);
//12
MovingTemplate move221 = new MovingTemplate(ship2,berth2,berth1,1.0,7+task.getTemplates().size());
MovingTemplate move221 = new MovingTemplate(ship2,berth2,berth1,new ArrayList<>(),1.0,7+task.getTemplates().size());
task.getTemplates().add(move221);
// Погрузки
//13
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1,100.0,7+task.getTemplates().size());
LoadingTemplate load11 = new LoadingTemplate(ship1,berth1,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,100.0,7+task.getTemplates().size());
task.getTemplates().add(load11);
//14
LoadingTemplate load12 = new LoadingTemplate(ship1,berth2,storage1,50.0,7+task.getTemplates().size());
LoadingTemplate load12 = new LoadingTemplate(ship1,berth2,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,50.0,7+task.getTemplates().size());
task.getTemplates().add(load12);
//15
LoadingTemplate load21 = new LoadingTemplate(ship2,berth1,storage1,100.0,7+task.getTemplates().size());
LoadingTemplate load21 = new LoadingTemplate(ship2,berth1,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,100.0,7+task.getTemplates().size());
task.getTemplates().add(load21);
//16
LoadingTemplate load22 = new LoadingTemplate(ship2,berth2,storage1,50.0,7+task.getTemplates().size());
LoadingTemplate load22 = new LoadingTemplate(ship2,berth2,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,50.0,7+task.getTemplates().size());
task.getTemplates().add(load22);
// Начальное состояние
......@@ -1449,30 +1451,30 @@ public class InPort {
task.getTows().add(tow1);
// Суда
TransportShip ship1 = new TransportShip(7, "Ship 1", 2000);
TransportShip ship1 = new TransportShip(7, "Ship 1", 2000, cargo0);
task.getShips().add(ship1);
// Перемещения
// 1
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,2.0,8+task.getTemplates().size()); move101.getResources().add(tow1);
MovingTemplate move101 = new MovingTemplate(ship1,berth0,berth1,new ArrayList<>(),2.0,8+task.getTemplates().size()); move101.getResources().add(tow1);
task.getTemplates().add(move101);
// 2
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,2.0,8+task.getTemplates().size()); move110.getResources().add(tow1);
MovingTemplate move110 = new MovingTemplate(ship1,berth1,berth0,new ArrayList<>(),2.0,8+task.getTemplates().size()); move110.getResources().add(tow1);
task.getTemplates().add(move110);
// 3
MovingTemplate movet20 = new MovingTemplate(tow1,berth2,berth0,2.0,8+task.getTemplates().size());
MovingTemplate movet20 = new MovingTemplate(tow1,berth2,berth0,new ArrayList<>(),2.0,8+task.getTemplates().size());
task.getTemplates().add(movet20);
// 4
MovingTemplate movet10 = new MovingTemplate(tow1,berth1,berth0,2.0,8+task.getTemplates().size());
MovingTemplate movet10 = new MovingTemplate(tow1,berth1,berth0,new ArrayList<>(),2.0,8+task.getTemplates().size());
task.getTemplates().add(movet10);
// 5
MovingTemplate movet12 = new MovingTemplate(tow1,berth1,berth2,1.0,8+task.getTemplates().size());
MovingTemplate movet12 = new MovingTemplate(tow1,berth1,berth2,new ArrayList<>(),1.0,8+task.getTemplates().size());
task.getTemplates().add(movet12);
// 6
MovingTemplate movek21 = new MovingTemplate(floatingCrane,berth2,berth1,2.0,8+task.getTemplates().size()); movek21.getResources().add(tow1);
MovingTemplate movek21 = new MovingTemplate(floatingCrane,berth2,berth1,new ArrayList<>(),2.0,8+task.getTemplates().size()); movek21.getResources().add(tow1);
task.getTemplates().add(movek21);
// 7
LoadingTemplate lt = new LoadingTemplate(ship1,berth1,storage1,-20.0,8+task.getTemplates().size()); lt.getResources().add(floatingCrane);
LoadingTemplate lt = new LoadingTemplate(ship1,berth1,storage1, cargo0, Optional.empty(), new ArrayList<>(), false,-20.0,8+task.getTemplates().size()); lt.getResources().add(floatingCrane);
task.getTemplates().add(lt);
StorageState tini1 = new StorageState(storage1, cargo0, 0.0);
......
......@@ -61,7 +61,13 @@ public class Storage {
this.id = id;
}
public Storage(int id, String name, double volume, ArrayList<Pair<Cargo, Double>> storageSections) {
public Storage(int id, String name, double volume, Cargo cargo) {
this.id = id;
this.name = name;
storageSections.add(new Pair<>(cargo, volume));
}
public Storage(int id, String name, ArrayList<Pair<Cargo, Double>> storageSections) {
this.id = id;
this.name = name;
this.storageSections = storageSections;
......
......@@ -24,8 +24,13 @@ public class TransportShip extends MovingObject {
public void setStorageSections(ArrayList<Pair<Cargo, Double>> storageSections) {
this.storageSections = storageSections;
}
}
public TransportShip(int id, String name, double volume, Cargo cargo) {
super(id, name);
storageSections.add(new Pair<>(cargo, volume));
}
public TransportShip(int id, String name, ArrayList<Pair<Cargo, Double>> storageSections) {
super(id, name);
this.storageSections = storageSections;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment