public ArrayList<int[]> getIncidenceMatrix() {
        ArrayList<int[]> incidenceMatrix = new ArrayList<int[]>();
        for (Place place : getPn().getListOfPlaces()) {
            int[] incidenceRow = new int[getPn().getListOfTransitions().size()];
            for (Arc a : place.getListOfOutArcs()) {
                Transition t = (Transition) a.getInElement();
                int capacity = a.getCapacity();
                int index = getPn().getListOfTransitions().indexOf(t);
                incidenceRow[index] = -capacity;
            }
            for (Arc a : place.getListOfInArcs()) {
                Transition t = (Transition) a.getOutElement();
                int capacity = a.getCapacity();
                int index = getPn().getListOfTransitions().indexOf(t);
                incidenceRow[index] = capacity;
            }
            incidenceMatrix.add(incidenceRow);
        }
        for (Resource res : getPn().getListOfResources()) {
            int[] incidenceRow = new int[getPn().getListOfTransitions().size()];
            for (Arc a : res.getListOfOutArcs()) {
                Transition t = (Transition) a.getInElement();
                int capacity = a.getCapacity();
                int index = getPn().getListOfTransitions().indexOf(t);
                incidenceRow[index] = -capacity;
            }
            for (Arc a : res.getListOfInArcs()) {
                Transition t = (Transition) a.getOutElement();
                int capacity = a.getCapacity();
                int index = getPn().getListOfTransitions().indexOf(t);
                incidenceRow[index] = capacity;
            }
            incidenceMatrix.add(incidenceRow);
        }
        return incidenceMatrix;
    }