The metabolic models of Corynebacterium glutamicum are now part of EvA2.
This commit is contained in:
		@@ -49,7 +49,6 @@ import eva2.server.go.strategies.SimulatedAnnealing;
 | 
			
		||||
import eva2.server.go.strategies.Tribes;
 | 
			
		||||
import eva2.server.modules.GOParameters;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * The OptimizerFactory allows quickly creating some optimizers without thinking
 | 
			
		||||
@@ -59,9 +58,9 @@ import eva2.server.modules.GOParameters;
 | 
			
		||||
 * </p>
 | 
			
		||||
 * <p>
 | 
			
		||||
 * On the other hand this class provides an almost complete list of all
 | 
			
		||||
 * currently available optimization procedures in EvA2. The arguments passed
 | 
			
		||||
 * to the methods initialize the respective optimization procedure. To perform
 | 
			
		||||
 * an optimization one has to do the following: <code>
 | 
			
		||||
 * currently available optimization procedures in EvA2. The arguments passed to
 | 
			
		||||
 * the methods initialize the respective optimization procedure. To perform an
 | 
			
		||||
 * optimization one has to do the following: <code>
 | 
			
		||||
 * InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments);
 | 
			
		||||
 * EvaluationTerminator terminator = new EvaluationTerminator();
 | 
			
		||||
 * terminator.setFitnessCalls(numOfFitnessCalls);
 | 
			
		||||
@@ -76,33 +75,33 @@ import eva2.server.modules.GOParameters;
 | 
			
		||||
 * @date 17.04.2007
 | 
			
		||||
 */
 | 
			
		||||
public class OptimizerFactory {
 | 
			
		||||
	private static InterfaceTerminator	term	         = null;
 | 
			
		||||
	private static InterfaceTerminator term = null;
 | 
			
		||||
 | 
			
		||||
	public final static int	           STD_ES	         = 1;
 | 
			
		||||
	public final static int STD_ES = 1;
 | 
			
		||||
 | 
			
		||||
	public final static int	           CMA_ES	         = 2;
 | 
			
		||||
	public final static int CMA_ES = 2;
 | 
			
		||||
 | 
			
		||||
	public final static int	           STD_GA	         = 3;
 | 
			
		||||
	public final static int STD_GA = 3;
 | 
			
		||||
 | 
			
		||||
	public final static int	           PSO	           = 4;
 | 
			
		||||
	public final static int PSO = 4;
 | 
			
		||||
 | 
			
		||||
	public final static int	           DE	             = 5;
 | 
			
		||||
	public final static int DE = 5;
 | 
			
		||||
 | 
			
		||||
	public final static int	           TRIBES	         = 6;
 | 
			
		||||
	public final static int TRIBES = 6;
 | 
			
		||||
 | 
			
		||||
	public final static int	           RANDOM	         = 7;
 | 
			
		||||
	public final static int RANDOM = 7;
 | 
			
		||||
 | 
			
		||||
	public final static int	           HILLCL	         = 8;
 | 
			
		||||
	public final static int HILLCL = 8;
 | 
			
		||||
 | 
			
		||||
	public final static int	           CBN_ES	         = 9;
 | 
			
		||||
	public final static int CBN_ES = 9;
 | 
			
		||||
 | 
			
		||||
	public final static int	           CL_HILLCL	     = 10;
 | 
			
		||||
	public final static int CL_HILLCL = 10;
 | 
			
		||||
 | 
			
		||||
	public final static int	           defaultFitCalls	= 10000;
 | 
			
		||||
	public final static int defaultFitCalls = 10000;
 | 
			
		||||
 | 
			
		||||
	public final static int	           randSeed	       = 0;
 | 
			
		||||
	public final static int randSeed = 0;
 | 
			
		||||
 | 
			
		||||
	private static OptimizerRunnable	 lastRunnable	   = null;
 | 
			
		||||
	private static OptimizerRunnable lastRunnable = null;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Add an InterfaceTerminator to any new optimizer in a boolean combination.
 | 
			
		||||
@@ -110,15 +109,16 @@ public class OptimizerFactory {
 | 
			
		||||
	 * bAnd is true, and as in (TOld || TNew) if bAnd is false.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param newTerm
 | 
			
		||||
	 *          a new InterfaceTerminator instance
 | 
			
		||||
	 *            a new InterfaceTerminator instance
 | 
			
		||||
	 * @param bAnd
 | 
			
		||||
	 *          indicate the boolean combination
 | 
			
		||||
	 *            indicate the boolean combination
 | 
			
		||||
	 */
 | 
			
		||||
	public static void addTerminator(InterfaceTerminator newTerm, boolean bAnd) {
 | 
			
		||||
		if (OptimizerFactory.term == null)
 | 
			
		||||
			OptimizerFactory.term = term;
 | 
			
		||||
		else setTerminator(new CombinedTerminator(OptimizerFactory.term, newTerm,
 | 
			
		||||
		    bAnd));
 | 
			
		||||
		else
 | 
			
		||||
			setTerminator(new CombinedTerminator(OptimizerFactory.term,
 | 
			
		||||
					newTerm, bAnd));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters cbnES(AbstractOptimizationProblem problem) {
 | 
			
		||||
@@ -141,7 +141,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters clusteringHillClimbing(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		ClusteringHillClimbing chc = new ClusteringHillClimbing();
 | 
			
		||||
		chc.SetProblem(problem);
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
@@ -165,7 +165,7 @@ public class OptimizerFactory {
 | 
			
		||||
 | 
			
		||||
		AbstractEAIndividual indyTemplate = problem.getIndividualTemplate();
 | 
			
		||||
		if ((indyTemplate != null)
 | 
			
		||||
		    && (indyTemplate instanceof InterfaceESIndividual)) {
 | 
			
		||||
				&& (indyTemplate instanceof InterfaceESIndividual)) {
 | 
			
		||||
			// Set CMA operator for mutation
 | 
			
		||||
			AbstractEAIndividual indy = (AbstractEAIndividual) indyTemplate;
 | 
			
		||||
			MutateESCovarianceMartixAdaption cmaMut = new MutateESCovarianceMartixAdaption();
 | 
			
		||||
@@ -174,7 +174,7 @@ public class OptimizerFactory {
 | 
			
		||||
			indy.setCrossoverOperator(new CrossoverESDefault());
 | 
			
		||||
		} else {
 | 
			
		||||
			System.err
 | 
			
		||||
			    .println("Error, CMA-ES is implemented for ES individuals only (requires double data types)");
 | 
			
		||||
					.println("Error, CMA-ES is implemented for ES individuals only (requires double data types)");
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -190,14 +190,15 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param popsize
 | 
			
		||||
	 * @param f
 | 
			
		||||
	 * @param k
 | 
			
		||||
	 * @param CR
 | 
			
		||||
	 * @param lambda
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization algorithm that performs differential evolution.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final DifferentialEvolution createDifferentialEvolution(
 | 
			
		||||
	    AbstractOptimizationProblem problem, int popsize, double f,
 | 
			
		||||
	    double lambda, double k, InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			AbstractOptimizationProblem problem, int popsize, double f,
 | 
			
		||||
			double lambda, double CR,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
 | 
			
		||||
@@ -212,7 +213,7 @@ public class OptimizerFactory {
 | 
			
		||||
		de.getPopulation().setPopulationSize(popsize);
 | 
			
		||||
		de.getDEType().setSelectedTag(1);
 | 
			
		||||
		de.setF(f);
 | 
			
		||||
		de.setK(k);
 | 
			
		||||
		de.setK(CR);
 | 
			
		||||
		de.setLambda(lambda);
 | 
			
		||||
		de.addPopulationChangedEventListener(listener);
 | 
			
		||||
		de.init();
 | 
			
		||||
@@ -226,6 +227,7 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @param mu
 | 
			
		||||
	 * @param lambda
 | 
			
		||||
	 * @param plus
 | 
			
		||||
	 *            if true this operator uses elitism otherwise a comma strategy.
 | 
			
		||||
	 * @param mutationoperator
 | 
			
		||||
	 * @param pm
 | 
			
		||||
	 * @param crossoveroperator
 | 
			
		||||
@@ -236,10 +238,10 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @return An optimization algorithm that employes an evolution strategy.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final EvolutionStrategies createEvolutionStrategy(int mu,
 | 
			
		||||
	    int lambda, boolean plus, InterfaceMutation mutationoperator, double pm,
 | 
			
		||||
	    InterfaceCrossover crossoveroperator, double pc,
 | 
			
		||||
	    InterfaceSelection selection, AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			int lambda, boolean plus, InterfaceMutation mutationoperator,
 | 
			
		||||
			double pm, InterfaceCrossover crossoveroperator, double pc,
 | 
			
		||||
			InterfaceSelection selection, AbstractOptimizationProblem problem,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
		// RNG.setRandomSeed(100);
 | 
			
		||||
@@ -276,10 +278,10 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @return An optimization algorithm that employes an genetic algorithm.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final GeneticAlgorithm createGeneticAlgorithm(
 | 
			
		||||
	    InterfaceMutation mut, double pm, InterfaceCrossover cross, double pc,
 | 
			
		||||
	    InterfaceSelection select, int popsize,
 | 
			
		||||
	    AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			InterfaceMutation mut, double pm, InterfaceCrossover cross,
 | 
			
		||||
			double pc, InterfaceSelection select, int popsize,
 | 
			
		||||
			AbstractOptimizationProblem problem,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
 | 
			
		||||
@@ -299,48 +301,59 @@ public class OptimizerFactory {
 | 
			
		||||
 | 
			
		||||
		return ga;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method creates a multi-objective EA optimizer. Remember to set a multi-objective
 | 
			
		||||
	 * selection method within the specific optimizer. This uses a standard archiving strategy (NSGAII)
 | 
			
		||||
	 * and InformationRetrievalInserting.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param subOpt	the specific optimizer to use
 | 
			
		||||
	 * @param archiveSize	maximum size of the archive
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization algorithm that employs a multi-objective optimizer 
 | 
			
		||||
	 */
 | 
			
		||||
	public static final MultiObjectiveEA createMultiObjectiveEA(
 | 
			
		||||
	    InterfaceOptimizer subOpt, int archiveSize,
 | 
			
		||||
	    AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		return createMultiObjectiveEA(subOpt, new ArchivingNSGAII(), archiveSize, new InformationRetrievalInserting(), problem, listener);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method creates a multi-objective EA optimizer. Remember to set a multi-objective
 | 
			
		||||
	 * selection method within the specific optimizer.
 | 
			
		||||
	 * This method creates a multi-objective EA optimizer. Remember to set a
 | 
			
		||||
	 * multi-objective selection method within the specific optimizer. This uses
 | 
			
		||||
	 * a standard archiving strategy (NSGAII) and InformationRetrievalInserting.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param subOpt	the specific optimizer to use
 | 
			
		||||
	 * @param archiving	the archiving strategy collecting the pareto front
 | 
			
		||||
	 * @param archiveSize	maximum size of the archive
 | 
			
		||||
	 * @param infoRetrieval	information retrieval strategy
 | 
			
		||||
	 * @param subOpt
 | 
			
		||||
	 *            the specific optimizer to use
 | 
			
		||||
	 * @param archiveSize
 | 
			
		||||
	 *            maximum size of the archive
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization algorithm that employs a multi-objective optimizer 
 | 
			
		||||
	 * @return An optimization algorithm that employs a multi-objective
 | 
			
		||||
	 *         optimizer
 | 
			
		||||
	 */
 | 
			
		||||
	public static final MultiObjectiveEA createMultiObjectiveEA(
 | 
			
		||||
	    InterfaceOptimizer subOpt, InterfaceArchiving archiving, int archiveSize,
 | 
			
		||||
	    InterfaceInformationRetrieval infoRetrieval,
 | 
			
		||||
	    AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			InterfaceOptimizer subOpt, int archiveSize,
 | 
			
		||||
			AbstractOptimizationProblem problem,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		return createMultiObjectiveEA(subOpt, new ArchivingNSGAII(),
 | 
			
		||||
				archiveSize, new InformationRetrievalInserting(), problem,
 | 
			
		||||
				listener);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method creates a multi-objective EA optimizer. Remember to set a
 | 
			
		||||
	 * multi-objective selection method within the specific optimizer.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param subOpt
 | 
			
		||||
	 *            the specific optimizer to use
 | 
			
		||||
	 * @param archiving
 | 
			
		||||
	 *            the archiving strategy collecting the pareto front
 | 
			
		||||
	 * @param archiveSize
 | 
			
		||||
	 *            maximum size of the archive
 | 
			
		||||
	 * @param infoRetrieval
 | 
			
		||||
	 *            information retrieval strategy
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization algorithm that employs a multi-objective
 | 
			
		||||
	 *         optimizer
 | 
			
		||||
	 */
 | 
			
		||||
	public static final MultiObjectiveEA createMultiObjectiveEA(
 | 
			
		||||
			InterfaceOptimizer subOpt, InterfaceArchiving archiving,
 | 
			
		||||
			int archiveSize, InterfaceInformationRetrieval infoRetrieval,
 | 
			
		||||
			AbstractOptimizationProblem problem,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
		subOpt.SetProblem(problem);
 | 
			
		||||
 | 
			
		||||
		return new MultiObjectiveEA(subOpt, archiving, archiveSize, infoRetrieval, problem);
 | 
			
		||||
		return new MultiObjectiveEA(subOpt, archiving, archiveSize,
 | 
			
		||||
				infoRetrieval, problem);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -350,7 +363,7 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @return An optimization algorithm that performs gradient descent.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final GradientDescentAlgorithm createGradientDescent(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
 | 
			
		||||
		System.err.println("Currently not implemented!");
 | 
			
		||||
 | 
			
		||||
@@ -371,15 +384,15 @@ public class OptimizerFactory {
 | 
			
		||||
	 * This method performs a Hill Climber algorithm.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param pop
 | 
			
		||||
	 *          The size of the population
 | 
			
		||||
	 *            The size of the population
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 *          The problem to be optimized
 | 
			
		||||
	 *            The problem to be optimized
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization procedure that performes hill climbing.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final HillClimbing createHillClimber(int pop,
 | 
			
		||||
	    AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			AbstractOptimizationProblem problem,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
 | 
			
		||||
@@ -405,14 +418,15 @@ public class OptimizerFactory {
 | 
			
		||||
	 * fitnesscalls.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param popsize
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return An optimization procedure that performes the random walk.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final MonteCarloSearch createMonteCarlo(
 | 
			
		||||
	    AbstractOptimizationProblem problem,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
			AbstractOptimizationProblem problem, int popsize,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
		AbstractEAIndividual tmpIndi = problem.getIndividualTemplate();
 | 
			
		||||
		tmpIndi.setMutationOperator(new NoMutation());
 | 
			
		||||
		tmpIndi.setMutationProbability(0);
 | 
			
		||||
@@ -420,6 +434,7 @@ public class OptimizerFactory {
 | 
			
		||||
		tmpIndi.setCrossoverProbability(0);
 | 
			
		||||
 | 
			
		||||
		MonteCarloSearch mc = new MonteCarloSearch();
 | 
			
		||||
		mc.getPopulation().setPopulationSize(popsize);
 | 
			
		||||
		mc.addPopulationChangedEventListener(listener);
 | 
			
		||||
		mc.SetProblem(problem);
 | 
			
		||||
		mc.init();
 | 
			
		||||
@@ -442,9 +457,10 @@ public class OptimizerFactory {
 | 
			
		||||
	 *         optimization.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final ParticleSwarmOptimization createParticleSwarmOptimization(
 | 
			
		||||
	    AbstractOptimizationProblem problem, int popsize, double phi1,
 | 
			
		||||
	    double phi2, double k, InterfacePopulationChangedEventListener listener,
 | 
			
		||||
	    int selectedTopology) {
 | 
			
		||||
			AbstractOptimizationProblem problem, int popsize, double phi1,
 | 
			
		||||
			double phi2, double k,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener,
 | 
			
		||||
			int selectedTopology) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
 | 
			
		||||
@@ -475,17 +491,17 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @param problem
 | 
			
		||||
	 * @param popsize
 | 
			
		||||
	 * @param alpha
 | 
			
		||||
	 *          The parameter for the linear cooling
 | 
			
		||||
	 *            The parameter for the linear cooling
 | 
			
		||||
	 * @param temperature
 | 
			
		||||
	 *          The initial temperature
 | 
			
		||||
	 *            The initial temperature
 | 
			
		||||
	 * @param mut
 | 
			
		||||
	 * @param listener
 | 
			
		||||
	 * @return Returns an optimizer that performs simulated annealing.
 | 
			
		||||
	 */
 | 
			
		||||
	public static final SimulatedAnnealing createSimulatedAnnealing(
 | 
			
		||||
	    AbstractOptimizationProblem problem, int popsize, double alpha,
 | 
			
		||||
	    double temperature, InterfaceMutation mut,
 | 
			
		||||
	    InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
			AbstractOptimizationProblem problem, int popsize, double alpha,
 | 
			
		||||
			double temperature, InterfaceMutation mut,
 | 
			
		||||
			InterfacePopulationChangedEventListener listener) {
 | 
			
		||||
 | 
			
		||||
		problem.initProblem();
 | 
			
		||||
 | 
			
		||||
@@ -508,7 +524,8 @@ public class OptimizerFactory {
 | 
			
		||||
 | 
			
		||||
	// /////////////////////////// Termination criteria
 | 
			
		||||
	public static InterfaceTerminator defaultTerminator() {
 | 
			
		||||
		if (term == null) term = new EvaluationTerminator(defaultFitCalls);
 | 
			
		||||
		if (term == null)
 | 
			
		||||
			term = new EvaluationTerminator(defaultFitCalls);
 | 
			
		||||
		return term;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -525,7 +542,7 @@ public class OptimizerFactory {
 | 
			
		||||
	// /////////////////////////// constructing a default OptimizerRunnable
 | 
			
		||||
 | 
			
		||||
	public static GOParameters getParams(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		switch (optType) {
 | 
			
		||||
		case STD_ES:
 | 
			
		||||
			return standardES(problem);
 | 
			
		||||
@@ -548,27 +565,31 @@ public class OptimizerFactory {
 | 
			
		||||
		case CL_HILLCL:
 | 
			
		||||
			return clusteringHillClimbing(problem);
 | 
			
		||||
		default:
 | 
			
		||||
			System.err.println("Error: optimizer type " + optType + " is unknown!");
 | 
			
		||||
			System.err.println("Error: optimizer type " + optType
 | 
			
		||||
					+ " is unknown!");
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static OptimizerRunnable getOptRunnable(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, int fitCalls, String outputFilePrefix) {
 | 
			
		||||
			AbstractOptimizationProblem problem, int fitCalls,
 | 
			
		||||
			String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable opt = null;
 | 
			
		||||
		GOParameters params = getParams(optType, problem);
 | 
			
		||||
		if (params != null) {
 | 
			
		||||
			opt = new OptimizerRunnable(params, outputFilePrefix);
 | 
			
		||||
			if (fitCalls != defaultFitCalls)
 | 
			
		||||
			  opt.getGOParams().setTerminator(new EvaluationTerminator(fitCalls));
 | 
			
		||||
				opt.getGOParams().setTerminator(
 | 
			
		||||
						new EvaluationTerminator(fitCalls));
 | 
			
		||||
		}
 | 
			
		||||
		return opt;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// /////////////////////////// constructing a default OptimizerRunnable
 | 
			
		||||
	public static OptimizerRunnable getOptRunnable(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		return getOptRunnable(optType, problem, defaultFitCalls, outputFilePrefix);
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		return getOptRunnable(optType, problem, defaultFitCalls,
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static InterfaceTerminator getTerminator() {
 | 
			
		||||
@@ -576,7 +597,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters hillClimbing(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		HillClimbing hc = new HillClimbing();
 | 
			
		||||
		hc.SetProblem(problem);
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
@@ -590,8 +611,9 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// /////////////////////// Creating default strategies
 | 
			
		||||
	public static GOParameters makeParams(InterfaceOptimizer opt, Population pop,
 | 
			
		||||
	    AbstractOptimizationProblem problem, long seed, InterfaceTerminator term) {
 | 
			
		||||
	public static GOParameters makeParams(InterfaceOptimizer opt,
 | 
			
		||||
			Population pop, AbstractOptimizationProblem problem, long seed,
 | 
			
		||||
			InterfaceTerminator term) {
 | 
			
		||||
		GOParameters params = new GOParameters();
 | 
			
		||||
		params.setProblem(problem);
 | 
			
		||||
		opt.SetProblem(problem);
 | 
			
		||||
@@ -603,7 +625,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters monteCarlo(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		MonteCarloSearch mc = new MonteCarloSearch();
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
		pop.setPopulationSize(50);
 | 
			
		||||
@@ -613,12 +635,13 @@ public class OptimizerFactory {
 | 
			
		||||
 | 
			
		||||
	// TODO hier weiter kommentieren
 | 
			
		||||
	public static OptimizerRunnable optimize(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		return optimize(getOptRunnable(optType, problem, outputFilePrefix));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static OptimizerRunnable optimize(OptimizerRunnable runnable) {
 | 
			
		||||
		if (runnable == null) return null;
 | 
			
		||||
		if (runnable == null)
 | 
			
		||||
			return null;
 | 
			
		||||
		new Thread(runnable).run();
 | 
			
		||||
		lastRunnable = runnable;
 | 
			
		||||
		return runnable;
 | 
			
		||||
@@ -636,25 +659,27 @@ public class OptimizerFactory {
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public static OptimizerRunnable optimizeInThread(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = getOptRunnable(optType, problem,
 | 
			
		||||
		    outputFilePrefix);
 | 
			
		||||
		if (runnable != null) new Thread(runnable).start();
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
		if (runnable != null)
 | 
			
		||||
			new Thread(runnable).start();
 | 
			
		||||
		return runnable;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// ///////////////////////////// Optimize a given parameter instance
 | 
			
		||||
	public static BitSet optimizeToBinary(GOParameters params,
 | 
			
		||||
	    String outputFilePrefix) {
 | 
			
		||||
			String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,
 | 
			
		||||
		    outputFilePrefix));
 | 
			
		||||
				outputFilePrefix));
 | 
			
		||||
		return runnable.getBinarySolution();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// ///////////////////////////// Optimize using a default strategy
 | 
			
		||||
	public static BitSet optimizeToBinary(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem, outputFilePrefix);
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem,
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
		return (runnable != null) ? runnable.getBinarySolution() : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -665,15 +690,16 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static double[] optimizeToDouble(GOParameters params,
 | 
			
		||||
	    String outputFilePrefix) {
 | 
			
		||||
			String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,
 | 
			
		||||
		    outputFilePrefix));
 | 
			
		||||
				outputFilePrefix));
 | 
			
		||||
		return runnable.getDoubleSolution();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static double[] optimizeToDouble(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem, outputFilePrefix);
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem,
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
		return (runnable != null) ? runnable.getDoubleSolution() : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -683,15 +709,16 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static IndividualInterface optimizeToInd(GOParameters params,
 | 
			
		||||
	    String outputFilePrefix) {
 | 
			
		||||
			String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,
 | 
			
		||||
		    outputFilePrefix));
 | 
			
		||||
				outputFilePrefix));
 | 
			
		||||
		return runnable.getResult();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static IndividualInterface optimizeToInd(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem, outputFilePrefix);
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem,
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
		return (runnable != null) ? runnable.getResult() : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -701,15 +728,16 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Population optimizeToPop(GOParameters params,
 | 
			
		||||
	    String outputFilePrefix) {
 | 
			
		||||
			String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,
 | 
			
		||||
		    outputFilePrefix));
 | 
			
		||||
				outputFilePrefix));
 | 
			
		||||
		return runnable.getSolutionSet();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Population optimizeToPop(final int optType,
 | 
			
		||||
	    AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem, outputFilePrefix);
 | 
			
		||||
			AbstractOptimizationProblem problem, String outputFilePrefix) {
 | 
			
		||||
		OptimizerRunnable runnable = optimize(optType, problem,
 | 
			
		||||
				outputFilePrefix);
 | 
			
		||||
		return (runnable != null) ? runnable.getSolutionSet() : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -720,7 +748,7 @@ public class OptimizerFactory {
 | 
			
		||||
 | 
			
		||||
	public static Population postProcess(int steps, double sigma, int nBest) {
 | 
			
		||||
		return (lastRunnable == null) ? null : postProcess(lastRunnable,
 | 
			
		||||
		    new PostProcessParams(steps, sigma, nBest));
 | 
			
		||||
				new PostProcessParams(steps, sigma, nBest));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Population postProcess(InterfacePostProcessParams ppp) {
 | 
			
		||||
@@ -728,39 +756,42 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Population postProcess(OptimizerRunnable runnable, int steps,
 | 
			
		||||
	    double sigma, int nBest) {
 | 
			
		||||
			double sigma, int nBest) {
 | 
			
		||||
		PostProcessParams ppp = new PostProcessParams(steps, sigma, nBest);
 | 
			
		||||
		return postProcess(runnable, ppp);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Population postProcess(OptimizerRunnable runnable,
 | 
			
		||||
	    InterfacePostProcessParams ppp) {
 | 
			
		||||
			InterfacePostProcessParams ppp) {
 | 
			
		||||
		runnable.setDoRestart(true);
 | 
			
		||||
		runnable.setDoPostProcessOnly(true);
 | 
			
		||||
		runnable.setPostProcessingParams(ppp);
 | 
			
		||||
		runnable.run(); // this run will not set the lastRunnable - postProcessing
 | 
			
		||||
		runnable.run(); // this run will not set the lastRunnable -
 | 
			
		||||
						// postProcessing
 | 
			
		||||
		// starts always anew
 | 
			
		||||
		return runnable.getSolutionSet();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<BitSet> postProcessBinVec(int steps, double sigma,
 | 
			
		||||
	    int nBest) {
 | 
			
		||||
			int nBest) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessBinVec(lastRunnable,
 | 
			
		||||
		    new PostProcessParams(steps, sigma, nBest)) : null;
 | 
			
		||||
				new PostProcessParams(steps, sigma, nBest)) : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<BitSet> postProcessBinVec(InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessBinVec(lastRunnable, ppp) : null;
 | 
			
		||||
	public static Vector<BitSet> postProcessBinVec(
 | 
			
		||||
			InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessBinVec(lastRunnable, ppp)
 | 
			
		||||
				: null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<BitSet> postProcessBinVec(OptimizerRunnable runnable,
 | 
			
		||||
	    int steps, double sigma, int nBest) {
 | 
			
		||||
			int steps, double sigma, int nBest) {
 | 
			
		||||
		return postProcessBinVec(runnable, new PostProcessParams(steps, sigma,
 | 
			
		||||
		    nBest));
 | 
			
		||||
				nBest));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<BitSet> postProcessBinVec(OptimizerRunnable runnable,
 | 
			
		||||
	    InterfacePostProcessParams ppp) {
 | 
			
		||||
			InterfacePostProcessParams ppp) {
 | 
			
		||||
		Population resPop = postProcess(runnable, ppp);
 | 
			
		||||
		Vector<BitSet> ret = new Vector<BitSet>(resPop.size());
 | 
			
		||||
		for (Object o : resPop) {
 | 
			
		||||
@@ -773,24 +804,25 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(int steps, double sigma,
 | 
			
		||||
	    int nBest) {
 | 
			
		||||
			int nBest) {
 | 
			
		||||
		return (lastRunnable == null) ? null : postProcessDblVec(lastRunnable,
 | 
			
		||||
		    new PostProcessParams(steps, sigma, nBest));
 | 
			
		||||
				new PostProcessParams(steps, sigma, nBest));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(
 | 
			
		||||
	    InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessDblVec(lastRunnable, ppp) : null;
 | 
			
		||||
			InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessDblVec(lastRunnable, ppp)
 | 
			
		||||
				: null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(OptimizerRunnable runnable,
 | 
			
		||||
	    int steps, double sigma, int nBest) {
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(
 | 
			
		||||
			OptimizerRunnable runnable, int steps, double sigma, int nBest) {
 | 
			
		||||
		return postProcessDblVec(runnable, new PostProcessParams(steps, sigma,
 | 
			
		||||
		    nBest));
 | 
			
		||||
				nBest));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(OptimizerRunnable runnable,
 | 
			
		||||
	    InterfacePostProcessParams ppp) {
 | 
			
		||||
	public static Vector<double[]> postProcessDblVec(
 | 
			
		||||
			OptimizerRunnable runnable, InterfacePostProcessParams ppp) {
 | 
			
		||||
		Population resPop = postProcess(runnable, ppp);
 | 
			
		||||
		Vector<double[]> ret = new Vector<double[]>(resPop.size());
 | 
			
		||||
		for (Object o : resPop) {
 | 
			
		||||
@@ -803,28 +835,29 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<AbstractEAIndividual> postProcessIndVec(int steps,
 | 
			
		||||
	    double sigma, int nBest) {
 | 
			
		||||
			double sigma, int nBest) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessIndVec(lastRunnable,
 | 
			
		||||
		    new PostProcessParams(steps, sigma, nBest)) : null;
 | 
			
		||||
				new PostProcessParams(steps, sigma, nBest)) : null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<AbstractEAIndividual> postProcessIndVec(
 | 
			
		||||
	    InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessIndVec(lastRunnable, ppp) : null;
 | 
			
		||||
			InterfacePostProcessParams ppp) {
 | 
			
		||||
		return (lastRunnable != null) ? postProcessIndVec(lastRunnable, ppp)
 | 
			
		||||
				: null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// /////////////////////////// post processing
 | 
			
		||||
	public static Vector<AbstractEAIndividual> postProcessIndVec(
 | 
			
		||||
	    OptimizerRunnable runnable, int steps, double sigma, int nBest) {
 | 
			
		||||
			OptimizerRunnable runnable, int steps, double sigma, int nBest) {
 | 
			
		||||
		return postProcessIndVec(runnable, new PostProcessParams(steps, sigma,
 | 
			
		||||
		    nBest));
 | 
			
		||||
				nBest));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static Vector<AbstractEAIndividual> postProcessIndVec(
 | 
			
		||||
	    OptimizerRunnable runnable, InterfacePostProcessParams ppp) {
 | 
			
		||||
			OptimizerRunnable runnable, InterfacePostProcessParams ppp) {
 | 
			
		||||
		Population resPop = postProcess(runnable, ppp);
 | 
			
		||||
		Vector<AbstractEAIndividual> ret = new Vector<AbstractEAIndividual>(resPop
 | 
			
		||||
		    .size());
 | 
			
		||||
		Vector<AbstractEAIndividual> ret = new Vector<AbstractEAIndividual>(
 | 
			
		||||
				resPop.size());
 | 
			
		||||
		for (Object o : resPop) {
 | 
			
		||||
			if (o instanceof AbstractEAIndividual) {
 | 
			
		||||
				AbstractEAIndividual indy = (AbstractEAIndividual) o;
 | 
			
		||||
@@ -839,7 +872,8 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void setFitnessConvergenceTerminator(double fitThresh) {
 | 
			
		||||
		setTerminator(new FitnessConvergenceTerminator(fitThresh, 100, true, true));
 | 
			
		||||
		setTerminator(new FitnessConvergenceTerminator(fitThresh, 100, true,
 | 
			
		||||
				true));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void setTerminator(InterfaceTerminator term) {
 | 
			
		||||
@@ -854,11 +888,11 @@ public class OptimizerFactory {
 | 
			
		||||
	 */
 | 
			
		||||
	public static String showOptimizers() {
 | 
			
		||||
		return "1: Standard ES \n2: CMA-ES \n3: GA \n4: PSO \n5: DE \n6: Tribes \n7: Random (Monte Carlo) "
 | 
			
		||||
		    + "\n8: Hill-Climbing \n9: Cluster-based niching ES \n10: Clustering Hill-Climbing";
 | 
			
		||||
				+ "\n8: Hill-Climbing \n9: Cluster-based niching ES \n10: Clustering Hill-Climbing";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters standardDE(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		DifferentialEvolution de = new DifferentialEvolution();
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
		pop.setPopulationSize(50);
 | 
			
		||||
@@ -873,7 +907,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters standardES(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		EvolutionStrategies es = new EvolutionStrategies();
 | 
			
		||||
		es.setMu(15);
 | 
			
		||||
		es.setLambda(50);
 | 
			
		||||
@@ -887,7 +921,7 @@ public class OptimizerFactory {
 | 
			
		||||
			indy.setCrossoverOperator(new CrossoverESDefault());
 | 
			
		||||
		} else {
 | 
			
		||||
			System.err
 | 
			
		||||
			    .println("Error, standard ES is implemented for ES individuals only (requires double data types)");
 | 
			
		||||
					.println("Error, standard ES is implemented for ES individuals only (requires double data types)");
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -898,7 +932,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters standardGA(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		GeneticAlgorithm ga = new GeneticAlgorithm();
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
		pop.setPopulationSize(100);
 | 
			
		||||
@@ -909,7 +943,7 @@ public class OptimizerFactory {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static final GOParameters standardPSO(
 | 
			
		||||
	    AbstractOptimizationProblem problem) {
 | 
			
		||||
			AbstractOptimizationProblem problem) {
 | 
			
		||||
		ParticleSwarmOptimization pso = new ParticleSwarmOptimization();
 | 
			
		||||
		Population pop = new Population();
 | 
			
		||||
		pop.setPopulationSize(30);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										54
									
								
								src/eva2/server/go/problems/inference/des/DESSolver.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/eva2/server/go/problems/inference/des/DESSolver.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Title: JAVA-EVA Description: Copyright: Copyright (c) 2002 Company:
 | 
			
		||||
 * University of Tübingen, Computer Architecture
 | 
			
		||||
 *
 | 
			
		||||
 * @author
 | 
			
		||||
 * @version 1.0
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package eva2.server.go.problems.inference.des;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * TODO: comment missing
 | 
			
		||||
 *
 | 
			
		||||
 * @since 2.0
 | 
			
		||||
 * @version
 | 
			
		||||
 * Copyright (c) ZBiT, University of Tübingen, Germany
 | 
			
		||||
 * Compiler: JDK 1.6.0
 | 
			
		||||
 * @date Sep 10, 2007
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public interface DESSolver extends Serializable {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * put your documentation comment here
 | 
			
		||||
   *
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initalvalue
 | 
			
		||||
   * @param x
 | 
			
		||||
   * @param h
 | 
			
		||||
   * @param steps
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solve(DESystem DES, double[] initalvalue, double x,
 | 
			
		||||
      double h, int steps);
 | 
			
		||||
 | 
			
		||||
  public double[][] solveAtTimePoints(DESystem DES, double[] initialvalue,
 | 
			
		||||
      double[] timepoints);
 | 
			
		||||
 | 
			
		||||
  public double[][] solveAtTimePointsWithInitialConditions(DESystem DES,
 | 
			
		||||
      double[][] initconditions, double[] timepoints);
 | 
			
		||||
 | 
			
		||||
  public boolean isUnstable();
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * public double[][] solveatTimepointsSSystem (double[] param, int order,
 | 
			
		||||
   * double[] initialvalue, double[] timepoints); public boolean
 | 
			
		||||
   * lastDESystemInvalid(); public void plotY(); public double[][]
 | 
			
		||||
   * solveatTimepointsSSystemSeparated (double[] param, int order, double[]
 | 
			
		||||
   * initialvalue, double[] timepoints, GEdata gedata, int tooptimize);
 | 
			
		||||
   */
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								src/eva2/server/go/problems/inference/des/DESystem.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/eva2/server/go/problems/inference/des/DESystem.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
package eva2.server.go.problems.inference.des;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Title: JAVA-EVA Description: Copyright: Copyright (c) 2002 Company:
 | 
			
		||||
 * University of Tübingen, Computer Architecture
 | 
			
		||||
 *
 | 
			
		||||
 * @author Hannes Planatscher
 | 
			
		||||
 * @version 1.0
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public interface DESystem extends Serializable {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Returns the number of dimensions of this ODE system.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return Returns the number of dimensions of this ODE system.
 | 
			
		||||
	 */
 | 
			
		||||
	public int getDESystemDimension();
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Returns the value of the ODE system at the time t given the current
 | 
			
		||||
	 * values of Y
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param t
 | 
			
		||||
	 * @param Y
 | 
			
		||||
	 * @return
 | 
			
		||||
	 * @deprecated use getValue(double t, double[] Y, double[] res) to avoid
 | 
			
		||||
	 *             array reallocations and gain speed
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Returns the value of the ODE system at the time t given the current
 | 
			
		||||
	 * values of Y within resultVector.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param t
 | 
			
		||||
	 * @param Y
 | 
			
		||||
	 * @param resultVector
 | 
			
		||||
	 */
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] resultVector);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										419
									
								
								src/eva2/server/go/problems/inference/des/RKSolver.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										419
									
								
								src/eva2/server/go/problems/inference/des/RKSolver.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,419 @@
 | 
			
		||||
package eva2.server.go.problems.inference.des;
 | 
			
		||||
 | 
			
		||||
import eva2.tools.Mathematics;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Title: JAVA-EVA Description: Runge-Kutta Method Copyright: Copyright (c) 2002
 | 
			
		||||
 * Company: University of Tübingen, Computer Architecture
 | 
			
		||||
 *
 | 
			
		||||
 * @author Hannes Planatscher
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 * @author Marcel Kronfeld
 | 
			
		||||
 * @version 1.0 Status: works, but numerical inaccurate
 | 
			
		||||
 */
 | 
			
		||||
public class RKSolver implements DESSolver, java.io.Serializable {
 | 
			
		||||
  double                         stepSize    = 0.01;
 | 
			
		||||
  boolean                        nonnegative = true;
 | 
			
		||||
  boolean                        unstableFlag;
 | 
			
		||||
  transient protected double[][] kVals       = null;
 | 
			
		||||
  transient protected double[]   k0tmp, k1tmp, k2tmp;
 | 
			
		||||
  private static boolean useLinearCalc = true;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public RKSolver() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * A constructor.
 | 
			
		||||
   *
 | 
			
		||||
   * @param withLinearCalc set whether the linear or old calculation method will be used.
 | 
			
		||||
   */
 | 
			
		||||
  public RKSolver(boolean withLinearCalc) {
 | 
			
		||||
	  useLinearCalc = withLinearCalc;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  /**
 | 
			
		||||
   * put your documentation comment here
 | 
			
		||||
   */
 | 
			
		||||
  public RKSolver(double stepSize) {
 | 
			
		||||
    this.stepSize = stepSize;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  /**
 | 
			
		||||
   * Set whether the linear or old calculation method will be used.
 | 
			
		||||
   *
 | 
			
		||||
   * @param withLinearCalc
 | 
			
		||||
   */
 | 
			
		||||
  public void setWithLinearCalc(boolean withLinearCalc) {
 | 
			
		||||
	  useLinearCalc = withLinearCalc;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * put your documentation comment here
 | 
			
		||||
   *
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initialValues
 | 
			
		||||
   * @param x
 | 
			
		||||
   * @param h
 | 
			
		||||
   * @param steps
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solve(DESystem DES, double[] initialValues, double x,
 | 
			
		||||
      double h, int steps) {
 | 
			
		||||
    double[] timeVector = new double[steps];
 | 
			
		||||
    for (int i = 0; i < steps; i++)
 | 
			
		||||
      timeVector[i] = x + i * h;
 | 
			
		||||
    return solveAtTimePoints(DES, initialValues, timeVector);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initialValues
 | 
			
		||||
   * @param timeBegin
 | 
			
		||||
   * @param timeEnd
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solveByStepSize(DESystem DES, double[] initialValues,
 | 
			
		||||
      double timeBegin, double timeEnd) {
 | 
			
		||||
    return solveByStepSize(DES, initialValues, timeBegin, timeEnd, false);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initialValues
 | 
			
		||||
   * @param timeBegin
 | 
			
		||||
   * @param timeEnd
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solveByStepSizeIncludingTime(DESystem DES,
 | 
			
		||||
      double[] initialValues, double timeBegin, double timeEnd) {
 | 
			
		||||
    return solveByStepSize(DES, initialValues, timeBegin, timeEnd, true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initialValues
 | 
			
		||||
   * @param timeBegin
 | 
			
		||||
   * @param timeEnd
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  private double[][] solveByStepSize(DESystem DES, double[] initialValues,
 | 
			
		||||
      double timeBegin, double timeEnd, boolean time) {
 | 
			
		||||
    int numsteps = (int) Math.round(((timeEnd - timeBegin) / stepSize) + 1);
 | 
			
		||||
    unstableFlag = false;
 | 
			
		||||
    // System.out.println(numsteps);
 | 
			
		||||
    int order = DES.getDESystemDimension(), i;
 | 
			
		||||
    double[][] result;
 | 
			
		||||
    if (time) {
 | 
			
		||||
      result = new double[numsteps][order + 1];
 | 
			
		||||
      result[0][0] = timeBegin;
 | 
			
		||||
      for (i = 0; i < order; i++)
 | 
			
		||||
        result[0][i + 1] = initialValues[i];
 | 
			
		||||
    } else {
 | 
			
		||||
      result = new double[numsteps][order];
 | 
			
		||||
      for (i = 0; i < order; i++)
 | 
			
		||||
        result[0][i] = initialValues[i];
 | 
			
		||||
    }
 | 
			
		||||
    double x = timeBegin;
 | 
			
		||||
    for (i = 1; i < numsteps; i++) {
 | 
			
		||||
      double h = stepSize, change[] = null, Ytemp[] = null;
 | 
			
		||||
      if (time) {
 | 
			
		||||
        double tmp[] = new double[result[i - 1].length - 1];
 | 
			
		||||
        System.arraycopy(result[i - 1], 1, tmp, 0, result[i - 1].length - 1);
 | 
			
		||||
        change = rkTerm(DES, h, x, tmp);
 | 
			
		||||
        Ytemp = Mathematics.vvAdd(tmp, change);
 | 
			
		||||
      } else {
 | 
			
		||||
        change = rkTerm(DES, h, x, result[i - 1]);
 | 
			
		||||
        Ytemp = Mathematics.vvAdd(result[i - 1], change);
 | 
			
		||||
      }
 | 
			
		||||
      if (this.nonnegative) {
 | 
			
		||||
        for (int k = 0; k < Ytemp.length; k++) {
 | 
			
		||||
          if (Ytemp[k] < 0) Ytemp[k] = 0;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      x += h;
 | 
			
		||||
      if (time) {
 | 
			
		||||
        System.arraycopy(Ytemp, 0, result[i], 1, Ytemp.length);
 | 
			
		||||
        result[i][0] = x;
 | 
			
		||||
      } else result[i] = Ytemp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public double[][] solveAtTimePoints(DESystem DES, double[] initialValues,
 | 
			
		||||
      double[] timePoints) {
 | 
			
		||||
    return solveAtTimePoints(DES, initialValues, timePoints, false);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * This method returns a matrix in which the first column includes all time
 | 
			
		||||
   * points. Every row is composed as time and all values at this time point. It
 | 
			
		||||
   * uses the same integration method than the regular
 | 
			
		||||
   * <code>solveatTimepoints</code> method.
 | 
			
		||||
   *
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param initialValues
 | 
			
		||||
   * @param timePoints
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solveAtTimePointsIncludingTime(DESystem DES,
 | 
			
		||||
      double[] initialValues, double[] timePoints) {
 | 
			
		||||
    return solveAtTimePoints(DES, initialValues, timePoints, true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * When set to <code>TRUE</code>, <code>includeTimes</code> will make the
 | 
			
		||||
   * solver to return a matrix with the first column containing the times. By
 | 
			
		||||
   * default the result of the ODE solver just returns the values for Y.
 | 
			
		||||
   *
 | 
			
		||||
   * @param includeTimes
 | 
			
		||||
   */
 | 
			
		||||
  private double[][] solveAtTimePoints(DESystem DES, double[] initialValues,
 | 
			
		||||
      double[] timePoints, boolean includeTimes) {
 | 
			
		||||
    // sorted timepoints!!!!!!!!!!!!!!!!!!!!!
 | 
			
		||||
    int order = DES.getDESystemDimension();
 | 
			
		||||
    double result[][], x = timePoints[0];
 | 
			
		||||
    if (includeTimes) {
 | 
			
		||||
      result = new double[timePoints.length][order + 1];
 | 
			
		||||
      result[0][0] = timePoints[0];
 | 
			
		||||
      for (int i = 1; i <= order; i++)
 | 
			
		||||
        result[0][i] = initialValues[i - 1];
 | 
			
		||||
    } else {
 | 
			
		||||
      result = new double[timePoints.length][order];
 | 
			
		||||
      for (int i = 0; i < order; i++)
 | 
			
		||||
        result[0][i] = initialValues[i];
 | 
			
		||||
    }
 | 
			
		||||
    // System.out.println("JavaCalled");
 | 
			
		||||
    unstableFlag = false;
 | 
			
		||||
 | 
			
		||||
    double h = stepSize;
 | 
			
		||||
    double change[] = new double[order];
 | 
			
		||||
    double[] Ytemp = new double[order];
 | 
			
		||||
 | 
			
		||||
    for (int i = 1; i < timePoints.length; i++) {
 | 
			
		||||
      h = stepSize;
 | 
			
		||||
 | 
			
		||||
//       int inbetweensteps = (int) Math.round((timePoints[i] - timePoints[i -
 | 
			
		||||
//       1]) / h + 1);
 | 
			
		||||
      int inbetweensteps = (int) Math.floor((timePoints[i] - timePoints[i - 1])
 | 
			
		||||
          / h);
 | 
			
		||||
 | 
			
		||||
      //System.out.println("inbetweensteps at " + i + ": " + inbetweensteps);
 | 
			
		||||
      if (includeTimes)
 | 
			
		||||
        System.arraycopy(result[i - 1], 1, Ytemp, 0, result[i - 1].length - 1);
 | 
			
		||||
      else Ytemp = result[i - 1].clone();
 | 
			
		||||
 | 
			
		||||
      for (int j = 0; j < inbetweensteps; j++) {
 | 
			
		||||
          if (useLinearCalc) rkTerm2(DES, h, x, Ytemp, change);
 | 
			
		||||
          else change = rkTerm(DES, h, x, Ytemp);
 | 
			
		||||
//      	System.out.println("aft change 0 " + change[0]);
 | 
			
		||||
 | 
			
		||||
          Mathematics.vvAdd(Ytemp, change, Ytemp);
 | 
			
		||||
 | 
			
		||||
        if (this.nonnegative) {
 | 
			
		||||
          for (int k = 0; k < Ytemp.length; k++) {
 | 
			
		||||
            if (Ytemp[k] < 0) Ytemp[k] = 0;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        x += h;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      h = timePoints[i] - x;
 | 
			
		||||
 | 
			
		||||
      if (useLinearCalc) rkTerm2(DES, h, x, Ytemp, change);
 | 
			
		||||
      else change = rkTerm(DES, h, x, Ytemp);
 | 
			
		||||
 | 
			
		||||
      Mathematics.vvAdd(Ytemp, change, Ytemp);
 | 
			
		||||
 | 
			
		||||
      if (this.nonnegative) {
 | 
			
		||||
        for (int k = 0; k < Ytemp.length; k++) {
 | 
			
		||||
          if (Ytemp[k] < 0) Ytemp[k] = 0;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (includeTimes) {
 | 
			
		||||
        result[i][0] = timePoints[i];
 | 
			
		||||
        System.arraycopy(Ytemp, 0, result[i], 1, Ytemp.length);
 | 
			
		||||
      } else result[i] = Ytemp;
 | 
			
		||||
      x += h;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   */
 | 
			
		||||
  public double[][] solveAtTimePointsWithInitialConditions(DESystem DES,
 | 
			
		||||
      double[][] initConditions, double[] timePoints) {
 | 
			
		||||
    int order = DES.getDESystemDimension();
 | 
			
		||||
    double[][] result = new double[timePoints.length][order];
 | 
			
		||||
    result[0] = initConditions[0];
 | 
			
		||||
    double x = timePoints[0];
 | 
			
		||||
    for (int i = 1; i < timePoints.length; i++) {
 | 
			
		||||
      double h = stepSize;
 | 
			
		||||
      double[] Ytemp = new double[order];
 | 
			
		||||
      int inbetweensteps = (int) Math.floor((timePoints[i] - timePoints[i - 1])
 | 
			
		||||
          / h);
 | 
			
		||||
      Ytemp = (double[]) initConditions[i - 1].clone();
 | 
			
		||||
      for (int j = 0; j < inbetweensteps; j++) {
 | 
			
		||||
        double change[] = rkTerm(DES, h, x, Ytemp);
 | 
			
		||||
        Ytemp = Mathematics.vvAdd(Ytemp, change);
 | 
			
		||||
        x += h;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      h = timePoints[i] - x;
 | 
			
		||||
      double change[] = rkTerm(DES, h, x, Ytemp);
 | 
			
		||||
 | 
			
		||||
      Ytemp = Mathematics.vvAdd(Ytemp, change);
 | 
			
		||||
 | 
			
		||||
      if (this.nonnegative) {
 | 
			
		||||
        for (int k = 0; k < Ytemp.length; k++) {
 | 
			
		||||
          if (Ytemp[k] < 0) {
 | 
			
		||||
            Ytemp[k] = 0;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      result[i] = Ytemp;
 | 
			
		||||
      x += h;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param h
 | 
			
		||||
   * @param x
 | 
			
		||||
   * @param Ytemp
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double[] rkTerm(DESystem DES, double h, double x, double[] Ytemp) {
 | 
			
		||||
    double[][] K = new double[4][];
 | 
			
		||||
    K[0] = Mathematics.svMult(h, DES.getValue(x, Ytemp));
 | 
			
		||||
    K[1] = Mathematics.svMult(h, DES.getValue(x + h / 2, Mathematics.vvAdd(Ytemp, Mathematics.svMult(0.5, K[0]))));
 | 
			
		||||
    K[2] = Mathematics.svMult(h, DES.getValue(x + h / 2, Mathematics.vvAdd(Ytemp, Mathematics.svMult(0.5, K[1]))));
 | 
			
		||||
    K[3] = Mathematics.svMult(h, DES.getValue(x + h, Mathematics.vvAdd(Ytemp, K[2])));
 | 
			
		||||
    
 | 
			
		||||
    double[] change = Mathematics.svDiv(6, Mathematics.vvAdd(K[0], Mathematics.vvAdd(Mathematics.svMult(2, K[1]), Mathematics.vvAdd(Mathematics.svMult(
 | 
			
		||||
        2, K[2]), K[3]))));
 | 
			
		||||
    for (int k = 0; k < change.length; k++) {
 | 
			
		||||
      if (Double.isNaN(change[k])) {
 | 
			
		||||
        unstableFlag = true;
 | 
			
		||||
        change[k] = 0;
 | 
			
		||||
        // return result;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return change;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Linearized code for speed-up (no allocations).
 | 
			
		||||
   *
 | 
			
		||||
   * @param DES
 | 
			
		||||
   * @param h
 | 
			
		||||
   * @param x
 | 
			
		||||
   * @param Ytemp
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public void rkTerm2(DESystem DES, double h, double x, double[] Ytemp,
 | 
			
		||||
      double[] res) {
 | 
			
		||||
    if (kVals == null) { // "static" vectors which are allocated only once
 | 
			
		||||
      k0tmp = new double[DES.getDESystemDimension()];
 | 
			
		||||
      k1tmp = new double[DES.getDESystemDimension()];
 | 
			
		||||
      k2tmp = new double[DES.getDESystemDimension()];
 | 
			
		||||
      kVals = new double[4][DES.getDESystemDimension()];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
//    double[][] K = new double[4][];
 | 
			
		||||
    DES.getValue(x, Ytemp, kVals[0]);
 | 
			
		||||
    Mathematics.svMult(h, kVals[0], kVals[0]);
 | 
			
		||||
    
 | 
			
		||||
//    K[0] = svMult(h, DES.getValue(x, Ytemp));
 | 
			
		||||
 | 
			
		||||
    Mathematics.svMult(0.5, kVals[0], k0tmp);
 | 
			
		||||
    Mathematics.vvAdd(Ytemp, k0tmp, k0tmp);
 | 
			
		||||
    DES.getValue(x + h / 2, k0tmp, kVals[1]);
 | 
			
		||||
    Mathematics.svMult(h, kVals[1], kVals[1]);
 | 
			
		||||
    
 | 
			
		||||
//    K[1] = svMult(h, DES.getValue(x + h / 2, vvAdd(Ytemp, svMult(0.5, K[0]))));
 | 
			
		||||
 | 
			
		||||
    Mathematics.svMult(0.5, kVals[1], k1tmp);
 | 
			
		||||
    Mathematics.vvAdd(Ytemp, k1tmp, k1tmp);
 | 
			
		||||
    DES.getValue(x + h / 2, k1tmp, kVals[2]);
 | 
			
		||||
    Mathematics.svMult(h, kVals[2], kVals[2]);
 | 
			
		||||
    
 | 
			
		||||
//    K[2] = svMult(h, DES.getValue(x + h / 2, vvAdd(Ytemp, svMult(0.5, K[1]))));
 | 
			
		||||
 | 
			
		||||
    Mathematics.vvAdd(Ytemp, kVals[2], k2tmp);
 | 
			
		||||
    DES.getValue(x + h, k2tmp, k1tmp);
 | 
			
		||||
    Mathematics.svMult(h, k1tmp, kVals[3]);
 | 
			
		||||
    
 | 
			
		||||
//    K[3] = svMult(h, DES.getValue(x + h, vvAdd(Ytemp, K[2])));
 | 
			
		||||
    
 | 
			
		||||
    Mathematics.svMult(2, kVals[2], k0tmp);
 | 
			
		||||
    Mathematics.vvAdd(k0tmp, kVals[3], k0tmp);
 | 
			
		||||
 | 
			
		||||
    Mathematics.svMult(2, kVals[1], k1tmp);
 | 
			
		||||
    Mathematics.vvAdd(k1tmp, k0tmp, k2tmp);
 | 
			
		||||
 | 
			
		||||
    Mathematics.vvAdd(kVals[0], k2tmp, k1tmp);
 | 
			
		||||
    Mathematics.svDiv(6, k1tmp, res);
 | 
			
		||||
 | 
			
		||||
//    double[] change = svDiv(6, vvAdd(K[0], vvAdd(svMult(2, K[1]), vvAdd(svMult(2, K[2]), K[3]))));
 | 
			
		||||
//    for (int i=0; i<res.length; i++) {
 | 
			
		||||
//    	double diff = Math.abs(res[i]-change[i]);
 | 
			
		||||
//    	if (diff > 0.00000001) System.out.println("!!! ");
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    // double[] change = svdiv(6, vvadd(kVals[0], vvadd(svmult(2, kVals[1]),
 | 
			
		||||
    // vvadd(svmult(2, kVals[2]), kVals[3]))));
 | 
			
		||||
    for (int k = 0; k < res.length; k++) {
 | 
			
		||||
      if (Double.isNaN(res[k])) {
 | 
			
		||||
        unstableFlag = true;
 | 
			
		||||
        res[k] = 0;
 | 
			
		||||
        // return result;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static void main(String args[]) {
 | 
			
		||||
    new RKSolver(0.01);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public boolean isUnstable() {
 | 
			
		||||
    return unstableFlag;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param unstableFlag
 | 
			
		||||
   */
 | 
			
		||||
  public void setUnstableFlag(boolean unstableFlag) {
 | 
			
		||||
    this.unstableFlag = unstableFlag;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @return
 | 
			
		||||
   */
 | 
			
		||||
  public double getStepSize() {
 | 
			
		||||
    return stepSize;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param stepSize
 | 
			
		||||
   */
 | 
			
		||||
  public void setStepSize(double stepSize) {
 | 
			
		||||
    this.stepSize = stepSize;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,303 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.LinkedList;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.individuals.ESIndividualDoubleData;
 | 
			
		||||
import eva2.server.go.individuals.InterfaceDataTypeDouble;
 | 
			
		||||
import eva2.server.go.problems.AbstractOptimizationProblem;
 | 
			
		||||
import eva2.server.go.problems.InterfaceHasInitRange;
 | 
			
		||||
import eva2.server.go.problems.inference.des.RKSolver;
 | 
			
		||||
import eva2.tools.Mathematics;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class provides a collection of methods to compare two curves one against
 | 
			
		||||
 * the other and to optimize the parameters of a model to be fitted as close as
 | 
			
		||||
 * possible to given measurements.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 * @date Sept. 18 2006
 | 
			
		||||
 */
 | 
			
		||||
public abstract class AbstractCurveFittingProblem extends
 | 
			
		||||
		AbstractOptimizationProblem implements InterfaceHasInitRange,
 | 
			
		||||
		Serializable {
 | 
			
		||||
 | 
			
		||||
	protected AbstractEAIndividual best = null;
 | 
			
		||||
 | 
			
		||||
	protected LinkedList<String> metabolites;
 | 
			
		||||
 | 
			
		||||
	protected TimeSeries timeSeries;
 | 
			
		||||
 | 
			
		||||
	protected double xOffSet, noise, yOffSet;
 | 
			
		||||
 | 
			
		||||
	protected int m_ProblemDimension;
 | 
			
		||||
 | 
			
		||||
	protected double t0, t1;
 | 
			
		||||
 | 
			
		||||
	protected RKSolver solver;
 | 
			
		||||
 | 
			
		||||
	protected boolean monteCarlo = false;
 | 
			
		||||
 | 
			
		||||
	protected double[][] initRange;
 | 
			
		||||
 | 
			
		||||
	public AbstractCurveFittingProblem() {
 | 
			
		||||
		m_Template = new ESIndividualDoubleData();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setIndividualTemplate(AbstractEAIndividual indy) {
 | 
			
		||||
		m_Template = indy;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method allows you to swich to an initialization that is completely
 | 
			
		||||
	 * by chance instead of a certain more sophisticated initialization
 | 
			
		||||
	 * procedure.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param mc
 | 
			
		||||
	 *            If true, a Monte Carlo initialization will be performed. Else
 | 
			
		||||
	 *            another possibly more sophisticated procedure will be started.
 | 
			
		||||
	 */
 | 
			
		||||
	public void setMonteCarloInitialization(boolean mc) {
 | 
			
		||||
		this.monteCarlo = mc;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param individual
 | 
			
		||||
	 */
 | 
			
		||||
	public void evaluate(AbstractEAIndividual individual) {
 | 
			
		||||
		double fitness[] = this
 | 
			
		||||
				.doEvaluation(((InterfaceDataTypeDouble) individual)
 | 
			
		||||
						.getDoubleData());
 | 
			
		||||
		individual.SetFitness(fitness);
 | 
			
		||||
		if (this.best == null) {
 | 
			
		||||
			this.best = (AbstractEAIndividual) individual.clone();
 | 
			
		||||
		} else if (this.best.getFitness(0) > individual.getFitness(0)) {
 | 
			
		||||
			this.best = (AbstractEAIndividual) individual.clone();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param x
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] doEvaluation(double[] x) {
 | 
			
		||||
		double freturn[] = new double[1], fitness = 0;
 | 
			
		||||
		double[][] result = model(x);
 | 
			
		||||
 | 
			
		||||
		if (result == null) {
 | 
			
		||||
			freturn[0] = Double.MAX_VALUE;
 | 
			
		||||
			return freturn;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		freturn[0] = 0;
 | 
			
		||||
		if (this.solver != null)
 | 
			
		||||
			if (this.solver.isUnstable()) {
 | 
			
		||||
				freturn[0] += 10000;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		// for all metabolites
 | 
			
		||||
		for (int i = 0; (i < metabolites.size())
 | 
			
		||||
				&& (freturn[0] < Double.MAX_VALUE); i++)
 | 
			
		||||
			try {
 | 
			
		||||
				/*
 | 
			
		||||
				 * Metabolites, which have not been considered in the
 | 
			
		||||
				 * measurements should also be able to be simulated. They
 | 
			
		||||
				 * shouldn't contribute to the overall fitness.
 | 
			
		||||
				 */
 | 
			
		||||
				if (!timeSeries.containsMetabolite(metabolites.get(i)
 | 
			
		||||
						.toString())
 | 
			
		||||
						|| (timeSeries.numberOfMeasurements(metabolites.get(i)
 | 
			
		||||
								.toString()) == 0))
 | 
			
		||||
					continue;
 | 
			
		||||
 | 
			
		||||
				double[] times = this.timeSeries.getTimes(this.metabolites.get(
 | 
			
		||||
						i).toString()), values = this.timeSeries
 | 
			
		||||
						.getValues(this.metabolites.get(i).toString()), mvalue = new double[times.length];
 | 
			
		||||
				// model
 | 
			
		||||
				// values
 | 
			
		||||
 | 
			
		||||
				// tests:
 | 
			
		||||
				// boolean name = false;
 | 
			
		||||
				// for all measured times for the current metabolite
 | 
			
		||||
				for (int j = 0, min = 0, max = result.length - 1; j < times.length; j++) {
 | 
			
		||||
					/*
 | 
			
		||||
					 * This happens, if the parameters are that bad that the
 | 
			
		||||
					 * model function doesn't even produce sensefull values.
 | 
			
		||||
					 */
 | 
			
		||||
					if (result[result.length - 1][0] < times[j]) {
 | 
			
		||||
						mvalue[j] = Math.max(10000, 10000 * values[j]);
 | 
			
		||||
						continue;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (times[j] != result[j][0]) {
 | 
			
		||||
						/*
 | 
			
		||||
						 * Seek the right time value from the model with an
 | 
			
		||||
						 * approach in logarithmic time. The variables min and
 | 
			
		||||
						 * max have been defined as an additional start
 | 
			
		||||
						 * condition of the for loop.
 | 
			
		||||
						 */
 | 
			
		||||
						int t = Math.round((max + min) / 2), t_old = t;
 | 
			
		||||
						do {
 | 
			
		||||
							t_old = t;
 | 
			
		||||
							if (result[t][0] < times[j]) {
 | 
			
		||||
								if (t < max)
 | 
			
		||||
									min = t + 1;
 | 
			
		||||
								else
 | 
			
		||||
									min = t;
 | 
			
		||||
							} else if (result[t][0] > times[j]) {
 | 
			
		||||
								if (t > min)
 | 
			
		||||
									max = t - 1;
 | 
			
		||||
								else
 | 
			
		||||
									max = t;
 | 
			
		||||
							} else
 | 
			
		||||
								break;
 | 
			
		||||
							t = Math.round((max + min) / 2);
 | 
			
		||||
						} while (t != t_old);
 | 
			
		||||
						/*
 | 
			
		||||
						 * Set min and max for the search of the next time
 | 
			
		||||
						 * (measured times are assumed to be ordered).
 | 
			
		||||
						 */
 | 
			
		||||
						min = t;
 | 
			
		||||
						max = result.length - 1;
 | 
			
		||||
 | 
			
		||||
						/*
 | 
			
		||||
						 * The model value for the i-th metabolite at time j is
 | 
			
		||||
						 * given by result[t][i+1] because the first column of
 | 
			
		||||
						 * result is the time.
 | 
			
		||||
						 */
 | 
			
		||||
						mvalue[j] = result[t][i + 1];
 | 
			
		||||
 | 
			
		||||
						/*
 | 
			
		||||
						 * These steps are necessary if the resulting model
 | 
			
		||||
						 * contains more than one value for one time step. In
 | 
			
		||||
						 * this case for the fitness the model value with the
 | 
			
		||||
						 * greatest distance to the measured value should be
 | 
			
		||||
						 * considered.
 | 
			
		||||
						 */
 | 
			
		||||
						int up = t, down = t;
 | 
			
		||||
						while (up < result.length - 1)
 | 
			
		||||
							if (result[up][0] == result[up + 1][0])
 | 
			
		||||
								up++;
 | 
			
		||||
							else
 | 
			
		||||
								break;
 | 
			
		||||
						while (down > 0)
 | 
			
		||||
							if (result[down][0] == result[down - 1][0])
 | 
			
		||||
								down--;
 | 
			
		||||
							else
 | 
			
		||||
								break;
 | 
			
		||||
						if (up != down)
 | 
			
		||||
							for (int k = down; k < up; k++)
 | 
			
		||||
								if (Math.abs(result[k][i + 1] - values[j]) > Math
 | 
			
		||||
										.abs(mvalue[j] - values[j]))
 | 
			
		||||
									mvalue[j] = result[k][i + 1];
 | 
			
		||||
 | 
			
		||||
						if ((result[t][0] > times[j]) && (t > 0)) {
 | 
			
		||||
							if (result[t - 1][0] < times[j]) {
 | 
			
		||||
								/*
 | 
			
		||||
								 * if (!name) {
 | 
			
		||||
								 * System.out.println(metabolites.get(i)+":");
 | 
			
		||||
								 * name=true; } System.out.println(
 | 
			
		||||
								 * result[t-1][0]+" = result["+(t-1)+"][0] <
 | 
			
		||||
								 * times["+j+"] = "+times[j]+" & "
 | 
			
		||||
								 * +result[t][0]+" = result["+t+"][0] >
 | 
			
		||||
								 * times["+j+"] = "+times[j]);//
 | 
			
		||||
								 */
 | 
			
		||||
								mvalue[j] = Mathematics.linearInterpolation(
 | 
			
		||||
										times[j], result[t - 1][0],
 | 
			
		||||
										result[t][0], result[t - 1][i + 1],
 | 
			
		||||
										mvalue[j]);
 | 
			
		||||
							} // otherwise we don't want to interpolate with
 | 
			
		||||
							// the value before
 | 
			
		||||
							// down.
 | 
			
		||||
						} else if ((result[t][0] < times[j])
 | 
			
		||||
								&& (t < result.length - 1)) {
 | 
			
		||||
							if (result[t + 1][0] > times[j]) {
 | 
			
		||||
								mvalue[j] = Mathematics.linearInterpolation(
 | 
			
		||||
										times[j], result[t][0],
 | 
			
		||||
										result[t + 1][0], mvalue[j],
 | 
			
		||||
										result[t + 1][i + 1]);
 | 
			
		||||
							} /*
 | 
			
		||||
								 * we don't want to interpolate with the value
 | 
			
		||||
								 * after up. This would propably smooth the
 | 
			
		||||
								 * error function.
 | 
			
		||||
								 */
 | 
			
		||||
						}
 | 
			
		||||
						/*
 | 
			
		||||
						 * We are lucky: the model already contains this time
 | 
			
		||||
						 * point. So we just need to use the given model value.
 | 
			
		||||
						 */
 | 
			
		||||
					} else {
 | 
			
		||||
						mvalue[j] = result[j][i + 1];
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					/*
 | 
			
		||||
					 * This also happens with bad parameter values. Give a heavy
 | 
			
		||||
					 * weight to the current metabolite.
 | 
			
		||||
					 */
 | 
			
		||||
					if ((mvalue[j] == Double.NaN) || (mvalue[j] < 0))
 | 
			
		||||
						mvalue[j] = Math.max(10000, 10000 * values[j]);
 | 
			
		||||
				} // end for all times
 | 
			
		||||
 | 
			
		||||
				// average distance over all times
 | 
			
		||||
				/*
 | 
			
		||||
				 * fitness = Mathematics.dist(mvalue, values, 2)/times.length;
 | 
			
		||||
				 * freturn[0] += fitness;//
 | 
			
		||||
				 */
 | 
			
		||||
 | 
			
		||||
				// fitness = Mathematics.dist(mvalue, values, 2);
 | 
			
		||||
				fitness = Mathematics.relDist(mvalue, values, 10000);
 | 
			
		||||
				System.out.println(metabolites.get(i) + "\t" + fitness);
 | 
			
		||||
 | 
			
		||||
				if (!Double.isNaN(fitness) && !Double.isInfinite(fitness)) {
 | 
			
		||||
					freturn[0] += fitness;
 | 
			
		||||
				} else
 | 
			
		||||
					freturn[0] += 99999999999999999.; // TODO this should be
 | 
			
		||||
				// managed
 | 
			
		||||
				// differently?
 | 
			
		||||
 | 
			
		||||
			} catch (Exception exc) {
 | 
			
		||||
				exc.printStackTrace();
 | 
			
		||||
			}
 | 
			
		||||
		if (Double.isInfinite(freturn[0])
 | 
			
		||||
				|| (freturn[0] > 99999999999999999999.))
 | 
			
		||||
			freturn[0] = 99999999999999999999.;
 | 
			
		||||
		return freturn;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method returns the best individual of the complete optimization
 | 
			
		||||
	 * process, which is not neccessarily identical to the best individual of
 | 
			
		||||
	 * the final population.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return best The best Individual of the complete optimization process
 | 
			
		||||
	 */
 | 
			
		||||
	public AbstractEAIndividual getOverallBestIndividual() {
 | 
			
		||||
		return this.best;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Computes the differential equation describing the decrease or increase of
 | 
			
		||||
	 * the current metabolite in the metabolic network.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param x
 | 
			
		||||
	 *            The current parameters of the differential equation describing
 | 
			
		||||
	 *            the metabolic network.
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	public abstract double[][] model(double[] x);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public int getProblemDimension() {
 | 
			
		||||
		return m_ProblemDimension;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public double[][] getInitRange() {
 | 
			
		||||
		return initRange;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void SetInitRange(double[][] initRange) {
 | 
			
		||||
		this.initRange = initRange;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,195 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.LinkedList;
 | 
			
		||||
 | 
			
		||||
import wsi.ra.math.RNG;
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.individuals.ESIndividualDoubleData;
 | 
			
		||||
import eva2.server.go.individuals.InterfaceDataTypeDouble;
 | 
			
		||||
import eva2.server.go.populations.Population;
 | 
			
		||||
import eva2.server.go.problems.inference.des.RKSolver;
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.AbstractValineSystem;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Super class for many simulation problems of the valine and leucine reaction
 | 
			
		||||
 * network in C. glutamicum.
 | 
			
		||||
 *
 | 
			
		||||
 * @since 2.0
 | 
			
		||||
 * @version
 | 
			
		||||
 * @author Andreas Dräger (draeger) <andreas.draeger@uni-tuebingen.de>
 | 
			
		||||
 *         Copyright (c) ZBiT, University of Tübingen, Germany Compiler:
 | 
			
		||||
 *         JDK 1.6.0
 | 
			
		||||
 * @date Sep 6, 2007
 | 
			
		||||
 */
 | 
			
		||||
public abstract class AbstractValineCurveFittingProblem extends
 | 
			
		||||
		AbstractCurveFittingProblem implements Serializable {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Start values for: DHIV, IPM, AcLac, Val, Leu, KIV, KIC in this order.
 | 
			
		||||
	 */
 | 
			
		||||
	protected final double[] y = { 0.132, 0.0227, 0.236, 29.4, 0.209, 13.1,
 | 
			
		||||
			0.0741 };
 | 
			
		||||
 | 
			
		||||
	protected AbstractValineSystem system;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -194867821991525140L;
 | 
			
		||||
 | 
			
		||||
	public AbstractValineCurveFittingProblem(
 | 
			
		||||
			AbstractValineCurveFittingProblem avcfp) {
 | 
			
		||||
		if (avcfp.m_Template != null)
 | 
			
		||||
			this.m_Template = (AbstractEAIndividual) ((AbstractEAIndividual) avcfp.m_Template)
 | 
			
		||||
					.clone();
 | 
			
		||||
		this.system = avcfp.system;
 | 
			
		||||
		this.m_ProblemDimension = this.system.getNumberOfParameters();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default constructor for simulation of the valine data.
 | 
			
		||||
	 */
 | 
			
		||||
	public AbstractValineCurveFittingProblem(AbstractValineSystem system) {
 | 
			
		||||
		this.solver = new RKSolver(.01);
 | 
			
		||||
		this.system = system;
 | 
			
		||||
		this.m_ProblemDimension = system.getNumberOfParameters();
 | 
			
		||||
		solver.setWithLinearCalc(false);
 | 
			
		||||
		m_Template = new ESIndividualDoubleData();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.OptimizationProblems.AbstractOptimizationProblem#initProblem()
 | 
			
		||||
	 */
 | 
			
		||||
	public void initProblem() {
 | 
			
		||||
		this.best = null;
 | 
			
		||||
		this.metabolites = new LinkedList<String>();
 | 
			
		||||
 | 
			
		||||
		this.timeSeries = new TimeSeries();
 | 
			
		||||
 | 
			
		||||
		// this.metabolites.add("PYR"); // 46
 | 
			
		||||
		// this.metabolites.add("AKG"); // 47
 | 
			
		||||
		// this.metabolites.add("ALA"); // 47
 | 
			
		||||
		// this.metabolites.add("NAD"); // 47
 | 
			
		||||
		this.metabolites.add("DHIV"); // 44
 | 
			
		||||
		// this.metabolites.add("nadp"); // 45
 | 
			
		||||
		// this.metabolites.add("Glut"); // 47
 | 
			
		||||
		this.metabolites.add("2IPM"); // 45
 | 
			
		||||
		this.metabolites.add("AcLac"); // 40
 | 
			
		||||
		this.metabolites.add("Val"); // 46
 | 
			
		||||
		this.metabolites.add("Leu"); // 47
 | 
			
		||||
		this.metabolites.add("KIV"); // 47
 | 
			
		||||
		this.metabolites.add("KIC"); // 47
 | 
			
		||||
 | 
			
		||||
		this.t0 = -3.894;
 | 
			
		||||
		this.t1 = 20.643;
 | 
			
		||||
 | 
			
		||||
		this.xOffSet = RNG.gaussianDouble(0.1);
 | 
			
		||||
		this.yOffSet = RNG.gaussianDouble(0.1);
 | 
			
		||||
		this.noise = RNG.gaussianDouble(0.1);
 | 
			
		||||
		initRange = new double[m_ProblemDimension][2];
 | 
			
		||||
		for (int i = 0; i < initRange.length; i++) {
 | 
			
		||||
			initRange[i][0] = 0;
 | 
			
		||||
			initRange[i][1] = 2;
 | 
			
		||||
		}
 | 
			
		||||
		this.SetInitRange(initRange);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void initPopulation(Population population) {
 | 
			
		||||
		int i;
 | 
			
		||||
		AbstractEAIndividual tmpIndy;
 | 
			
		||||
 | 
			
		||||
		best = null;
 | 
			
		||||
		population.clear();
 | 
			
		||||
 | 
			
		||||
		((InterfaceDataTypeDouble) m_Template)
 | 
			
		||||
				.setDoubleDataLength(initRange.length);
 | 
			
		||||
 | 
			
		||||
		// set the range
 | 
			
		||||
		double[][] range = getParameterRanges();
 | 
			
		||||
		((InterfaceDataTypeDouble) m_Template).SetDoubleRange(range);
 | 
			
		||||
 | 
			
		||||
		// for (i = 0; i < population.getPopulationSize(); i++) {
 | 
			
		||||
		Population tmpPop = new Population();
 | 
			
		||||
		if (population.getPopulationSize() < 250)
 | 
			
		||||
			tmpPop.setPopulationSize(250);
 | 
			
		||||
		else
 | 
			
		||||
			tmpPop.setPopulationSize(population.getPopulationSize());
 | 
			
		||||
		for (i = 0; i < tmpPop.getPopulationSize(); i++) {
 | 
			
		||||
			tmpIndy = (AbstractEAIndividual) ((AbstractEAIndividual) m_Template)
 | 
			
		||||
					.clone();
 | 
			
		||||
			// tmpIndy.init(this);
 | 
			
		||||
 | 
			
		||||
			// ////// B E G I N N ///////////////
 | 
			
		||||
			int j;
 | 
			
		||||
			double params[] = new double[m_ProblemDimension];
 | 
			
		||||
 | 
			
		||||
			for (j = 0; j < params.length; j++) {
 | 
			
		||||
				if (monteCarlo)
 | 
			
		||||
					params[j] = RNG.randomDouble(range[j][0], range[j][1]);
 | 
			
		||||
				else
 | 
			
		||||
					params[j] = RNG.gaussianDouble(1) + 1;
 | 
			
		||||
				if (params[j] < range[j][0]) {
 | 
			
		||||
					params[j] = range[j][0];
 | 
			
		||||
				}
 | 
			
		||||
				if (params[j] > range[j][1]) {
 | 
			
		||||
					params[j] = range[j][1];
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			tmpIndy.initByValue(params, this);
 | 
			
		||||
			// ////////E N D E /////////////////
 | 
			
		||||
 | 
			
		||||
			tmpPop.add(tmpIndy);
 | 
			
		||||
			// population.add(tmpIndy);
 | 
			
		||||
 | 
			
		||||
			// /////// B E G I N N //////////////
 | 
			
		||||
			((InterfaceDataTypeDouble) tmpIndy).SetDoublePhenotype(params);
 | 
			
		||||
			tmpIndy.resetConstraintViolation();
 | 
			
		||||
			params = ((InterfaceDataTypeDouble) tmpIndy).getDoubleData();
 | 
			
		||||
			for (j = 0; j < params.length; j++)
 | 
			
		||||
				if ((params[j] < ((InterfaceDataTypeDouble) m_Template)
 | 
			
		||||
						.getDoubleRange()[j][0])
 | 
			
		||||
						|| (params[j] > ((InterfaceDataTypeDouble) m_Template)
 | 
			
		||||
								.getDoubleRange()[j][1]))
 | 
			
		||||
					System.out.println("Verletzung!\t" + params[j]);// */
 | 
			
		||||
			if (tmpIndy.violatesConstraint())
 | 
			
		||||
				System.out.println("Constraint violation: "
 | 
			
		||||
						+ tmpIndy.getConstraintViolation());
 | 
			
		||||
			// ////// E N D E /////////////////
 | 
			
		||||
		}
 | 
			
		||||
		tmpPop.init();
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < population.getPopulationSize(); i++)
 | 
			
		||||
			population.add(tmpPop.remove(tmpPop.getIndexOfBestIndividual()));
 | 
			
		||||
		population.init();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * This method returns a matrix whose number of lines equals the number of
 | 
			
		||||
	 * parameters and which has two columns. In each line of this matrix the
 | 
			
		||||
	 * lower and the upper bound for the corresponding parameter are defined.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	protected abstract double[][] getParameterRanges();
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see simulation.AbstractCurveFittingProblem#model(double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[][] model(double[] x) {
 | 
			
		||||
		try {
 | 
			
		||||
			system.setParameters(x);
 | 
			
		||||
			return solver.solveAtTimePointsIncludingTime(system, y,
 | 
			
		||||
					this.timeSeries.getTimes());
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.individuals.AbstractEAIndividual;
 | 
			
		||||
import eva2.server.go.individuals.InterfaceDataTypeDouble;
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.AbstractValineSystem;
 | 
			
		||||
 | 
			
		||||
// Created at 2007-01-23
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public abstract class AbstractValineSplineFittingProblem extends
 | 
			
		||||
		AbstractValineCurveFittingProblem implements Serializable {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default Serial Verison ID
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Constructor
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param s
 | 
			
		||||
	 */
 | 
			
		||||
	public AbstractValineSplineFittingProblem(AbstractValineSystem s) {
 | 
			
		||||
		super(s);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public AbstractValineSplineFittingProblem(GMAKiProblem problem) {
 | 
			
		||||
		super(problem);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void evaluate(AbstractEAIndividual individual) {
 | 
			
		||||
		double fitness[] = new double[] { 0 }, result[][] = model(((InterfaceDataTypeDouble) individual)
 | 
			
		||||
				.getDoubleData());
 | 
			
		||||
 | 
			
		||||
		if (result == null) {
 | 
			
		||||
			fitness[0] = Double.MAX_VALUE;
 | 
			
		||||
		} else {
 | 
			
		||||
 | 
			
		||||
			if (solver != null)
 | 
			
		||||
				if (solver.isUnstable()) {
 | 
			
		||||
					fitness[0] += 10000;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			for (int i = 0; i < result.length; i++) { // for all times
 | 
			
		||||
				double spline[] = new double[] { // get the spline values at
 | 
			
		||||
						// the
 | 
			
		||||
						// current time point.
 | 
			
		||||
						system.getDHIV(result[i][0]),
 | 
			
		||||
						system.getIPM(result[i][0]),
 | 
			
		||||
						system.getAcLac(result[i][0]),
 | 
			
		||||
						system.getVal(result[i][0]),
 | 
			
		||||
						system.getLeu(result[i][0]),
 | 
			
		||||
						system.getKIV(result[i][0]),
 | 
			
		||||
						system.getKIC(result[i][0]) };
 | 
			
		||||
				for (int j = 1; j < result[i].length
 | 
			
		||||
						&& (fitness[0] < Double.MAX_VALUE); j++)
 | 
			
		||||
					// for all metabolites
 | 
			
		||||
					if (spline[j - 1] != 0)
 | 
			
		||||
						fitness[0] += Math
 | 
			
		||||
								.pow(
 | 
			
		||||
										((result[i][j] - spline[j - 1]) / spline[j - 1]),
 | 
			
		||||
										2);
 | 
			
		||||
					else
 | 
			
		||||
						fitness[0] += 10000;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		individual.SetFitness(fitness);
 | 
			
		||||
		if (this.best == null) {
 | 
			
		||||
			this.best = (AbstractEAIndividual) individual.clone();
 | 
			
		||||
		} else if (this.best.getFitness(0) > individual.getFitness(0)) {
 | 
			
		||||
			this.best = (AbstractEAIndividual) individual.clone();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.CKMMiSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created at 2007-02-04
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class CKMMiProblem extends AbstractValineCurveFittingProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 3459101339325025847L;
 | 
			
		||||
 | 
			
		||||
	public CKMMiProblem() {
 | 
			
		||||
		super(new CKMMiSystem());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public CKMMiProblem(CKMMiProblem ckmmiProblem) {
 | 
			
		||||
		super(ckmmiProblem);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
		double[][] range = new double[m_ProblemDimension][2];
 | 
			
		||||
		for (i = 0; i < 9; i++) { // double[] kcat = new double[9]; // ->
 | 
			
		||||
			// p[0..9]
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 9; i < 12; i++) { // double[] ki = new double[3]; // ->
 | 
			
		||||
			// p[9..11]
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 12; i < 28; i++) { // double[] km = new double[16]; // ->
 | 
			
		||||
			// p[12..27]
 | 
			
		||||
			range[i][0] = 1E-8;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 28; i < 31; i++) { // double[] vm = new double[3]; // ->
 | 
			
		||||
			// p[28..30]
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 31; i < 34; i++) { // double[] kmm = new double[3]; // ->
 | 
			
		||||
			// p[31..33]
 | 
			
		||||
			range[i][0] = 1E-8;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 34; i < 37; i++) { // double[] kia = new double[3]; // ->
 | 
			
		||||
			// p[34..36]
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 1E+8;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 37; i < 40; i++) { // double[] kib = new double[3]; // ->
 | 
			
		||||
			// p[37..39]
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 1E+8;
 | 
			
		||||
		}
 | 
			
		||||
		range[40][0] = 1E-8; // double acCoA = 0; // -> p[40]
 | 
			
		||||
		range[40][1] = 2000;
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new CKMMiProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where 7 reactions are modeled using convenience kinetics"
 | 
			
		||||
				+ " and 3 reactions with Michaelis Menten kinetics. Only two reactions"
 | 
			
		||||
				+ " are considered reversible.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,76 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.InterfaceMultimodalProblem;
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.CKMMrSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class is a problem of the valine/leucine biosynthesis in C. glutamicum
 | 
			
		||||
 * and uses a combination of Michaelis-Menten and Convenience Kinetic, both
 | 
			
		||||
 * reversible.
 | 
			
		||||
 *
 | 
			
		||||
 * @date 2007-02-05
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class CKMMrProblem extends AbstractValineCurveFittingProblem implements
 | 
			
		||||
		InterfaceMultimodalProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -3120557413810402464L;
 | 
			
		||||
 | 
			
		||||
	public CKMMrProblem() {
 | 
			
		||||
		super(new CKMMrSystem());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public CKMMrProblem(CKMMrProblem ckmmrprob) {
 | 
			
		||||
		super(ckmmrprob);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see eva2.server.go.problems.inference.metabolic.AbstractValineCurveFittingProblem#getParameterRanges()
 | 
			
		||||
	 */
 | 
			
		||||
	public double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
 | 
			
		||||
		// double[] kcat = null, // <- params[0..6]
 | 
			
		||||
		// bcat = null, // <- params[7..13]
 | 
			
		||||
		// km = null, // <- params[14..43]
 | 
			
		||||
		// ki = null, // <- params[44..46]
 | 
			
		||||
		// vm = null, // <- params[47..50]
 | 
			
		||||
		// kia = null, // <- params[51..53]
 | 
			
		||||
		// kib = null; // <params[54..56]
 | 
			
		||||
		// double acCoA = 0, // <- params[57]
 | 
			
		||||
		// coA = 0; // <- params[58]
 | 
			
		||||
 | 
			
		||||
		// set the range
 | 
			
		||||
		double[][] range = new double[m_ProblemDimension][2];
 | 
			
		||||
		for (i = 0; i < range.length; i++) {
 | 
			
		||||
			// Reaktionen, bei denen CO2 entsteht, sind wahrscheinlich
 | 
			
		||||
			// irreversibel.
 | 
			
		||||
			if ((i < 14) || ((43 < i) && (i < 51)))
 | 
			
		||||
				range[i][0] = 0;
 | 
			
		||||
			else
 | 
			
		||||
				range[i][0] = 1E-8;
 | 
			
		||||
			if ((i > 50) && (i < 57))
 | 
			
		||||
				range[i][1] = 1E+8;
 | 
			
		||||
			else
 | 
			
		||||
				range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new CKMMrProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where 7 reactions are modeled using convenience kinetics"
 | 
			
		||||
				+ " and 3 reactions with Michaelis Menten kinetics. Only two reactions"
 | 
			
		||||
				+ " are considered irreversible.";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,65 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.GMAKiSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
// Created at 2007-02-02
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMAKiProblem extends AbstractValineSplineFittingProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial version id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -3635573692736142863L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default constructor for simulation of the valine data.
 | 
			
		||||
	 */
 | 
			
		||||
	public GMAKiProblem() {
 | 
			
		||||
		super(new GMAKiSystem());
 | 
			
		||||
		m_ProblemDimension = system.getNumberOfParameters();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public GMAKiProblem(GMAKiProblem gmakiProblem) {
 | 
			
		||||
		super(gmakiProblem);
 | 
			
		||||
		this.m_ProblemDimension = system.getNumberOfParameters();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see eva2.server.go.problems.inference.metabolic.AbstractValineCurveFittingProblem#getParameterRanges()
 | 
			
		||||
	 */
 | 
			
		||||
	protected double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
		// set the range
 | 
			
		||||
		double[][] range = new double[this.m_ProblemDimension][2];
 | 
			
		||||
		for (i = 0; i < 12; i++) {
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 12; i < this.m_ProblemDimension; i++) {
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 8;
 | 
			
		||||
		}
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.problems.AbstractOptimizationProblem#clone()
 | 
			
		||||
	 */
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new GMAKiProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where all reactions are modeled using generalized"
 | 
			
		||||
				+ " mass-action kinetics. Only two reactions are considered irreversible.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,66 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.InterfaceMultimodalProblem;
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.GMAKrSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In this problem, the valine/leucine reaction network in C. glutamicum is
 | 
			
		||||
 * simulated using a generalized mass-action approach.
 | 
			
		||||
 *
 | 
			
		||||
 * @since 2.0
 | 
			
		||||
 * @version
 | 
			
		||||
 * @author Andreas Dräger (draeger) <andreas.draeger@uni-tuebingen.de>
 | 
			
		||||
 *         Copyright (c) ZBiT, University of Tübingen, Germany Compiler:
 | 
			
		||||
 *         JDK 1.6.0
 | 
			
		||||
 * @date Sep 6, 2007
 | 
			
		||||
 */
 | 
			
		||||
public class GMAKrProblem extends AbstractValineCurveFittingProblem implements
 | 
			
		||||
		InterfaceMultimodalProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 3423204672190772267L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Default constructor for simulation of the valine data.
 | 
			
		||||
	 */
 | 
			
		||||
	public GMAKrProblem() {
 | 
			
		||||
		super(new GMAKrSystem());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public GMAKrProblem(GMAKrProblem gmakrprob) {
 | 
			
		||||
		super(gmakrprob);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see eva2.server.go.problems.inference.metabolic.AbstractValineCurveFittingProblem#getParameterRanges()
 | 
			
		||||
	 */
 | 
			
		||||
	protected double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
		double[][] range = new double[m_ProblemDimension][2];
 | 
			
		||||
		for (i = 0; i < 18; i++) {
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		for (i = 18; i < m_ProblemDimension; i++) {
 | 
			
		||||
			range[i][0] = 0;
 | 
			
		||||
			range[i][1] = 2000;
 | 
			
		||||
		}
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new GMAKrProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where all reactions are modeled using generalized"
 | 
			
		||||
				+ " mass-action kinetics. Only two reactions are considered irreversible.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										107
									
								
								src/eva2/server/go/problems/inference/metabolic/GMMiProblem.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								src/eva2/server/go/problems/inference/metabolic/GMMiProblem.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,107 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.GMMiSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
// Created at 2007-01-18
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMMiProblem extends AbstractValineCurveFittingProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -7344294007783094303L;
 | 
			
		||||
 | 
			
		||||
	public GMMiProblem() {
 | 
			
		||||
		super(new GMMiSystem());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public GMMiProblem(GMMiProblem gmmiproblem) {
 | 
			
		||||
		super(gmmiproblem);
 | 
			
		||||
		this.m_ProblemDimension = system.getNumberOfParameters();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.problems.inference.metabolic.AbstractValineCurveFittingProblem#getParameterRanges()
 | 
			
		||||
	 */
 | 
			
		||||
	protected double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
		double[][] range = new double[m_ProblemDimension][2];
 | 
			
		||||
 | 
			
		||||
		// BRENDA: k+1 k+2 k+4 k+5 k+7 k+8 k+9 l1 l2 Ki1 Ki2 Ki3 vm1 vm2 vm3
 | 
			
		||||
		// kia1
 | 
			
		||||
		// kia2 kia3 kib1 kib2 kib3 km1 km2 km3
 | 
			
		||||
		double[] min = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 | 
			
		||||
				0, 0, 0, 1E-8, 1E-8, 1E-8 }, max = { 2000, 2000, 2000, 2000,
 | 
			
		||||
				2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000,
 | 
			
		||||
				2000, 1E+8, 1E+8, 1E+8, 1E+8, 1E+8, 1E+8, 2000, 2000, 2000 };
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * for (i = 0; i < 7; i++) { // k, rate constants for forward reaction
 | 
			
		||||
		 * range[i][0] = 0.01; range[i][1] = 2000; } for (i = 7; i < 9; i++) { //
 | 
			
		||||
		 * l, rate constants for backward reaction range[i][0] = 0.01;
 | 
			
		||||
		 * range[i][1] = 2000; } for (i = 9; i < 12; i++) { // ki, Rate constant
 | 
			
		||||
		 * for inhibition of uncertain mechanism range[i][0] = 0.01; range[i][1] =
 | 
			
		||||
		 * 100; } for (i = 12; i < 15; i++) { // vm, Maximal reaction velocity
 | 
			
		||||
		 * range[i][0] = 0.1; range[i][1] = 2000; } for (i = 15; i < 18; i++) { //
 | 
			
		||||
		 * kia' == km/kia, Rate constant for inhibition of the enzyme
 | 
			
		||||
		 * range[i][0] = 0; range[i][1] = 100; } for (i = 18; i < 21; i++) { //
 | 
			
		||||
		 * kib' == 1/kib, Rate constant for inhibition of the enzyme substrate
 | 
			
		||||
		 * complex range[i][0] = 0; range[i][1] = 100; } for (i = 21; i < 24;
 | 
			
		||||
		 * i++) { // km, the Michaelis-Menten constant range[i][0] = 0.01;
 | 
			
		||||
		 * range[i][1] = 2000; } // AcCo, Constant specifying the concentration
 | 
			
		||||
		 * of Acetyl-CoA // This is not needed because p_4 already includes
 | 
			
		||||
		 * Acetyl-CoA implicitely. //range[24][0] = 0.01; //range[24][1] = 100; //
 | 
			
		||||
		 */
 | 
			
		||||
		for (i = 0; i < range.length; i++) {
 | 
			
		||||
			range[i][0] = min[i];
 | 
			
		||||
			range[i][1] = max[i];
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * double initial[] = new double[] { 15.625991725476922, 2000.0, 0.0010,
 | 
			
		||||
		 * 0.0010, 0.0014167666438540366, 0.03914648793059087,
 | 
			
		||||
		 * 0.0012346931715111, 0.0010, 0.002922248833329009, 50.00050096623751,
 | 
			
		||||
		 * 25.00075000582071, 87.5001338911313, 0.0010, 0.0010, 0.0010,
 | 
			
		||||
		 * 99.99692409764904, 99.9470190144952, 100.0, 99.99999925494194,
 | 
			
		||||
		 * 99.99994374811648, 99.9999922933057, 2000.0, 1999.9999939464062,
 | 
			
		||||
		 * 2000.0,
 | 
			
		||||
		 *
 | 
			
		||||
		 * 30.76270291064184, 1000.0004988358473, 0.0010, 0.0010,
 | 
			
		||||
		 * 0.0017147897187887668, 0.04677587864891996, 0.0010852159729891494,
 | 
			
		||||
		 * 0.0010, 0.0025497199896605963, 96.87503280922212, 12.500875002910353,
 | 
			
		||||
		 * 93.75044398773962, 0.0010, 0.0010, 0.0010, 99.9999962747097,
 | 
			
		||||
		 * 99.98389044776184, 100.0, 99.90234374997726, 99.9999973224476,
 | 
			
		||||
		 * 99.99389646109051, 1999.9999701976926, 1999.9999664724041, 2000.0
 | 
			
		||||
		 *
 | 
			
		||||
		 *
 | 
			
		||||
		 * //10.773224990548886, 505.8899553355387, 0.0010, 0.0010, 0.0010,
 | 
			
		||||
		 * 0.0010, 0.0010, 0.0010, 0.0010, 100.0, //100.0, 100.0, 0.0010,
 | 
			
		||||
		 * 0.0010, 0.0010, 100.0, 0.0, 100.0, 100.0, 100.0, 0.0, 2000.0, 2000.0,
 | 
			
		||||
		 * 2000.0,
 | 
			
		||||
		 *
 | 
			
		||||
		 * //0.016, 6.1, 0.001, 0.001, 0.001, 0.01, 0.005, 0.7, 0.011, 0.011,
 | 
			
		||||
		 * 0.012, 35.3, 0.4, 0.001, 0.001, 0.001, 5, 5, 0.001, 5, 5, 10.9, 5, 5 };
 | 
			
		||||
		 * double choice = RandomNumberGenerator.randomDouble(0, 1);//
 | 
			
		||||
		 */
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new GMMiProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where 7 reactions are modeled using generalized"
 | 
			
		||||
				+ " mass-action kinetics and 3 reactions using Michaelis-Menten kinetics. "
 | 
			
		||||
				+ "Only two reactions are considered reversible.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.problems.inference.metabolic.odes.GMMrSystem;
 | 
			
		||||
import eva2.server.go.strategies.InterfaceOptimizer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created at 2007-02-04.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMMrProblem extends AbstractValineCurveFittingProblem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial version id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -3889975340670999788L;
 | 
			
		||||
 | 
			
		||||
	public GMMrProblem() {
 | 
			
		||||
		super(new GMMrSystem());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public GMMrProblem(GMMrProblem gmmrproblem) {
 | 
			
		||||
		super(gmmrproblem);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 * @see eva2.server.go.problems.inference.metabolic.AbstractValineCurveFittingProblem#getParameterRanges()
 | 
			
		||||
	 */
 | 
			
		||||
	protected double[][] getParameterRanges() {
 | 
			
		||||
		int i;
 | 
			
		||||
		/*
 | 
			
		||||
		 * a // <- params[0..6] 7 b // <- params[7..13] 7 vm // <-
 | 
			
		||||
		 * params[14..17] 4 km // <- params[18..21] 4 kia // <- params[22..24] 3
 | 
			
		||||
		 * kib // <- params[25..27] 3 ki // <- params[28..30] 3
 | 
			
		||||
		 */
 | 
			
		||||
		double[][] range = new double[m_ProblemDimension][2];
 | 
			
		||||
		double min[] = { 0.000000000, 0.000000000, 0.000000000, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.000000000, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.000000000, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.000000000, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.000000000, 0.000000000,
 | 
			
		||||
				0.407343614, 0.059890210, 0.008423761, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.432428055, 0.000000000,
 | 
			
		||||
				0.000000000, 0.000000000, 0.000000000 };
 | 
			
		||||
		double max[] = { 16.012590, 10.398386, 14.983890, 9.367657, 16.011989,
 | 
			
		||||
				7.229141, 409.395094, 3.348859, 65.532900, 424.407762,
 | 
			
		||||
				426.881040, 2.753995, 6.234599, 8.552800, 2.216418, 16.623249,
 | 
			
		||||
				1031.701261, 9.238867, 9.110233, 6.765434, 8.693675, 6.798338,
 | 
			
		||||
				5.628473, 5.364593, 8.438638, 9.185120, 6.459422, 12.470121,
 | 
			
		||||
				426.124248, 335.241456, 638.222487 };
 | 
			
		||||
		for (i = 0; i < range.length; i++) {
 | 
			
		||||
			// Reaktionen, bei denen CO2 entsteht, sind wahrscheinlich
 | 
			
		||||
			// irreversibel.
 | 
			
		||||
			// if (i < 18) //((i == 7) || (i == 12))
 | 
			
		||||
			range[i][0] = min[i]; // 0;
 | 
			
		||||
			/*
 | 
			
		||||
			 * else range[i][0] = 1E-8;/
 | 
			
		||||
			 */
 | 
			
		||||
			if ((21 < i) && (i < 28))
 | 
			
		||||
				range[i][1] = max[i]; // 1E+8;
 | 
			
		||||
			else
 | 
			
		||||
				range[i][1] = max[i]; // 2000;
 | 
			
		||||
		}
 | 
			
		||||
		return range;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Object clone() {
 | 
			
		||||
		return new GMMrProblem(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
 | 
			
		||||
		return "Parameter optimization problem for the valine and leucine biosynthesis"
 | 
			
		||||
				+ " in C. glutamicum, where 7 reactions are modeled using generalized"
 | 
			
		||||
				+ " mass-action kinetics and 3 reactions using Michaelis-Menten kinetics. "
 | 
			
		||||
				+ "Only two reactions are considered irreversible.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										243
									
								
								src/eva2/server/go/problems/inference/metabolic/TimeSeries.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										243
									
								
								src/eva2/server/go/problems/inference/metabolic/TimeSeries.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,243 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.StringTokenizer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class is able to parse and store the contents of a time series data
 | 
			
		||||
 * file. These files are supposed to be a matrix, whose columns are separated by
 | 
			
		||||
 * spaces or tabs. Every row is supposed to contain a time value in the first
 | 
			
		||||
 * column. Every other column contains the concentration of the appropriate
 | 
			
		||||
 * metabolite. Because the concentrations of different metabolites are not
 | 
			
		||||
 * measured at the same time, it is possible that some values equal -1 or "NaN".
 | 
			
		||||
 * For a given metabolite this class provides methods to extract the appropriate
 | 
			
		||||
 * times as well as the concentration values from this file.
 | 
			
		||||
 *
 | 
			
		||||
 * @since 2.0
 | 
			
		||||
 * @version
 | 
			
		||||
 * @author Andreas Dräger (draeger) <andreas.draeger@uni-tuebingen.de>
 | 
			
		||||
 *         Copyright (c) ZBiT, University of Tübingen, Germany Compiler:
 | 
			
		||||
 *         JDK 1.6.0
 | 
			
		||||
 * @date Sep 6, 2007
 | 
			
		||||
 */
 | 
			
		||||
public class TimeSeries implements Serializable {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 5744947450930268722L;
 | 
			
		||||
 | 
			
		||||
String                      dataFile[]      = new String[] {
 | 
			
		||||
      "\"Time\" \"PYR\"          \"AKG\"   \"ALA\"   \"NAD\"     \"DHIV\"  \"nadp\"     \"Glut\"     \"2IPM\"    \"AcLac\"  \"Val\"      \"Leu\"    \"KIV\"     \"KIC\"",
 | 
			
		||||
      "-3.894  0.69956151035		4.640691888659999	0.8149815245099999	0.43831117728999996	0.12919945973		NaN			39.91322431689	0.01634219825	0.22846321864000002	25.300234279730002	0.31457001595	13.06542276153	0.12828553615000002",
 | 
			
		||||
      "-3.429  0.6887305946		4.4648219135		0.9733354471500001	0.46283738647		0.09269418599		0.01751164422		34.689755620279996	0.016622587119999997	0.26529057205	27.855794163480002	0.21601742448	12.27325468611	0.08806661914",
 | 
			
		||||
      "-2.964  0.648489239		5.16446833661		1.08501337472		0.510398731		0.09668719327		0.015292064690000001	35.94424701067	0.0218616059	0.24372308822	27.512009946459997	0.19358187491999998	11.83868901432	0.08060740248	",
 | 
			
		||||
      "-2.499  0.66263247645		5.46655875364		1.25007291486		0.54709779337		0.27832465706		0.02017254508		42.09304165779	0.02271131235	0.31096389668	31.734637769419997	0.26547698208000003	9.74938023117	0.09527994438000001	",
 | 
			
		||||
      "-2.037  0.78148116407		5.01023940504		1.1274704877		0.54374513457		0.10951589105		0.023434610419999998	38.623872567220005	0.02310058527	0.23193180999000002	28.68948017027	0.27338539200999995	9.8790791622	0.06856701949	",
 | 
			
		||||
      "-1.572  0.7976018096		4.50327160849		0.9657423536899999	0.58804343197		0.07731788865		0.021456078269999998	39.65098562534	0.02122962586	NaN	23.23780871601	0.21372010324	7.35589658416	0.04408823098	",
 | 
			
		||||
      "-1.107  0.62138120097		5.527992933249999	1.11320796018		0.55468774709		0.19127059402000002	0.02151432978		37.43103867786	0.021760915119999998	0.1961057295	28.06503640484	0.25571800238	7.77390798856	0.08440327591999999	",
 | 
			
		||||
      "-0.642  0.61440001723		5.6582676904		1.0934342424799999	0.57892866745		0.29234911798		0.02163427084		41.73288066597	0.02358943064	0.23458068462	31.36134966529	0.28291670151	8.77177024347	0.0732470093	",
 | 
			
		||||
      "0.363   0.70849102753		5.6485532671600005	1.07913785266		0.5494837929699999	0.22848890345		0.03264048454		40.837490521439996	0.02034557524	0.25195151103	27.336329975730003	0.1981060288	6.68584901645	0.07329936145	",
 | 
			
		||||
      "0.828   0.7284264133299999	5.24081938936		1.20656221781		0.56038053457		0.50828902006		0.02799224444		43.839863948079994	0.02365648322	0.33595864068	30.40658463215	0.25328480297	7.46481961657	0.06727204061	",
 | 
			
		||||
      "1.293   2.35072982926		12.865197464340001	2.91425720335		0.6174561459100001	0.51680611101		0.0180555805		45.00192868082	0.02789099302	0.27282017381999996	35.47319021015	0.34012252203000004	12.4841096615	0.12075887125	",
 | 
			
		||||
      "1.758   1.9467590874099998	9.85083850897		2.38135380833		0.47990344534		0.36137563687		0.02083824064		39.874833705	0.02603135155	0.24703878422	35.24799025209	0.25499939033	10.58660287792	0.12011356083	",
 | 
			
		||||
      "2.220   1.76234822871		12.57168005228		2.535743239		0.58312865514		0.17860360497		0.018047886200000002	48.82282962176	0.02531203769	NaN	31.84083292177	0.21013809416	8.79825645884	0.10474495756	",
 | 
			
		||||
      "2.685   1.92439252352		11.2260038878		2.8335955021		0.49220203429		0.16592713605		0.0278326992		39.75506759172	0.02115183034	0.24700121622	29.23941353308	0.22169631684000002	8.94277598226	0.09683684583	",
 | 
			
		||||
      "3.150   1.92008237217		10.682979534100001	2.63737602928		0.36735949621999997	0.1546055768		0.01515236183		39.012881840679995	NaN	0.46143297886	35.812552779769995	0.28387244697	14.20243053826	0.10933158105	",
 | 
			
		||||
      "4.620   1.81992606678		11.067551454270001	2.70934921435		0.40725580208999995	0.24849740356		0.027964720069999997	40.42309102465	0.0170493166	0.42824885292	37.17528380543	0.33573709864	15.33969385816	0.10861095009	",
 | 
			
		||||
      "5.085   1.45412618172		8.37506633272		2.5510691881399996	0.5402956812899999	0.29017599822		0.029667666019999997	52.86610489844	0.01551224716	0.37018809756000004	42.07773461152	0.32912302835999996	16.97282365372	0.1127063518	",
 | 
			
		||||
      "5.550   1.7963431670299999	10.9951402722		3.2730762781499996	0.49909124182		0.36584625016		0.031689318279999996	49.69757534082	0.030182574599999998	0.50230756817	44.18764066063	0.34318150693	14.45568137413	0.13087029789	",
 | 
			
		||||
      "6.015   1.79488675167		10.58210664143		2.82815659112		0.42028499769		0.33884287302		0.02904992542		47.618463449870006	0.02065291348	0.38243112459999995	41.68555649409	0.31270596242	14.18407754513	0.12297689406000001	",
 | 
			
		||||
      "6.477   1.71658915979		13.051632359080001	2.86429255047		0.69044126446		0.2906864281		0.02542790495		52.905505205989996	0.0363051233	0.46612294623	51.36020781111	0.52323119427	15.99708653385	0.13462198459000002	",
 | 
			
		||||
      "6.942   1.70200349375		11.29511994965		2.47410519106		0.61838724543		0.74141022319		0.02954918008		52.05561320903	0.03626130189	0.36020464648	47.08381733066	0.39496256108	15.29065040412	0.12714131781000002	",
 | 
			
		||||
      "7.407   1.4797133761099999	10.85092666902		2.73282139173		0.60893255673		0.91712444816		0.031866304570000004	54.69762263264	0.034354864900000004	0.50457338093	42.85485451463	0.35559022922000005	11.0783278302	0.11004224548000001	",
 | 
			
		||||
      "7.872   1.9687388421799998	12.632535436100001	3.38129932903		0.6733727859399999	1.19712426006		0.02287925851		69.03104100976	0.0346858365	0.6115046939	52.213982982809995	0.44352030561	14.17030298056	0.11817042216	",
 | 
			
		||||
      "8.877   1.66191235556		10.202950777509999	2.7018080554500004	0.65431385574		0.8630518573		0.03842550936		55.18740808596	0.03100906854	0.43636326995	44.94372991982	0.39590424030000004	11.87915174242	0.12055380252	",
 | 
			
		||||
      "9.342   1.79446423883		9.223736902639999	2.82086676673		0.46928184702		0.25036756575999997	0.0261580927		44.218411563610005	0.02307492312	0.37136132062	34.8715067452	0.23048150172999998	9.83227607934	0.08369892896	",
 | 
			
		||||
      "9.807   2.02936743557		10.926146897779999	3.40942786382		0.4943626997		0.41616779600000003	0.020775668350000002	57.63290012324	0.02453204368	0.59384364452	41.567799898539995	0.37314942280999996	11.524438278929999	0.10958751164	",
 | 
			
		||||
      "10.272  1.96339182674		11.26182399865		3.6725323889699997	0.51033452936		0.38195138421		0.02349833226		68.82889744295	0.02130776115	0.56596184217	43.85824526299	0.3563165939	10.882216090570001	0.11761378372	",
 | 
			
		||||
      "10.734  1.69522699956		9.28644900764		3.09521900994		0.46748976233		0.25486955073		0.024124165519999997	56.23949510944	0.01806823073	NaN	36.05982284756	0.25298007274	8.86586676025	0.07157556397999999	",
 | 
			
		||||
      "11.199  1.87021691917		9.68208305253		3.2919709268000004	0.5270903229299999	0.42322311943		0.0327964463		59.54087126072	0.022691202100000002	0.47737124454999996	41.842194656909996	0.28466758982	11.91006067162	0.09872917755999999	",
 | 
			
		||||
      "11.664  2.23471175262		12.19887299453		3.6051454388299997	0.54389398527		0.54313316601		0.01479252184		63.04737515095	0.02776861734	0.48410774037	46.409590689800005	0.44546516811	12.6862786223	0.10475246765999999	",
 | 
			
		||||
      "12.129  1.58626042008		9.99097297113		3.7513050785999997	0.42925918395999996	0.44080053731999996	0.013039703409999999	54.332315720649994	0.02735050961	0.31900140121	39.37877381533	0.32147277213000003	10.09758737431	0.08824555916	",
 | 
			
		||||
      "13.134  1.09179740401		6.491353226309999	2.26052958713		0.5481437170200001	NaN			0.01664214786		49.99620609066	0.02341309598	NaN	32.90242406736	0.29822072293	7.4630383928	0.0570285326	",
 | 
			
		||||
      "13.599  1.3879954566700001	9.38597812226		3.67292411291		0.41493699655		0.35712124297000003	0.01725904447		49.842043735	0.025759816390000002	0.40749356039	36.65749859265	0.31221753187	8.49907762956	0.08041935436999999	",
 | 
			
		||||
      "14.064  1.46398956252		9.514586394050001	3.8008622291900003	0.48941052945		0.43946239095		0.01718538349		54.47374486523	0.02895368422	0.48952197341	40.26813532416	0.40474806982	9.42390966864	0.07994405853	",
 | 
			
		||||
      "14.529  1.38755206855		8.484590611449999	3.2508142214399998	0.4940005127		0.48337445569		0.01893519951		47.84282639242	0.026125384369999997	0.4407703548	41.362606442570005	0.27053364357	11.06193869222	0.1028701703	",
 | 
			
		||||
      "14.991  0.88675119894		6.09938485345		2.0966046727900003	0.51403159937		0.25811120551		0.0228857864		44.11169057688	0.021193232819999998	NaN	31.027494313570003	0.22906790417	7.52510837768	0.053950203	",
 | 
			
		||||
      "15.456  1.8352414024800001	8.469270941569999	3.3301897663099997	0.4957035248		0.26361946777		0.025116875570000002	36.08517318062	0.025039514409999998	0.38916760052	38.21581762714	0.2746950311	11.731711424339998	0.12009641433	",
 | 
			
		||||
      "15.921  1.3283163392300001	8.17980680802		3.0409809543		0.38135485122		0.31612171511000003	0.01517163163		32.72595199009	0.02671292861	0.34622186149	42.07802536984	0.2542175654	12.23730313735	0.13746139785	",
 | 
			
		||||
      "16.386  1.0127505969		4.742491586150001	1.84597095725		0.34553761760999996	NaN	NaN		23.37116254961		NaN	NaN	NaN	0.15254582637	6.9247716185999995	0.07113160166999999	",
 | 
			
		||||
      "17.391  1.3310395982		7.94156759798		2.53879431682		0.48983728463		0.28795700924		0.026527055879999997	26.57827416636	0.02478540202	0.32631108383999996	33.95632215865	0.23618178628	10.48083524196	0.12515650878	",
 | 
			
		||||
      "17.856  0.95469028533		6.2343780867100005	2.17715476263		0.38729195765999996	0.28723013923		0.02123345169		24.49108607053	0.02618426224	0.29861161455	32.8592195428	0.2472225415	10.106162722479999	0.10923677735	",
 | 
			
		||||
      "18.321  NaN			5.49182392648		1.46886777519		0.34474738841999997	0.40646871383		0.01547566737		20.63720807926	0.02820014831	0.24058040600000002	40.71516409524	0.24270642545999999	14.12503277772	0.12899961175000002	",
 | 
			
		||||
      "18.786  0.82619105906		5.95530539146		2.299362329		0.44373946309		0.41075036223		0.02555677606		38.20802369971	0.02900285112	0.32959703389	34.213028316030005	0.25023635697	9.12222153162	0.10197379988000001	",
 | 
			
		||||
      "19.248  1.25881942787		6.53214282703		2.7302141736600003	0.50467802709		0.41526312678		0.02242466065		36.837815626659996	0.02483324467	0.38040913803	33.23783851764	0.23737761148	9.48079376972	0.11263783924000001	",
 | 
			
		||||
      "19.713  1.18507811227		5.4310205666		2.1360162267800002	0.46222885974		NaN			0.03397622205		28.19338823663	0.02104977904	NaN	25.47234120703	0.14638363385	7.60817737184	0.08542327693999999	",
 | 
			
		||||
      "20.178  0.98680703323		6.8729957498		2.34703189167		0.36189835991		0.35197395012		0.0170510439		26.43911126279	0.03024185129	0.30588350463	36.72827117308	0.23660664184000002	13.6943897464	0.16017717532	",
 | 
			
		||||
      "20.643  0.97377667062		6.15710096877		2.10492373702		0.46580796436000005	0.38984610765		0.020551778160000003	28.19084298145	0.02817732147	0.31660453741	33.563565688000004	0.17354025424	11.137671980450001	0.11278907400999999"};
 | 
			
		||||
 | 
			
		||||
  private int                 dataFileLineCnt = dataFile.length;
 | 
			
		||||
 | 
			
		||||
  private Map<String, Object> names;
 | 
			
		||||
 | 
			
		||||
  public static void main(String args[]) {
 | 
			
		||||
    new TimeSeries();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * This constructs a new instance of this class from the given file. All
 | 
			
		||||
   * entries of the given file are stored in a <java>String</java> matrix. The
 | 
			
		||||
   * names of the metabolites are stored in a hash for easy retrival.
 | 
			
		||||
   *
 | 
			
		||||
   * @param fileName
 | 
			
		||||
   */
 | 
			
		||||
  public TimeSeries() {
 | 
			
		||||
    try {
 | 
			
		||||
      int i = 0, j = 0;
 | 
			
		||||
      this.names = new HashMap<String, Object>();
 | 
			
		||||
      StringTokenizer st = new StringTokenizer(dataFile[0]);
 | 
			
		||||
 | 
			
		||||
      // Lesen zum ersten Mal und initialisieren Matrix.
 | 
			
		||||
      for (j = 0; st.hasMoreElements(); st.nextElement(), j++);
 | 
			
		||||
 | 
			
		||||
      String data[][] = new String[dataFileLineCnt - 1][j];
 | 
			
		||||
 | 
			
		||||
      // Jetzt in Matrix einlesen.
 | 
			
		||||
      for (i = 0; i < dataFileLineCnt; i++) {
 | 
			
		||||
        j = 0;
 | 
			
		||||
        st = new StringTokenizer(dataFile[i]);
 | 
			
		||||
        while (st.hasMoreElements())
 | 
			
		||||
          if (i > 0)
 | 
			
		||||
            data[i - 1][j++] = st.nextElement().toString();
 | 
			
		||||
          else names.put(st.nextElement().toString().replaceAll("\"", ""),
 | 
			
		||||
              new Integer(j++));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
       * for (i=0; i<data.length; i++) { System.out.print("\n"+data[i][0]+" ");
 | 
			
		||||
       * for (j=1; j<data[0].length; j++) { double val =
 | 
			
		||||
       * Double.parseDouble(data[i][j])/1000; System.out.print(val+"\t"); } }
 | 
			
		||||
       */
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
       * names becomes a hash pointing to matrices.
 | 
			
		||||
       */
 | 
			
		||||
      Iterator<String> iter = names.keySet().iterator();
 | 
			
		||||
      while (iter.hasNext())
 | 
			
		||||
        try {
 | 
			
		||||
          double values[][];
 | 
			
		||||
          int tcol = 0, count = 0;
 | 
			
		||||
          String name = iter.next().toString();
 | 
			
		||||
 | 
			
		||||
          i = 0;
 | 
			
		||||
          j = ((Integer) names.get(name)).intValue();
 | 
			
		||||
          for (i = 0; i < data.length; i++)
 | 
			
		||||
            if (!data[i][j].equals("-1") && !data[i][j].equals("NaN")) count++;
 | 
			
		||||
          values = new double[2][count];
 | 
			
		||||
//          /*
 | 
			
		||||
//           * The times are supposed to be the first column. However, this
 | 
			
		||||
//           * enables the times to be any column.
 | 
			
		||||
//           */
 | 
			
		||||
//          try {
 | 
			
		||||
//            tcol = ((Integer) this.names.get("Time")).intValue();
 | 
			
		||||
//          } catch (Exception exc) {
 | 
			
		||||
//          };
 | 
			
		||||
          for (i = 0, count = 0; i < data.length; i++)
 | 
			
		||||
            if (!data[i][j].equals("-1") && !data[i][j].equals("NaN")) {
 | 
			
		||||
              values[0][count] = Double.parseDouble(data[i][tcol]);
 | 
			
		||||
              values[1][count++] = Double.parseDouble(data[i][j]);
 | 
			
		||||
            }
 | 
			
		||||
          names.put(name, values);
 | 
			
		||||
        } catch (Exception exc) {
 | 
			
		||||
          exc.printStackTrace();
 | 
			
		||||
        }
 | 
			
		||||
      data = null;
 | 
			
		||||
    } catch (Exception exc) {
 | 
			
		||||
      exc.printStackTrace();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * With this method one retrives the time data of the given metabolite or
 | 
			
		||||
   * throws an <java>exception</java> if the given metabolite does not exist.
 | 
			
		||||
   *
 | 
			
		||||
   * @param metabolite
 | 
			
		||||
   *                The name of the metabolite, whose time data are desired.
 | 
			
		||||
   * @return The time data.
 | 
			
		||||
   * @throws Exception
 | 
			
		||||
   * @throws If
 | 
			
		||||
   *                 there is no entry for the desired metabolite, an exeption
 | 
			
		||||
   *                 is thrown.
 | 
			
		||||
   */
 | 
			
		||||
  public double[] getTimes(String metabolite) throws Exception {
 | 
			
		||||
    if (names == null) System.err.println("getTimes: names is null");
 | 
			
		||||
    if (!names.containsKey(metabolite))
 | 
			
		||||
      throw new Exception("No data measured for this metabolite");
 | 
			
		||||
    if (names.get(metabolite) == null) System.err.println("get(metabolite) is null");
 | 
			
		||||
    return ((double[][]) names.get(metabolite))[0];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * This method returns all measured times.
 | 
			
		||||
   *
 | 
			
		||||
   * @return An array containing all measurement times.
 | 
			
		||||
   * @throws Exception
 | 
			
		||||
   *                 If there is no column called "Time" in the data matrix.
 | 
			
		||||
   */
 | 
			
		||||
  public double[] getTimes() throws Exception {
 | 
			
		||||
    return getTimes("Time");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * This method returns the concentration values of the given metabolite or
 | 
			
		||||
   * throws an exception if there is no measurement for the desired metabolite.
 | 
			
		||||
   *
 | 
			
		||||
   * @param metabolite
 | 
			
		||||
   *                The name of the desired metabolite.
 | 
			
		||||
   * @return an array of concentration values.
 | 
			
		||||
   * @throws Exception
 | 
			
		||||
   * @throws If
 | 
			
		||||
   *                 there is no entry for the desired metabolite, an exception
 | 
			
		||||
   *                 is thrown.
 | 
			
		||||
   */
 | 
			
		||||
  public double[] getValues(String metabolite) throws Exception {
 | 
			
		||||
    if (!names.containsKey(metabolite))
 | 
			
		||||
      throw new Exception("No data measured for this metabolite");
 | 
			
		||||
    return ((double[][]) names.get(metabolite))[1];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * With this method it can be checked wheather measurements have been
 | 
			
		||||
   * perforemd for the given metabolite.
 | 
			
		||||
   *
 | 
			
		||||
   * @param name
 | 
			
		||||
   *                The name of the metabolite
 | 
			
		||||
   * @return <code>true</code> if an entry for this metabolite exists or
 | 
			
		||||
   *         <code>false</code> otherwise.
 | 
			
		||||
   */
 | 
			
		||||
  public boolean containsMetabolite(String name) {
 | 
			
		||||
    return names.keySet().contains(name);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns the number of measurements taken for this specific metabolite or
 | 
			
		||||
   * zero if there are no measurements.
 | 
			
		||||
   *
 | 
			
		||||
   * @param name
 | 
			
		||||
   *                The name of the metabolite
 | 
			
		||||
   * @return The number of available measurement data for this metabolite
 | 
			
		||||
   */
 | 
			
		||||
  public int numberOfMeasurements(String name) {
 | 
			
		||||
    try {
 | 
			
		||||
      return getTimes(name).length;
 | 
			
		||||
    } catch (Exception exc) {
 | 
			
		||||
      return 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -0,0 +1,156 @@
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created at 2007-02-03
 | 
			
		||||
 *
 | 
			
		||||
 * This class describes the valine/leucine biosynthesis in <it>Corynebacterium
 | 
			
		||||
 * glutamicum</it> acording to the convenience kinetics as proposed by
 | 
			
		||||
 * Liebermeister and Klipp. Three reaction velocities follow the traditional
 | 
			
		||||
 * Michaelis Menten scheme the others are given in the convenience kinetics. All
 | 
			
		||||
 * reactions are considered to be ehter reversible or irreversible according to
 | 
			
		||||
 * what is written in the KEGG database.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class CKMMiSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 8595111459805099502L;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	public CKMMiSystem() {
 | 
			
		||||
		this.p = null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param params
 | 
			
		||||
	 *            The parameters of this system.
 | 
			
		||||
	 */
 | 
			
		||||
	public CKMMiSystem(double[] params) {
 | 
			
		||||
		this.p = params;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see javaeva.server.oa.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
		// double[] kcat = new double[9]; // -> p[0..9]
 | 
			
		||||
		// double[] ki = new double[3]; // -> p[9..11]
 | 
			
		||||
		// double[] km = new double[16]; // -> p[12..27]
 | 
			
		||||
		// double[] vm = new double[3]; // -> p[28..30]
 | 
			
		||||
		// double[] kmm = new double[3]; // -> p[31..33]
 | 
			
		||||
		// double[] kia = new double[3]; // -> p[34..36]
 | 
			
		||||
		// double[] kib = new double[3]; // -> p[37..39]
 | 
			
		||||
		// double acCoA = 0; // -> p[40]
 | 
			
		||||
 | 
			
		||||
		double pyr = getPyr_2(t), nadp = getNADP_2(t), nadph = 0.04 - nadp, glut = getGlut_2(t), ala = getAla_2(t);
 | 
			
		||||
		/*
 | 
			
		||||
		 * Y[0] DHIV Y[1] IPM Y[2] AcLac Y[3] Val Y[4] Leu Y[5] KIV Y[6] KIC
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		return linearCombinationOfVelocities(new double[] {
 | 
			
		||||
		/* Korrigiert: */
 | 
			
		||||
		// v_1: AHAS: convenience (ge<67>ndert)
 | 
			
		||||
				(p[0] * p[9] * Math.pow(pyr / p[12], 2))
 | 
			
		||||
						/ ((1 + pyr / p[12] + Math.pow(pyr / p[12], 2)) * (p[9] + Y[3])),
 | 
			
		||||
 | 
			
		||||
				// v_2: AHAIR: convenience (ge<67>ndert)
 | 
			
		||||
				(p[1] * Y[2] / p[13] * nadph / p[14] * p[10] - p[2] * Y[0]
 | 
			
		||||
						/ p[15] * nadp / p[16] * p[10])
 | 
			
		||||
						/ ((1 + Y[2] / p[13] + nadph / p[14] + (Y[2] * nadph)
 | 
			
		||||
								/ (p[13] * p[14]) + Y[0] / p[15] + nadp / p[16] + (Y[0] * nadp)
 | 
			
		||||
								/ (p[15] * p[16])) * (p[10] + Y[3])),
 | 
			
		||||
 | 
			
		||||
				// v_3: DHAD: reversible Michaelis Menten with two inhibitions
 | 
			
		||||
				// (ge<67>ndert)
 | 
			
		||||
				(p[28] * Y[0])
 | 
			
		||||
						/ (p[31] + Y[0] + Y[3] * (p[31] * p[34] + p[37] * Y[0])),
 | 
			
		||||
 | 
			
		||||
				// v_4: BCAAT_ValB: convenience (ge<67>ndert)
 | 
			
		||||
				(p[3] * Y[5] / p[17] * glut / p[18])
 | 
			
		||||
						/ (1 + Y[5] / p[17] + glut / p[18] + (Y[5] * glut)
 | 
			
		||||
								/ (p[17] * p[18])),
 | 
			
		||||
 | 
			
		||||
				// v_5: BCAAT_ValC: convenience (ge<67>ndert)
 | 
			
		||||
				(p[4] * Y[5] / p[19] * ala / p[20])
 | 
			
		||||
						/ (1 + Y[5] / p[19] + ala / p[20] + (Y[5] * ala)
 | 
			
		||||
								/ (p[19] * p[20])),
 | 
			
		||||
 | 
			
		||||
				// v_6: Trans_Val: irreversible Michaelis Menten with two
 | 
			
		||||
				// inhibitions
 | 
			
		||||
				(p[29] * Y[3])
 | 
			
		||||
						/ (p[32] + Y[3] + p[32] * p[35] * Y[4] + p[38] * Y[3]
 | 
			
		||||
								* Y[4]),
 | 
			
		||||
 | 
			
		||||
				// v_7: IPMS: convenience (AcCoA/K_m = p40) (ge<67>ndert)
 | 
			
		||||
				(p[5] * Y[5] / p[21] * p[40] * p[11])
 | 
			
		||||
						/ ((1 + Y[5] / p[21] + p[40] + p[40] * Y[5] / p[21]) * (p[11] + Y[4])),
 | 
			
		||||
 | 
			
		||||
				// v_8: IPMDH: convenience (ge<67>ndert)
 | 
			
		||||
				(p[6] * Y[1] / p[22] * nad / p[23])
 | 
			
		||||
						/ (1 + Y[1] / p[22] + nad / p[23] + (Y[1] * nad)
 | 
			
		||||
								/ (p[22] * p[23])),
 | 
			
		||||
 | 
			
		||||
				// v_9: BCAAT_LeuB: convenience (ge<67>ndert)
 | 
			
		||||
				(p[7] * Y[6] / p[24] * glut / p[25] - p[8] * Y[4] / p[26] * akg
 | 
			
		||||
						/ p[27])
 | 
			
		||||
						/ (1 + Y[6] / p[24] + glut / p[25] + (Y[6] * glut)
 | 
			
		||||
								/ (p[24] * p[25]) + Y[4] / p[26] + akg / p[27] + (Y[4] * akg)
 | 
			
		||||
								/ (p[26] * p[27])),
 | 
			
		||||
 | 
			
		||||
				// v_10: Trans_Leu: irreversible Michaelis Menten with two
 | 
			
		||||
				// inhibitions
 | 
			
		||||
				(p[30] * Y[4])
 | 
			
		||||
						/ (p[33] + Y[4] + p[33] * p[36] * Y[3] + p[39] * Y[3]
 | 
			
		||||
								* Y[4])
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * zuvor: // AHAS: convenience (p[0] * pyr)/(p[9] * (1 + pyr/p[12] +
 | 
			
		||||
		 * Math.pow(pyr/p[12], 2)) + Y[3] * (1 + pyr/p[12] + Math.pow(pyr/p[12],
 | 
			
		||||
		 * 2))), // AHAIR: convenience (p[1] * Y[2] * nadph - p[2] * Y[0] *
 | 
			
		||||
		 * nadp)/((1 + Y[2]/p[13] + nadph/p[14] + (Y[2]*nadph)/(p[13]*p[14]) +
 | 
			
		||||
		 * Y[0]/p[15] + nadp/p[16] + (Y[0] * nadp)/(p[15] * p[16])) * p[10] *
 | 
			
		||||
		 * Y[3]), // DHAD: reversible Michaelis Menten with two inhibitions
 | 
			
		||||
		 * (p[28]* Y[0])/(p[31] + Y[0] + Y[3] * (p[28] * p[34] + p[37] * Y[0])), //
 | 
			
		||||
		 * BCAAT_ValB: convenience (p[3] * Y[5] * glut)/(1 + Y[5]/p[17] +
 | 
			
		||||
		 * glut/p[18] + (Y[5] * glut)/(p[17] * p[18])), // BCAAT_ValC:
 | 
			
		||||
		 * convenience (p[4] * Y[5] * ala)/(1 + Y[5]/p[19] + ala/p[20] + (Y[5] *
 | 
			
		||||
		 * ala)/(p[19] * p[20])), // Trans_Val: irreversible Michaelis Menten
 | 
			
		||||
		 * with two inhibitions (p[29] * Y[3])/(p[32] + Y[3] + p[32] * p[35] *
 | 
			
		||||
		 * Y[4] + p[38] * Y[3] * Y[4]), // IPMS: convenience (p[5] * Y[5])/((1 +
 | 
			
		||||
		 * Y[5]/p[21] + p[40] + (p[40] * Y[5])/p[21]) * (p[11] + Y[4])), //
 | 
			
		||||
		 * IPMDH: convenience (p[6] * Y[1] * nad)/(1 + Y[1]/p[22] + nad/p[23] +
 | 
			
		||||
		 * (Y[1] * nad)/(p[22] * p[23])), // BCAAT_LeuB: convenience (p[7] *
 | 
			
		||||
		 * Y[6] * glut - p[8] * Y[4] * akg)/(1 + Y[6]/p[24] + glut/p[25] + (Y[6] *
 | 
			
		||||
		 * glut)/(p[24] * p[25]) + Y[4]/p[26] + akg/p[27] + (Y[4] * akg)/(p[26] *
 | 
			
		||||
		 * p[27])), // Trans_Leu: irreversible Michaelis Menten with two
 | 
			
		||||
		 * inhibitions (p[30] * Y[4])/(p[33] + Y[4] + p[33] * p[36] * Y[3] +
 | 
			
		||||
		 * p[39] * Y[3] * Y[4])
 | 
			
		||||
		 */
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] resultVector) {
 | 
			
		||||
		double tmp[] = getValue(t, Y);
 | 
			
		||||
		System.arraycopy(tmp, 0, resultVector, 0, tmp.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 41;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,117 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class describes the valine/leucine biosynthesis in <it>Corynebacterium
 | 
			
		||||
 * glutamicum</it> acording to the convenience kinetics as proposed by
 | 
			
		||||
 * Liebermeister and Klipp. Three reaction velocities follow the traditional
 | 
			
		||||
 * Michaelis Menten scheme the others are given in the convenience kinetics.
 | 
			
		||||
 * However, in this class all reactions are assumed to be reversible.
 | 
			
		||||
 *
 | 
			
		||||
 * @since 2.0
 | 
			
		||||
 * @version
 | 
			
		||||
 * @author Andreas Dräger (draeger) <andreas.draeger@uni-tuebingen.de>
 | 
			
		||||
 *         Copyright (c) ZBiT, University of Tübingen, Germany Compiler:
 | 
			
		||||
 *         JDK 1.6.0
 | 
			
		||||
 * @date 2007-02-05
 | 
			
		||||
 */
 | 
			
		||||
public class CKMMrSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 726678613269764327L;
 | 
			
		||||
	transient protected double velocities[] = null;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param x
 | 
			
		||||
	 */
 | 
			
		||||
	public CKMMrSystem(double[] x) {
 | 
			
		||||
		this.p = x;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public CKMMrSystem() {
 | 
			
		||||
		super();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
 | 
			
		||||
		double[] res = new double[7];
 | 
			
		||||
		getValue(t, Y, res);
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] res) {
 | 
			
		||||
		double pyr = getPyr_2(t), nadp = getNADP_2(t), nadph = 0.04 - nadp, glut = getGlut_2(t), akg = getAKG_2(t), ala = getAla_2(t), nad = getNAD_2(t), nadh = 0.8 - nad;
 | 
			
		||||
 | 
			
		||||
		if (velocities == null)
 | 
			
		||||
			velocities = new double[10];
 | 
			
		||||
 | 
			
		||||
		// v_1
 | 
			
		||||
		velocities[0] = ((p[0] * p[44] * Math.pow(pyr, 2)) / Math.pow(p[14], 2) - (p[7]
 | 
			
		||||
				* p[44] * Y[2])
 | 
			
		||||
				/ p[15])
 | 
			
		||||
				/ ((1 + pyr / p[14] + Math.pow(pyr / p[14], 2) + Y[2] / p[15]) * (p[44] + Y[3]));
 | 
			
		||||
		// v_2
 | 
			
		||||
		velocities[1] = ((p[1] * p[45] * Y[2] * nadph) / (p[16] * p[17]) - (p[8]
 | 
			
		||||
				* p[45] * Y[0] * nadp)
 | 
			
		||||
				/ (p[18] * p[19]))
 | 
			
		||||
				/ ((1 + Y[2] / p[16] + nadph / p[17] + (Y[2] * nadph)
 | 
			
		||||
						/ (p[16] * p[17]) + Y[0] / p[18] + nadp / p[19] + (Y[0] * nadp)
 | 
			
		||||
						/ (p[18] * p[19])) * (p[45] + Y[3]));
 | 
			
		||||
		// v_3
 | 
			
		||||
		velocities[2] = ((p[47] * Y[0]) / p[20] - (p[48] * Y[5]) / p[21])
 | 
			
		||||
				/ (1 + p[51] * Y[3] + (Y[0] / p[20] + Y[5] / p[21])
 | 
			
		||||
						* (1 + p[54] * Y[3]));
 | 
			
		||||
		// v_4
 | 
			
		||||
		velocities[3] = ((p[2] * Y[5] * glut) / (p[22] * p[23]) - (p[9] * Y[3] * akg)
 | 
			
		||||
				/ (p[24] * p[25]))
 | 
			
		||||
				/ (1 + Y[5] / p[22] + glut / p[23] + (Y[5] * glut)
 | 
			
		||||
						/ (p[22] * p[23]) + Y[3] / p[24] + akg / p[25] + (Y[3] * akg)
 | 
			
		||||
						/ (p[24] * p[25]));
 | 
			
		||||
		// v_5
 | 
			
		||||
		velocities[4] = ((p[3] * Y[5] * ala) / (p[26] * p[27]) - (p[10] * Y[3] * pyr)
 | 
			
		||||
				/ (p[28] * p[29]))
 | 
			
		||||
				/ (1 + Y[5] / p[26] + ala / p[27] + (Y[5] * ala)
 | 
			
		||||
						/ (p[26] * p[27]) + Y[3] / p[28] + pyr / p[29] + (Y[3] * pyr)
 | 
			
		||||
						/ (p[28] * p[29]));
 | 
			
		||||
		// v_6
 | 
			
		||||
		velocities[5] = (p[49] * Y[3])
 | 
			
		||||
				/ (p[30] + p[30] * p[52] * Y[4] + Y[3] + p[55] * Y[3] * Y[4]);
 | 
			
		||||
		// v_7
 | 
			
		||||
		velocities[6] = ((p[4] * p[46] * Y[5] * p[57]) / (p[31] * p[32]) - (p[11]
 | 
			
		||||
				* p[46] * Y[1] * p[58])
 | 
			
		||||
				/ (p[33] * p[34]))
 | 
			
		||||
				/ ((1 + Y[5] / p[31] + p[57] / p[32] + (Y[5] * p[57])
 | 
			
		||||
						/ (p[31] * p[32]) + Y[1] / p[33] + p[58] / p[34] + (Y[1] * p[58])
 | 
			
		||||
						/ (p[33] * p[34])) * (p[46] + Y[4]));
 | 
			
		||||
		// v_8
 | 
			
		||||
		velocities[7] = ((p[5] * Y[1] * nad) / (p[35] * p[36]) - (p[12] * Y[6] * nadh)
 | 
			
		||||
				/ (p[37] * p[38]))
 | 
			
		||||
				/ (1 + Y[1] / p[35] + nad / p[36] + (Y[1] * nad)
 | 
			
		||||
						/ (p[35] * p[36]) + Y[6] / p[37] + nadh / p[38] + (Y[6] * nadh)
 | 
			
		||||
						/ (p[37] * p[38]));
 | 
			
		||||
		// v_9
 | 
			
		||||
		velocities[8] = ((p[6] * Y[6] * glut) / (p[39] * p[40]) - (p[13] * Y[4] * akg)
 | 
			
		||||
				/ (p[41] * p[42]))
 | 
			
		||||
				/ (1 + Y[6] / p[39] + glut / p[40] + (Y[6] * glut)
 | 
			
		||||
						/ (p[39] * p[40]) + Y[4] / p[41] + akg / p[42] + (Y[4] * akg)
 | 
			
		||||
						/ (p[41] * p[42]));
 | 
			
		||||
		// v_10
 | 
			
		||||
		velocities[9] = (p[50] * Y[4])
 | 
			
		||||
				/ (p[43] + p[43] * p[53] * Y[3] + Y[4] + p[56] * Y[3] * Y[4]);
 | 
			
		||||
 | 
			
		||||
		linearCombinationOfVelocities(velocities, res);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 59;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,69 @@
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
// Created ad 2007-01-13
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In this class the valine/leucine biosynthesis in Corynebacterium glutamicum
 | 
			
		||||
 * is modeled to be in many reactions irreversible according to what is written
 | 
			
		||||
 * in the KEGG database. Inhibition is modeled as negative exponential function.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class GMAKiSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -5893476466596099997L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param params
 | 
			
		||||
	 */
 | 
			
		||||
	public GMAKiSystem(double params[]) {
 | 
			
		||||
		this.p = params;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public GMAKiSystem() {
 | 
			
		||||
		this.p = null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see javaeva.server.oa.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
		return linearCombinationOfVelocities(new double[] {
 | 
			
		||||
				p[0] * Math.pow(getPyr_2(t), 2)
 | 
			
		||||
						* Math.exp((-p[12]) * Y[3]),
 | 
			
		||||
				(p[1] * Y[2] * (0.04 - getNADP_2(t)) - p[10] * Y[0]
 | 
			
		||||
						* getNADP_2(t))
 | 
			
		||||
						* Math.exp((-p[13]) * Y[3]),
 | 
			
		||||
				p[2] * Y[0] * Math.exp((-p[14]) * Y[3]),
 | 
			
		||||
				p[3] * getGlut_2(t) * Y[5],
 | 
			
		||||
				p[4] * getAla_2(t) * Y[5],
 | 
			
		||||
				p[5] * Y[3] * Math.exp((-p[15]) * Y[4]),
 | 
			
		||||
				p[6] * Y[5] * Math.exp((-p[16]) * Y[4]),
 | 
			
		||||
				p[7] * getNAD_2(t) * Y[1],
 | 
			
		||||
				p[8] * getGlut_2(t) * Y[6] - p[11] * getAKG_2(t)
 | 
			
		||||
						* Y[4],
 | 
			
		||||
				p[9] * Y[4] * Math.exp((-p[17]) * Y[3]) });
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] resultVector) {
 | 
			
		||||
		double tmp[] = getValue(t, Y);
 | 
			
		||||
		System.arraycopy(tmp, 0, resultVector, 0, tmp.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 18;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,116 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class describes the valine/leucine biosynthesis in Corynebacterium
 | 
			
		||||
 * glutamicum. All 10 reactions are assumed to be reversible and modeled
 | 
			
		||||
 * following the generalized mass action kinetic, where inhibition is modeled
 | 
			
		||||
 * using the function 1/(1 + ki*[Inhibitor]).
 | 
			
		||||
 *
 | 
			
		||||
 * @date 2007-02-04
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMAKrSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -5668558229555497614L;
 | 
			
		||||
	transient double[] veloc = null;
 | 
			
		||||
 | 
			
		||||
	public GMAKrSystem() {
 | 
			
		||||
		super();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param params
 | 
			
		||||
	 */
 | 
			
		||||
	public GMAKrSystem(double params[]) {
 | 
			
		||||
		super();
 | 
			
		||||
		this.p = params;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
		// a <- params[0..9]
 | 
			
		||||
		// b <- params[10..17]
 | 
			
		||||
		// g <- params[18..23]
 | 
			
		||||
		double[] res = new double[7];
 | 
			
		||||
		getValue(t, Y, res);
 | 
			
		||||
		return res;
 | 
			
		||||
		// return linearCombinationOfVelocities(new double[] {
 | 
			
		||||
		// (params[0] * Math.pow(getPyr_2(t), 2) - params[10] * Y[2])/ (1 +
 | 
			
		||||
		// params[18] * Y[3]), // Math.exp((-params[18]) * Y[3]),
 | 
			
		||||
		// (params[1] * Y[2] * (.04 - getNADP_2(t)) - params[11] * Y[0] *
 | 
			
		||||
		// getNADP_2(t)) / (1 + params[19] * Y[3]), // * Math.exp((-params[19])
 | 
			
		||||
		// *
 | 
			
		||||
		// Y[3]),
 | 
			
		||||
		// (params[2] * Y[0] - params[12] * Y[5]) / (1 + params[20] * Y[3]), //
 | 
			
		||||
		// *
 | 
			
		||||
		// // Math.exp((-params[20])
 | 
			
		||||
		// // *
 | 
			
		||||
		// // Y[3]),
 | 
			
		||||
		// params[3] * getGlut_2(t) * Y[5] - params[13] * getAKG_2(t) * Y[3],
 | 
			
		||||
		// params[4] * getAla_2(t) * Y[5] - params[14] * getPyr_2(t) * Y[3],
 | 
			
		||||
		// (params[5] * Y[3]) / (1 + params[21] * Y[4]), // *
 | 
			
		||||
		// // Math.exp((-params[21])
 | 
			
		||||
		// // * Y[4]),
 | 
			
		||||
		// (params[6] * Y[5] - params[15] * Y[1]) / (1 + params[22] * Y[4]), //
 | 
			
		||||
		// *
 | 
			
		||||
		// // Math.exp((-params[22])
 | 
			
		||||
		// // *
 | 
			
		||||
		// // Y[4]),
 | 
			
		||||
		// params[7] * getNAD_2(t) * Y[1] - params[16] * Y[6] * (.8 -
 | 
			
		||||
		// getNAD_2(t)),
 | 
			
		||||
		// params[8] * getGlut_2(t) * Y[6] - params[17] * getAKG_2(t) * Y[4],
 | 
			
		||||
		// (params[9] * Y[4]) / (1 + params[23] * Y[3]) // *
 | 
			
		||||
		// // Math.exp((-params[23])
 | 
			
		||||
		// // * Y[3])
 | 
			
		||||
		// });
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] res) {
 | 
			
		||||
		if (veloc == null)
 | 
			
		||||
			veloc = new double[10];
 | 
			
		||||
 | 
			
		||||
		veloc[0] = (p[0] * Math.pow(getPyr_2(t), 2) - p[10] * Y[2])
 | 
			
		||||
				/ (1 + p[18] * Y[3]); // Math.exp((-params[18]) * Y[3]),
 | 
			
		||||
		veloc[1] = (p[1] * Y[2] * (.04 - getNADP_2(t)) - p[11] * Y[0]
 | 
			
		||||
				* getNADP_2(t))
 | 
			
		||||
				/ (1 + p[19] * Y[3]); // * Math.exp((-params[19]) * Y[3]),
 | 
			
		||||
		veloc[2] = (p[2] * Y[0] - p[12] * Y[5])
 | 
			
		||||
				/ (1 + p[20] * Y[3]); // *
 | 
			
		||||
		// Math.exp((-params[20])
 | 
			
		||||
		// *
 | 
			
		||||
		// Y[3]),
 | 
			
		||||
		veloc[3] = p[3] * getGlut_2(t) * Y[5] - p[13] * getAKG_2(t)
 | 
			
		||||
				* Y[3];
 | 
			
		||||
		veloc[4] = p[4] * getAla_2(t) * Y[5] - p[14] * getPyr_2(t)
 | 
			
		||||
				* Y[3];
 | 
			
		||||
		veloc[5] = (p[5] * Y[3]) / (1 + p[21] * Y[4]); // *
 | 
			
		||||
		// Math.exp((-params[21])
 | 
			
		||||
		// * Y[4]),
 | 
			
		||||
		veloc[6] = (p[6] * Y[5] - p[15] * Y[1])
 | 
			
		||||
				/ (1 + p[22] * Y[4]); // *
 | 
			
		||||
		// Math.exp((-params[22])
 | 
			
		||||
		// *
 | 
			
		||||
		// Y[4]),
 | 
			
		||||
		veloc[7] = p[7] * getNAD_2(t) * Y[1] - p[16] * Y[6]
 | 
			
		||||
				* (.8 - getNAD_2(t));
 | 
			
		||||
		veloc[8] = p[8] * getGlut_2(t) * Y[6] - p[17] * getAKG_2(t)
 | 
			
		||||
				* Y[4];
 | 
			
		||||
		veloc[9] = (p[9] * Y[4]) / (1 + p[23] * Y[3]); // *
 | 
			
		||||
		linearCombinationOfVelocities(veloc, res);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 24;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,120 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
// Created at 2007-01-18
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class implements a system of ordinary differential equations describing
 | 
			
		||||
 * the valine and leucin biosynthesis in <it>Corynebacterium gluthamicum</i>.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMMiSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated version id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 6119930633376953563L;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * <p>
 | 
			
		||||
	 * A vector of parameters it needed to initialize this class. The parameters
 | 
			
		||||
	 * are given as:
 | 
			
		||||
	 * </p>
 | 
			
		||||
	 * <ul>
 | 
			
		||||
	 * <li>params[0-6] = k, Rate constant for the forward reaction</li>
 | 
			
		||||
	 * <li>params[7-8] = l, Rate constant for the backward reaction</li>
 | 
			
		||||
	 * <li>params[9-11] = ki, Rate constant for inhibition of uncertain
 | 
			
		||||
	 * mechanism</li>
 | 
			
		||||
	 * <li>params[12-14] = vm, Maximal reaction velocity</li>
 | 
			
		||||
	 * <li>params[15-17] = kia, Rate constant for inhibition of the enzyme</li>
 | 
			
		||||
	 * <li>params[18-20] = kib, Rate constant for inhibition of the enzyme
 | 
			
		||||
	 * substrate complex</li>
 | 
			
		||||
	 * <li>params[21-23] = km, the Michaelis-Menten constant</li>
 | 
			
		||||
	 * </ul>
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param params
 | 
			
		||||
	 */
 | 
			
		||||
	public GMMiSystem(double[] params) {
 | 
			
		||||
		if (params != null)
 | 
			
		||||
			if (params.length != 24)
 | 
			
		||||
				throw new Error(
 | 
			
		||||
						"This ODE system needs exactly 24 parameters. Given are "
 | 
			
		||||
								+ params.length);
 | 
			
		||||
		this.p = params;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	public GMMiSystem() {
 | 
			
		||||
		this.p = null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see javaeva.server.oa.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
		double[] v = new double[] {
 | 
			
		||||
		// v_1
 | 
			
		||||
				(p[0] * Math.pow(getPyr_2(t), 2)) / (1 + p[9] * Y[3]),
 | 
			
		||||
				// v_2
 | 
			
		||||
				(p[1] * Y[2] * (0.04 - getNADP_2(t)) - p[7] * Y[0]
 | 
			
		||||
						* getNADP_2(t))
 | 
			
		||||
						/ (1 + p[10] * Y[3]),
 | 
			
		||||
				// v_3
 | 
			
		||||
				// ((p[12] * Y[0])/p[21])/(1 + p[15] * Y[3] + (Y[0] + p[18] *
 | 
			
		||||
				// Y[3] *
 | 
			
		||||
				// Y[0])/p[21]),
 | 
			
		||||
				(p[12] * Y[0])
 | 
			
		||||
						/ (p[21] + Y[0] + p[21] * p[15] * Y[3] + p[18] * Y[0]
 | 
			
		||||
								* Y[3]),
 | 
			
		||||
				// v_4
 | 
			
		||||
				p[2] * Y[5] * getGlut_2(t),
 | 
			
		||||
				// v_5
 | 
			
		||||
				p[3] * Y[5] * getAla_2(t),
 | 
			
		||||
				// v_6
 | 
			
		||||
				// (p[13]/p[22] * Y[3])/(1 + p[16] * Y[4] + (Y[3] + p[19] * Y[4]
 | 
			
		||||
				// *
 | 
			
		||||
				// Y[3])/p[22]),
 | 
			
		||||
				(p[13] * Y[3])
 | 
			
		||||
						/ (p[22] + Y[3] + p[22] * p[16] * Y[4] + p[19] * Y[3]
 | 
			
		||||
								* Y[4]),
 | 
			
		||||
				// v_7
 | 
			
		||||
				(p[4] * Y[5]) / (1 + p[11] * Y[4]),
 | 
			
		||||
				// v_8
 | 
			
		||||
				p[5] * Y[1] * getNAD_2(t),
 | 
			
		||||
				// v_9
 | 
			
		||||
				p[6] * Y[6] * getGlut_2(t) - p[8] * Y[4] * getAKG_2(t),
 | 
			
		||||
				// v_10
 | 
			
		||||
				// ((p[14] * Y[4])/p[23])/(1 + p[17] * Y[3] + (Y[4] + p[20] *
 | 
			
		||||
				// Y[3] *
 | 
			
		||||
				// Y[4])/p[23])
 | 
			
		||||
				(p[14] * Y[4])
 | 
			
		||||
						/ (p[23] + Y[4] + p[17] * p[23] * Y[3] + p[20] * Y[3]
 | 
			
		||||
								* Y[4]) };
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * if ((Double.isNaN(v[0]) || Double.isInfinite(v[0])) && (t < -1.784)) {
 | 
			
		||||
		 * System.out.println(t+". Nenner: "+(1 + p[9] * Y[3])+"\tY[3] =
 | 
			
		||||
		 * "+Y[3]+"\tparam9 = "+p[9]); }//
 | 
			
		||||
		 */
 | 
			
		||||
		return linearCombinationOfVelocities(v);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] resultVector) {
 | 
			
		||||
		double tmp[] = getValue(t, Y);
 | 
			
		||||
		System.arraycopy(tmp, 0, resultVector, 0, tmp.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 24;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,87 @@
 | 
			
		||||
package eva2.server.go.problems.inference.metabolic.odes;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class describes the valine/leucine biosynthesis in Corynebacterium
 | 
			
		||||
 * gluthamicum where three reactions are modeled using traditional reversible
 | 
			
		||||
 * Michaelis Menten kinetics and the remaining reactions are modeled using
 | 
			
		||||
 * reversible generalized mass action kinetics, where inhibition is modeled
 | 
			
		||||
 * using 1/(1 + ki*[Inhibitor]). Created at 2007-02-04.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Andreas Dräger
 | 
			
		||||
 */
 | 
			
		||||
public class GMMrSystem extends AbstractValineSystem {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Generated serial id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = 7461506193192163451L;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 *
 | 
			
		||||
	 */
 | 
			
		||||
	public GMMrSystem() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param params
 | 
			
		||||
	 */
 | 
			
		||||
	public GMMrSystem(double[] params) {
 | 
			
		||||
		this.p = params;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * (non-Javadoc)
 | 
			
		||||
	 *
 | 
			
		||||
	 * @see eva2.server.go.OptimizationProblems.InferenceRegulatoryNetworks.Des.DESystem#getValue(double,
 | 
			
		||||
	 *      double[])
 | 
			
		||||
	 */
 | 
			
		||||
	public double[] getValue(double t, double[] Y) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * double[] a = null, // <- params[0..6] 7 b = null, // <- params[7..13]
 | 
			
		||||
		 * 7 vm = null, // <- params[14..17] 4 km = null, // <- params[18..21] 4
 | 
			
		||||
		 * kia = null, // <- params[22..24] 3 kib = null, // <- params[25..27] 3
 | 
			
		||||
		 * ki = null; // <- params[28..30] 3 //
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		return linearCombinationOfVelocities(new double[] {
 | 
			
		||||
		// v_1
 | 
			
		||||
				(p[0] * Math.pow(getPyr_2(t), 2) - p[7] * Y[2])
 | 
			
		||||
						/ (1 + p[28] * Y[3]),
 | 
			
		||||
				// v_2
 | 
			
		||||
				(p[1] * Y[2] * (.04 - getNADP_2(t)) - p[8] * Y[0]
 | 
			
		||||
						* getNADP_2(t))
 | 
			
		||||
						/ (1 + p[29] * Y[3]),
 | 
			
		||||
				// v_3
 | 
			
		||||
				((p[14] * Y[0]) / p[18] - (p[15] * Y[5]) / p[19])
 | 
			
		||||
						/ (1 + p[22] * Y[3] + (Y[0] / p[18] + Y[5] / p[19])
 | 
			
		||||
								* (1 + p[25] * Y[3])),
 | 
			
		||||
				// v_4
 | 
			
		||||
				p[2] * Y[5] * getGlut_2(t) - p[9] * Y[3] * getAKG_2(t),
 | 
			
		||||
				// v_5
 | 
			
		||||
				p[3] * Y[5] * getAla_2(t) - p[10] * Y[3] * getPyr_2(t),
 | 
			
		||||
				// v_6
 | 
			
		||||
				(p[16] * Y[3])
 | 
			
		||||
						/ (p[20] + p[20] * p[23] * Y[4] + Y[3] + p[26] * Y[4]
 | 
			
		||||
								* Y[3]),
 | 
			
		||||
				// v_7
 | 
			
		||||
				(p[4] * Y[5] - p[11] * Y[1]) / (1 + p[30] * Y[4]),
 | 
			
		||||
				// v_8
 | 
			
		||||
				p[5] * Y[1] * getNAD_2(t) - p[12] * Y[6] * (.8 - getNAD_2(t)),
 | 
			
		||||
				// v_9
 | 
			
		||||
				p[6] * Y[6] * getGlut_2(t) - p[13] * Y[4] * getAKG_2(t),
 | 
			
		||||
				// v_10
 | 
			
		||||
				(p[17] * Y[4])
 | 
			
		||||
						/ (p[21] + p[21] * p[24] * Y[3] + Y[4] + p[27] * Y[3]
 | 
			
		||||
								* Y[4]) });
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void getValue(double t, double[] Y, double[] resultVector) {
 | 
			
		||||
		resultVector = getValue(t, Y);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getNumberOfParameters() {
 | 
			
		||||
		return 31;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -20,7 +20,11 @@ import eva2.server.go.problems.InterfaceOptimizationProblem;
 | 
			
		||||
 *            $Author: mkron $
 | 
			
		||||
 */
 | 
			
		||||
public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializable {
 | 
			
		||||
    // These variables are necessary for the simple testcase
 | 
			
		||||
    /**
 | 
			
		||||
	 * Generated serial version id.
 | 
			
		||||
	 */
 | 
			
		||||
	private static final long serialVersionUID = -751760624411490405L;
 | 
			
		||||
	// These variables are necessary for the simple testcase
 | 
			
		||||
    private InterfaceOptimizationProblem    m_Problem               = new B1Problem();
 | 
			
		||||
    private int                             m_MultiRuns             = 100;
 | 
			
		||||
    private int                             m_FitnessCalls          = 100;
 | 
			
		||||
@@ -60,7 +64,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
 | 
			
		||||
     */
 | 
			
		||||
    public void initByPopulation(Population pop, boolean reset) {
 | 
			
		||||
        this.m_Population = (Population)pop.clone();
 | 
			
		||||
        if (reset) this.m_Population.init();        
 | 
			
		||||
        if (reset) this.m_Population.init();
 | 
			
		||||
        this.m_Problem.evaluate(this.m_Population);
 | 
			
		||||
        this.firePropertyChangedEvent("NextGenerationPerformed");
 | 
			
		||||
    }
 | 
			
		||||
@@ -171,7 +175,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
 | 
			
		||||
     */
 | 
			
		||||
    public void freeWilly() {
 | 
			
		||||
 | 
			
		||||
    }    
 | 
			
		||||
    }
 | 
			
		||||
/**********************************************************************************************************************
 | 
			
		||||
 * These are for GUI
 | 
			
		||||
 */
 | 
			
		||||
@@ -201,7 +205,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
 | 
			
		||||
    public String populationTipText() {
 | 
			
		||||
        return "Change the number of best individuals stored.";
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public InterfaceSolutionSet getAllSolutions() {
 | 
			
		||||
    	return new SolutionSet(getPopulation());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user