当前位置: 首页>>代码示例>>Java>>正文


Java DataProperties类代码示例

本文整理汇总了Java中org.cpsolver.ifs.util.DataProperties的典型用法代码示例。如果您正苦于以下问题:Java DataProperties类的具体用法?Java DataProperties怎么用?Java DataProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataProperties类属于org.cpsolver.ifs.util包,在下文中一共展示了DataProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public void load(DataProperties properties) {
    setProperties(properties);
    M model = createModel(getProperties());
    Progress.getInstance(model).addProgressListener(new ProgressWriter(System.out));
    
    iWorking = true;
    setInitalSolution(model);
    initSolver();
    
    ProblemLoader<V, T, M> loader = getDatabaseLoader(model, currentSolution().getAssignment());
    loader.setCallback(getLoadingDoneCallback());
    iWorkThread = new InterruptibleThread(loader);
    loader.setTerminationCondition((InterruptibleThread)iWorkThread);
    iWorkThread.setPriority(THREAD_PRIORITY);
    iWorkThread.start();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:18,代码来源:AbstractSolver.java

示例2: reload

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public void reload(DataProperties properties) {
    if (currentSolution()==null || currentSolution().getModel()==null) {
        load(properties);
        return;
    }
    
    Callback callBack = getReloadingDoneCallback();
    setProperties(properties);
    M model = createModel(getProperties());
    
    iWorking = true;
    Progress.changeInstance(currentSolution().getModel(),model);
    setInitalSolution(model);
    initSolver();
    
    ProblemLoader<V, T, M> loader = getDatabaseLoader(model, currentSolution().getAssignment());
    loader.setCallback(callBack);
    iWorkThread = new InterruptibleThread(loader);
    loader.setTerminationCondition((InterruptibleThread)iWorkThread);
    iWorkThread.start();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:AbstractSolver.java

示例3: naive

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
public void naive(DataProperties cfg, Assignment<CurVariable, CurValue> assignment) {
  	int maxIdle = cfg.getPropertyInt("Curriculum.Naive.MaxIdle", 1000);
  	sLog.debug("  -- running naive");
int idle = 0, it = 0;
double best = getTotalValue(assignment);
CurStudentSwap sw = new CurStudentSwap(cfg);
Solution<CurVariable, CurValue> solution = new Solution<CurVariable, CurValue>(this, assignment);
while (!getSwapCourses().isEmpty() && idle < maxIdle && canContinue()) {
	Neighbour<CurVariable, CurValue> n = sw.selectNeighbour(solution);
	if (n == null) break;
	double value = n.value(assignment);
	if (value < -0.00001) {
		idle = 0;
		n.assign(assignment, it);
	} else if (value <= 0.0) {
		n.assign(assignment, it);
	}
	if (getTotalValue(assignment) < best) {
		best = getTotalValue(assignment);
		sLog.debug("  -- best value: " + toString(assignment));
	}
	it++; idle++;
}
sLog.debug("  -- final value: " + toString(assignment));
  }
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:CurModel.java

示例4: CurriculaRequestsCourseDemands

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
public CurriculaRequestsCourseDemands(DataProperties config) {
	iProperties = config;
	iStudentCourseRequests = new StudentCourseRequests(config);
	iIncludeOtherStudents = config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherStudents", iIncludeOtherStudents);
	iIncludeOtherCourses = config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherCourses", config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherStudents", iIncludeOtherCourses));
	iSetStudentCourseLimits = config.getPropertyBoolean("CurriculaCourseDemands.SetStudentCourseLimits", iSetStudentCourseLimits);
	iCreateStudentGroups = config.getPropertyBoolean("CurriculaCourseDemands.CreateStudentGroups", iCreateStudentGroups);
	iEnrollmentPriorityProvider = new DefaultCurriculumEnrollmentPriorityProvider(config);
	if (config.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider") != null) {
		try {
			iEnrollmentPriorityProvider = (CurriculumEnrollmentPriorityProvider)Class.forName(
					config.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider"))
					.getConstructor(DataProperties.class).newInstance(config);
		} catch (Exception e) {
			sLog.error("Failed to use custom enrollment priority provider: " + e.getMessage(), e);
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:CurriculaRequestsCourseDemands.java

示例5: CurriculaLastLikeCourseDemands

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
public CurriculaLastLikeCourseDemands(DataProperties config) {
	iProperties = config;
	iProjectedDemands = new ProjectedStudentCourseDemands(config);
	iIncludeOtherStudents = config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherStudents", iIncludeOtherStudents);
	iIncludeOtherCourses = config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherCourses", config.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherStudents", iIncludeOtherCourses));
	iSetStudentCourseLimits = config.getPropertyBoolean("CurriculaCourseDemands.SetStudentCourseLimits", iSetStudentCourseLimits);
	iCreateStudentGroups = config.getPropertyBoolean("CurriculaCourseDemands.CreateStudentGroups", iCreateStudentGroups);
	iEnrollmentPriorityProvider = new DefaultCurriculumEnrollmentPriorityProvider(config);
	if (config.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider") != null) {
		try {
			iEnrollmentPriorityProvider = (CurriculumEnrollmentPriorityProvider)Class.forName(
					config.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider"))
					.getConstructor(DataProperties.class).newInstance(config);
		} catch (Exception e) {
			sLog.error("Failed to use custom enrollment priority provider: " + e.getMessage(), e);
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:CurriculaLastLikeCourseDemands.java

示例6: CurriculaCourseDemands

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
public CurriculaCourseDemands(DataProperties properties) {
	iProperties = properties;
	if (properties != null)
		iFallback = new ProjectedStudentCourseDemands(properties);
	iIncludeOtherStudents = properties.getPropertyBoolean("CurriculaCourseDemands.IncludeOtherStudents", iIncludeOtherStudents);
	iSetStudentCourseLimits = properties.getPropertyBoolean("CurriculaCourseDemands.SetStudentCourseLimits", iSetStudentCourseLimits);
	iCreateStudentGroups = properties.getPropertyBoolean("CurriculaCourseDemands.CreateStudentGroups", iCreateStudentGroups);
	iEnrollmentPriorityProvider = new DefaultCurriculumEnrollmentPriorityProvider(properties);
	if (properties.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider") != null) {
		try {
			iEnrollmentPriorityProvider = (CurriculumEnrollmentPriorityProvider)Class.forName(
					properties.getProperty("CurriculaCourseDemands.CurriculumEnrollmentPriorityProvider"))
					.getConstructor(DataProperties.class).newInstance(properties);
		} catch (Exception e) {
			sLog.error("Failed to use custom enrollment priority provider: " + e.getMessage(), e);
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:CurriculaCourseDemands.java

示例7: createSolver

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public StudentSolverProxy createSolver(DataProperties properties) {
	try {
		if (!sessionContext.isAuthenticated() || sessionContext.getUser().getCurrentAcademicSessionId() == null) return null;
		
		removeSolver();
			
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("General.OwnerPuid", sessionContext.getUser().getExternalUserId());
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));
		
		String host = properties.getProperty("General.Host");
	    
	    String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);
	    
	    StudentSolverProxy solver = solverServerService.createStudentSolver(host, sessionContext.getUser().getExternalUserId(), properties);
	    solver.load(properties);
	    
    	return solver;
	} catch (Exception e) {
		sLog.error("Failed to start the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:27,代码来源:StudentSectioningSolverService.java

示例8: reload

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public StudentSolverProxy reload(DataProperties properties) {
	try {
		StudentSolverProxy solver = getSolver();
		if (solver == null) return createSolver(properties);

		DataProperties oldProperties = solver.getProperties();
		
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("General.OwnerPuid", oldProperties.getProperty("General.OwnerPuid"));
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));

		String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);

	    solver.reload(properties);
	    
	    return solver;
	} catch (Exception e) {
		sLog.error("Failed to reload the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:25,代码来源:StudentSectioningSolverService.java

示例9: createSolver

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public ExamSolverProxy createSolver(DataProperties properties) {
	try {
		if (!sessionContext.isAuthenticated() || sessionContext.getUser().getCurrentAcademicSessionId() == null) return null;
		
		removeSolver();
			
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("General.OwnerPuid", sessionContext.getUser().getExternalUserId());
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));
		
		String host = properties.getProperty("General.Host");
	    
	    String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);
	    
	    ExamSolverProxy solver = solverServerService.createExamSolver(host, sessionContext.getUser().getExternalUserId(), properties);
	    solver.load(properties);
	    return solver;
	} catch (Exception e) {
		sLog.error("Failed to start the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:ExaminationSolverService.java

示例10: reload

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public ExamSolverProxy reload(DataProperties properties) {
	try {
		ExamSolverProxy solver = getSolver();
		if (solver == null) return createSolver(properties);

		DataProperties oldProperties = solver.getProperties();
		
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("Exam.Type",oldProperties.getProperty("Exam.Type"));
		properties.setProperty("General.OwnerPuid", oldProperties.getProperty("General.OwnerPuid"));
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));

		String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);

	    solver.reload(properties);
	    
	    return solver;
	} catch (Exception e) {
		sLog.error("Failed to reload the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:ExaminationSolverService.java

示例11: createSolver

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public InstructorSchedulingProxy createSolver(DataProperties properties) {
	try {
		if (!sessionContext.isAuthenticated() || sessionContext.getUser().getCurrentAcademicSessionId() == null) return null;
		
		removeSolver();
			
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("General.OwnerPuid", sessionContext.getUser().getExternalUserId());
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));
		
		String host = properties.getProperty("General.Host");
	    
	    String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);
	    
	    InstructorSchedulingProxy solver = solverServerService.createInstructorScheduling(host, sessionContext.getUser().getExternalUserId(), properties);
	    solver.load(properties);
	    return solver;
	} catch (Exception e) {
		sLog.error("Failed to start the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:InstructorSchedulingSolverService.java

示例12: reload

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public InstructorSchedulingProxy reload(DataProperties properties) {
	try {
		InstructorSchedulingProxy solver = getSolver();
		if (solver == null) return createSolver(properties);

		DataProperties oldProperties = solver.getProperties();
		
		properties.setProperty("General.SessionId", sessionContext.getUser().getCurrentAcademicSessionId().toString());
		properties.setProperty("General.OwnerPuid", oldProperties.getProperty("General.OwnerPuid"));
		properties.setProperty("General.SolverGroupId",oldProperties.getProperty("General.SolverGroupId"));
		properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));

		String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
	    if (instructorFormat != null)
	    	properties.setProperty("General.InstructorFormat",instructorFormat);

	    solver.reload(properties);
	    
	    return solver;
	} catch (Exception e) {
		sLog.error("Failed to reload the solver: " + e.getMessage(), e);
		throw (e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:26,代码来源:InstructorSchedulingSolverService.java

示例13: start

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public void start() {
	iPassivation = new PassivationThread(ApplicationProperties.getPassivationFolder());
	iPassivation.start();
	File folder = ApplicationProperties.getRestoreFolder();
	if (!folder.exists() || !folder.isDirectory()) return;
	
	BackupFileFilter filter = new BackupFileFilter(SolverParameterGroup.SolverType.INSTRUCTOR);
	File[] files = folder.listFiles(filter);
	for (int i=0;i<files.length;i++) {
		File file = files[i];
		String user = filter.getUser(file);
		InstructorSchedulingSolver solver = new InstructorSchedulingSolver(new DataProperties(), new SolverOnDispose(user));
		if (solver.restore(folder,user)) {
			if (ApplicationProperties.getPassivationFolder() != null)
				solver.passivate(ApplicationProperties.getPassivationFolder(), user);
			iInstrSchdSolvers.put(user, solver);
		}

	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:InstructorSchedulingContainer.java

示例14: start

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public void start() {
	iPassivation = new PassivationThread(ApplicationProperties.getPassivationFolder());
	iPassivation.start();
	File folder = ApplicationProperties.getRestoreFolder();
	if (!folder.exists() || !folder.isDirectory()) return;

	BackupFileFilter filter = new BackupFileFilter(SolverParameterGroup.SolverType.STUDENT);
	File[] files = folder.listFiles(filter);
	for (int i=0;i<files.length;i++) {
		File file = files[i];
		String user = filter.getUser(file);
		StudentSolver solver = new StudentSolver(new DataProperties(), new SolverOnDispose(user));
		if (solver.restore(folder, user)) {
			if (ApplicationProperties.getPassivationFolder() != null)
				solver.passivate(ApplicationProperties.getPassivationFolder(), user);
			iStudentSolvers.put(user, solver);
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:21,代码来源:StudentSolverContainer.java

示例15: start

import org.cpsolver.ifs.util.DataProperties; //导入依赖的package包/类
@Override
public void start() {
	iPassivation = new PassivationThread(ApplicationProperties.getPassivationFolder());
	iPassivation.start();
	File folder = ApplicationProperties.getRestoreFolder();
	if (!folder.exists() || !folder.isDirectory()) return;
	
	BackupFileFilter filter = new BackupFileFilter(SolverParameterGroup.SolverType.EXAM);
	File[] files = folder.listFiles(filter);
	for (int i=0;i<files.length;i++) {
		File file = files[i];
		String user = filter.getUser(file);
		ExamSolver solver = new ExamSolver(new DataProperties(), new SolverOnDispose(user));
		if (solver.restore(folder,user)) {
			if (ApplicationProperties.getPassivationFolder() != null)
				solver.passivate(ApplicationProperties.getPassivationFolder(), user);
			iExamSolvers.put(user, solver);
		}

	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:ExaminationSolverContainer.java


注:本文中的org.cpsolver.ifs.util.DataProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。