/** * Factor method for creating a GA object, with the GA class specified by the problem-class * parameter. */ public static GA GAWithParameters(HashMap<String, String> inParams) throws Exception { Class<?> cls = Class.forName(inParams.get("problem-class")); Object gaObject = cls.newInstance(); if (!(gaObject instanceof GA)) throw (new Exception("problem-class must inherit from class GA")); GA ga = (GA) gaObject; ga.SetParams(inParams); ga.InitFromParameters(); return ga; }