import uk.ac.ic.doc.automed.*;
import uk.ac.ic.doc.automed.reps.*;
import java.io.*;
import java.sql.*;

public class OptimiseTransformationPathway
{
   public static void main(String[] args)
   {
      try
      {
         TransformationPathway tp1 =
            TransformationPathway.findShortestPath("uni_s1", "uni_s2");

         Transformation[] tp1Trans = tp1.getTransformations();

         System.out.println("original pathway:");

         for (int i=0; i<tp1Trans.length; i++)
         {
            Transformation t = tp1Trans[i];
            System.out.println((i+1) + ": " + t);
         }

         TransformationPathway optimisedTP =
            TransformationOptimiser.optimisePathway(tp1);

         Transformation[] optimisedTrans = optimisedTP.getTransformations();

         System.out.println("\n\noptimised pathway:");

         for (int i=0; i<optimisedTrans.length; i++)
         {
            Transformation t = optimisedTrans[i];
            System.out.println((i+1) + ": " + t);
         }
      }
      catch (SQLException se)
      { 
         se.printStackTrace();
      }
      catch (IOException ie)
      {
         ie.printStackTrace();
      }
      catch (AutoMedException ame)
      {
         ame.printStackTrace();
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
}
