本文整理汇总了Java中org.cpsolver.ifs.util.DataProperties.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java DataProperties.getProperty方法的具体用法?Java DataProperties.getProperty怎么用?Java DataProperties.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cpsolver.ifs.util.DataProperties
的用法示例。
在下文中一共展示了DataProperties.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
}
示例3: 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);
}
}
}
示例4: 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));
}
}
示例5: 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));
}
}
示例6: 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));
}
}
示例7: getSolverMemory
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public static String getSolverMemory(DataProperties solverProperties, SolverType type) {
String ownerId = solverProperties.getProperty("General.OwnerPuid");
if (ownerId != null) {
switch (type) {
case COURSE:
return "<span name='UniTimeGWT:SolverAllocatedMem' style='display: none;'>C" + ownerId + "</span>";
case STUDENT:
return "<span name='UniTimeGWT:SolverAllocatedMem' style='display: none;'>S" + ownerId + "</span>";
case EXAM:
return "<span name='UniTimeGWT:SolverAllocatedMem' style='display: none;'>X" + ownerId + "</span>";
case INSTRUCTOR:
return "<span name='UniTimeGWT:SolverAllocatedMem' style='display: none;'>I" + ownerId + "</span>";
}
}
return "N/A";
}
示例8: NeighbourSearch
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public NeighbourSearch(DataProperties properties) {
iPhase = getClass().getSimpleName().replaceAll("(?<=[^A-Z])([A-Z])"," $1");
iLog = Logger.getLogger(getClass());
iRandomSelection = properties.getPropertyBoolean(getParameterBaseName() + ".Random", iRandomSelection);
iUpdatePoints = properties.getPropertyBoolean(getParameterBaseName() + ".Update", iUpdatePoints);
String neighbours = properties.getProperty(getParameterBaseName() + ".Neighbours",
RandomMove.class.getName() + ";" + RandomSwapMove.class.getName() + "@0.01;" + SuggestionMove.class.getName() + "@0.01");
neighbours += ";" + properties.getProperty(getParameterBaseName() + ".AdditionalNeighbours", "");
iNeighbours = new ArrayList<NeighbourSelector<V,T>>();
for (String neighbour: neighbours.split("\\;")) {
if (neighbour == null || neighbour.isEmpty()) continue;
try {
double bonus = 1.0;
if (neighbour.indexOf('@')>=0) {
bonus = Double.parseDouble(neighbour.substring(neighbour.indexOf('@') + 1));
neighbour = neighbour.substring(0, neighbour.indexOf('@'));
}
Class<NeighbourSelection<V, T>> clazz = (Class<NeighbourSelection<V, T>>)Class.forName(neighbour);
NeighbourSelection<V, T> selection = clazz.getConstructor(DataProperties.class).newInstance(properties);
addNeighbourSelection(selection, bonus);
} catch (Exception e) {
iLog.error("Unable to use " + neighbour + ": " + e.getMessage());
}
}
}
示例9: ExamGreatDeluge
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor. Following problem properties are considered:
* <ul>
* <li>GreatDeluge.CoolRate ... bound cooling rate (default 0.99999995)
* <li>GreatDeluge.UpperBoundRate ... bound upper bound relative to best
* solution ever found (default 1.05)
* <li>GreatDeluge.LowerBoundRate ... bound lower bound relative to best
* solution ever found (default 0.95)
* </ul>
*
* @param properties
* problem properties
*/
@SuppressWarnings("unchecked")
public ExamGreatDeluge(DataProperties properties) {
iCoolRate = properties.getPropertyDouble("GreatDeluge.CoolRate", iCoolRate);
iUpperBoundRate = properties.getPropertyDouble("GreatDeluge.UpperBoundRate", iUpperBoundRate);
iLowerBoundRate = properties.getPropertyDouble("GreatDeluge.LowerBoundRate", iLowerBoundRate);
String neighbours = properties.getProperty("GreatDeluge.Neighbours",
ExamRandomMove.class.getName() + ";" +
ExamRoomMove.class.getName() + ";" +
ExamTimeMove.class.getName());
neighbours += ";" + properties.getProperty("GreatDeluge.AdditionalNeighbours", "");
iNeighbours = new ArrayList<NeighbourSelection<Exam,ExamPlacement>>();
for (String neighbour: neighbours.split("\\;")) {
if (neighbour == null || neighbour.isEmpty()) continue;
try {
Class<NeighbourSelection<Exam, ExamPlacement>> clazz = (Class<NeighbourSelection<Exam, ExamPlacement>>)Class.forName(neighbour);
iNeighbours.add(clazz.getConstructor(DataProperties.class).newInstance(properties));
} catch (Exception e) {
sLog.error("Unable to use " + neighbour + ": " + e.getMessage());
}
}
}
示例10: ExamHillClimbing
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor
*
* @param properties
* problem properties (use HillClimber.MaxIdle to set maximum
* number of idle iterations)
* @param name solver search phase name
*/
@SuppressWarnings("unchecked")
public ExamHillClimbing(DataProperties properties, String name) {
iMaxIdleIters = properties.getPropertyInt("HillClimber.MaxIdle", iMaxIdleIters);
String neighbours = properties.getProperty("HillClimber.Neighbours",
ExamRandomMove.class.getName() + ";" +
ExamRoomMove.class.getName() + ";" +
ExamTimeMove.class.getName());
neighbours += ";" + properties.getProperty("HillClimber.AdditionalNeighbours", "");
iNeighbours = new ArrayList<NeighbourSelection<Exam,ExamPlacement>>();
for (String neighbour: neighbours.split("\\;")) {
if (neighbour == null || neighbour.isEmpty()) continue;
try {
Class<NeighbourSelection<Exam, ExamPlacement>> clazz = (Class<NeighbourSelection<Exam, ExamPlacement>>)Class.forName(neighbour);
iNeighbours.add(clazz.getConstructor(DataProperties.class).newInstance(properties));
} catch (Exception e) {
sLog.error("Unable to use " + neighbour + ": " + e.getMessage());
}
}
iName = name;
}
示例11: BranchBoundSelection
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor
*
* @param properties
* configuration
*/
public BranchBoundSelection(DataProperties properties) {
iTimeout = properties.getPropertyInt("Neighbour.BranchAndBoundTimeout", iTimeout);
iMinimizePenalty = properties.getPropertyBoolean("Neighbour.BranchAndBoundMinimizePenalty", iMinimizePenalty);
if (iMinimizePenalty)
sLog.info("Overall penalty is going to be minimized (together with the maximization of the number of assigned requests and minimization of distance conflicts).");
if (properties.getProperty("Neighbour.BranchAndBoundOrder") != null) {
try {
iOrder = (StudentOrder) Class.forName(properties.getProperty("Neighbour.BranchAndBoundOrder"))
.getConstructor(new Class[] { DataProperties.class }).newInstance(new Object[] { properties });
} catch (Exception e) {
sLog.error("Unable to set student order, reason:" + e.getMessage(), e);
}
}
iDistConfWeight = properties.getPropertyDouble("DistanceConflict.Weight", iDistConfWeight);
iBranchWhenSelectedHasNoConflict = properties.getPropertyBoolean("Students.BranchWhenSelectedHasNoConflict", iBranchWhenSelectedHasNoConflict);
}
示例12: createSolver
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
@Override
public SolverProxy 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.SolverGroupId", ownerIds);
properties.setProperty("General.OwnerPuid", sessionContext.getUser().getExternalUserId());
// if (solutionIds!=null) properties.setProperty("General.SolutionId",solutionIds);
properties.setProperty("General.StartTime", String.valueOf((new Date()).getTime()));
// properties.setProperty("General.StartSolver", Boolean.toString(start));
String host = properties.getProperty("General.Host");
String warn = getSolverWarning(properties);
if (warn!=null)
properties.setProperty("General.SolverWarnings",warn);
else
properties.remove("General.SolverWarnings");
String instructorFormat = sessionContext.getUser().getProperty(UserProperty.NameFormat);
if (instructorFormat != null)
properties.setProperty("General.InstructorFormat",instructorFormat);
SolverProxy solver = solverServerService.createCourseSolver(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));
}
}
示例13: getSolverOwner
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public static String getSolverOwner(DataProperties solverProperties) {
String owner = solverProperties.getProperty("General.OwnerPuid", null);
if (owner != null) {
TimetableManager mgr = TimetableManager.findByExternalId(owner);
if (mgr != null)
owner = mgr.getShortName();
} else {
owner = "N/A";
}
Long[] solverGroupId = solverProperties.getPropertyLongArry("General.SolverGroupId",null);
String problem = null;
if (solverGroupId != null) {
problem = "";
for (int i = 0; i < solverGroupId.length; i++) {
SolverGroup g = SolverGroupDAO.getInstance().get(solverGroupId[i]);
if (g != null)
problem += (i == 0 ? "" : " & ") + g.getAbbv();
}
} else {
Long examTypeId = solverProperties.getPropertyLong("Exam.Type", null);
if (examTypeId != null) {
ExamType type = ExamTypeDAO.getInstance().get(examTypeId);
if (type != null) problem = type.getLabel();
}
}
if (problem == null || problem.isEmpty()) problem = "N/A";
if ("N/A".equals(problem)) return owner;
if ("N/A".equals(owner)) return problem;
if (!owner.equals(problem)) return owner + " as " + problem;
return owner;
}
示例14: getSolverConfiguration
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public static String getSolverConfiguration(DataProperties solverProperties) {
Long settingsId = solverProperties.getPropertyLong("General.SettingsId", null);
if (settingsId != null) {
SolverPredefinedSetting setting = SolverPredefinedSettingDAO.getInstance().get(settingsId);
if (setting != null) return setting.getDescription();
}
return solverProperties.getProperty("Basic.Mode","N/A");
}
示例15: getOnClick
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public String getOnClick(DataProperties solverProperties, SolverType type) {
Long sessionId = solverProperties.getPropertyLong("General.SessionId", null);
String ownerId = solverProperties.getProperty("General.OwnerPuid");
if (sessionId != null && sessionId.equals(sessionContext.getUser().getCurrentAcademicSessionId()) && ownerId != null)
return "onClick=\"document.location='manageSolvers.do?op=Select&type=" + type.name() + "&owner=" + ownerId + "';\"";
return null;
}