MMGInstance {{ public double quality(SolutionI solution) { MMGSolution mmgSolution = (MMGSolution) solution; double y = mmgSolution.y; double c = x*y+(1-x)*(1-y*y); return c; } public double valid(SolutionI solution, Config config) { MMGSolution mmgSolution = (MMGSolution) solution; double y = mmgSolution.y; double c = x*y+(1-x)*(1-y*y); // Is C between 0 and 1 boolean isValidC = c>=0 && c<=1; boolean isValid = y>=0 && y<=1; // if C is between 0 and 1 and y is between 0 and 1, the solution is valid if(isValid && isValidC) return 1; else return 0; } }} MMGSolution {{ }} MMGInstanceSet {{ private static MMGInstanceSet instance = new MMGInstanceSet(); public static MMGInstanceSet getInstance() { return instance; } public Option belongsTo(InstanceI instance) { MMGInstance mmgInstance = (MMGInstance) instance; double x = mmgInstance.x; boolean isValid = x>=0 && x<=1; if(isValid) return Option.none(); else return Option.some("x not in [0,1]"); } public Option valid(Config config) { return Option.none(); } }} MMGDomain {{ }} MMGConfig {{ private static MMGConfig DEFAULT_MMG_CONFIG; static{ try{ DEFAULT_MMG_CONFIG = MMGConfig.parse( "mmg_config[\n" + "maxDigits: 3\n" + "]" ); }catch(Exception ex){ ex.printStackTrace(); } } public static MMGConfig getDefaultDomainConfig(){ return MMGConfig.DEFAULT_MMG_CONFIG; } public static Config getDefaultConfig(){ return new Config(SCGConfig.getDefaultSCGConfig(), getDefaultDomainConfig()); } }}