
de.citec.tcs.alignment.CooptimalModel Maven / Gradle / Ivy
/*
* TCS Alignment Toolbox Version 3
*
* Copyright (C) 2016
* Benjamin Paaßen
* AG Theoretical Computer Science
* Centre of Excellence Cognitive Interaction Technology (CITEC)
* University of Bielefeld
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package de.citec.tcs.alignment;
import de.citec.tcs.alignment.comparators.Comparator;
import de.citec.tcs.alignment.comparators.DerivableComparator;
import de.citec.tcs.alignment.comparators.OperationType;
import de.citec.tcs.alignment.parallel.MatrixEngine;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import lombok.Getter;
import lombok.NonNull;
/**
* This is a sparse model of all co-optimal paths in an alignment matrix. It essentially stores for
* every partial sequences of both input sequences the co-optimal operations that could have been
* applied.
*
* @author Benjamin Paassen - bpaassen(at)techfak.uni-bielefeld.de
* @param the class of the elements in the left input sequence.
* @param the class of the elements in the right input sequence.
*/
public class CooptimalModel implements DerivableAlignmentDistance {
/**
* The Comparator that was used to compute this CooptimalModel.
*
* @return The Comparator that was used to compute this CooptimalModel.
*/
@Getter
@NonNull
private final Comparator comparator;
@NonNull
private final List left;
@NonNull
private final List right;
private final double distance;
@NonNull
private final TreeMap cooptimals = new TreeMap<>();
public CooptimalModel(@NonNull final Comparator comparator,
@NonNull final List left, @NonNull final List right,
final double distance) {
this.comparator = comparator;
this.left = left;
this.right = right;
this.distance = distance;
}
/**
* A Map of matrix coordinates to an array of sequences of operations that can be co-optimally
* applied at the given position of the dynamic programming matrix.
*
* @return A Map of matrix coordinates to an array of sequences of operations that can be
* co-optimally applied at the given position of the dynamic programming matrix.
*/
public Map getCooptimals() {
return cooptimals;
}
@Override
public List getLeft() {
return left;
}
@Override
public List getRight() {
return right;
}
@Override
public double getDistance() {
return distance;
}
@Override
public double[] computeGradient(@NonNull DerivableComparator comp) {
//TODO: This should be implemented at some point.
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy