本文整理汇总了Java中org.cpsolver.ifs.util.DataProperties.getPropertyLong方法的典型用法代码示例。如果您正苦于以下问题:Java DataProperties.getPropertyLong方法的具体用法?Java DataProperties.getPropertyLong怎么用?Java DataProperties.getPropertyLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cpsolver.ifs.util.DataProperties
的用法示例。
在下文中一共展示了DataProperties.getPropertyLong方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: getSolverSession
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public static String getSolverSession(DataProperties solverProperties) {
Long sessionId = solverProperties.getPropertyLong("General.SessionId", null);
if (sessionId != null) {
Session session = SessionDAO.getInstance().get(sessionId);
if (session != null) return session.getLabel();
}
return "N/A";
}
示例3: 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");
}
示例4: 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;
}
示例5: SearchIntensification
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public SearchIntensification(Solver<V, T> solver, DataProperties properties) {
super(solver, properties);
iInitialIterationLimit = properties.getPropertyLong("SearchIntensification.IterationLimit",
iInitialIterationLimit);
iResetInterval = properties.getPropertyInt("SearchIntensification.ResetInterval", iResetInterval);
iMuxInterval = properties.getPropertyInt("SearchIntensification.MultiplyInterval", iMuxInterval);
iMux = properties.getPropertyInt("SearchIntensification.Multiply", iMux);
}
示例6: ExamSimulatedAnnealing
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor. Following problem properties are considered:
* <ul>
* <li>SimulatedAnnealing.InitialTemperature ... initial temperature
* (default 1.5)
* <li>SimulatedAnnealing.TemperatureLength ... temperature length (number
* of iterations between temperature decrements, default 25000)
* <li>SimulatedAnnealing.CoolingRate ... temperature cooling rate (default
* 0.95)
* <li>SimulatedAnnealing.ReheatLengthCoef ... temperature re-heat length
* coefficient (multiple of temperature length, default 5)
* <li>SimulatedAnnealing.ReheatRate ... temperature re-heating rate
* (default (1/coolingRate)^(reheatLengthCoef*1.7))
* <li>SimulatedAnnealing.RestoreBestLengthCoef ... restore best length
* coefficient (multiple of re-heat length, default reheatLengthCoef^2)
* <li>SimulatedAnnealing.StochasticHC ... true for stochastic search
* acceptance criterion, false for simulated annealing acceptance (default
* false)
* <li>SimulatedAnnealing.RelativeAcceptance ... true for relative
* acceptance (different between the new and the current solutions, if the
* neighbour is accepted), false for absolute acceptance (difference between
* the new and the best solutions, if the neighbour is accepted)
* </ul>
*
* @param properties
* problem properties
*/
@SuppressWarnings("unchecked")
public ExamSimulatedAnnealing(DataProperties properties) {
iInitialTemperature = properties
.getPropertyDouble("SimulatedAnnealing.InitialTemperature", iInitialTemperature);
iReheatRate = properties.getPropertyDouble("SimulatedAnnealing.ReheatRate", iReheatRate);
iCoolingRate = properties.getPropertyDouble("SimulatedAnnealing.CoolingRate", iCoolingRate);
iRelativeAcceptance = properties.getPropertyBoolean("SimulatedAnnealing.RelativeAcceptance",
iRelativeAcceptance);
iStochasticHC = properties.getPropertyBoolean("SimulatedAnnealing.StochasticHC", iStochasticHC);
iTemperatureLength = properties.getPropertyLong("SimulatedAnnealing.TemperatureLength", iTemperatureLength);
iReheatLengthCoef = properties.getPropertyDouble("SimulatedAnnealing.ReheatLengthCoef", iReheatLengthCoef);
iRestoreBestLengthCoef = properties.getPropertyDouble("SimulatedAnnealing.RestoreBestLengthCoef",
iRestoreBestLengthCoef);
if (iReheatRate < 0)
iReheatRate = Math.pow(1 / iCoolingRate, iReheatLengthCoef * 1.7);
if (iRestoreBestLengthCoef < 0)
iRestoreBestLengthCoef = iReheatLengthCoef * iReheatLengthCoef;
String neighbours = properties.getProperty("SimulatedAnnealing.Neighbours",
ExamRandomMove.class.getName() + ";" +
ExamRoomMove.class.getName() + ";" +
ExamTimeMove.class.getName());
neighbours += ";" + properties.getProperty("SimulatedAnnealing.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());
}
}
}
示例7: SuggestionsBranchAndBound
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor
* @param properties configuration
* @param student given student
* @param assignment current assignment
* @param requiredSections required sections
* @param requiredFreeTimes required free times (free time requests that must be assigned)
* @param preferredSections preferred sections
* @param selectedRequest selected request
* @param selectedSection selected section
* @param filter section filter
* @param maxSectionsWithPenalty maximal number of sections that have a positive over-expectation penalty {@link OverExpectedCriterion#getOverExpected(Assignment, Section, Request)}
*/
public SuggestionsBranchAndBound(DataProperties properties, Student student,
Assignment<Request, Enrollment> assignment, Hashtable<CourseRequest, Set<Section>> requiredSections,
Set<FreeTimeRequest> requiredFreeTimes, Hashtable<CourseRequest, Set<Section>> preferredSections,
Request selectedRequest, Section selectedSection, SuggestionFilter filter, double maxSectionsWithPenalty) {
iRequiredSections = requiredSections;
iRequiredFreeTimes = requiredFreeTimes;
iPreferredSections = preferredSections;
iSelectedRequest = selectedRequest;
iSelectedSection = selectedSection;
iStudent = student;
iModel = (OnlineSectioningModel) selectedRequest.getModel();
iAssignment = assignment;
iMaxDepth = properties.getPropertyInt("Suggestions.MaxDepth", iMaxDepth);
iTimeout = properties.getPropertyLong("Suggestions.Timeout", iTimeout);
iMaxSuggestions = properties.getPropertyInt("Suggestions.MaxSuggestions", iMaxSuggestions);
iMaxSectionsWithPenalty = maxSectionsWithPenalty;
iFilter = filter;
iComparator = new SelectionComparator() {
private HashMap<Enrollment, Double> iValues = new HashMap<Enrollment, Double>();
private Double value(Enrollment e) {
Double value = iValues.get(e);
if (value == null) {
value = iModel.getStudentWeights().getWeight(iAssignment, e,
(iModel.getDistanceConflict() == null ? null : iModel.getDistanceConflict().conflicts(e)),
(iModel.getTimeOverlaps() == null ? null : iModel.getTimeOverlaps().conflicts(e)));
iValues.put(e, value);
}
return value;
}
@Override
public int compare(Assignment<Request, Enrollment> a, Enrollment e1, Enrollment e2) {
return value(e2).compareTo(value(e1));
}
};
}
示例8: CurTermination
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
public CurTermination(DataProperties properties) {
iMaxIter = properties.getPropertyInt("Termination.MaxIters", -1);
iTimeOut = properties.getPropertyDouble("Termination.TimeOut", -1.0);
iStopWhenComplete = properties.getPropertyBoolean("Termination.StopWhenComplete", false);
iMaxIdle = properties.getPropertyLong("Termination.MaxIdle", 10000);
}
示例9: SimulatedAnnealing
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* Constructor. Following problem properties are considered:
* <ul>
* <li>SimulatedAnnealing.InitialTemperature ... initial temperature (default 1.5)
* <li>SimulatedAnnealing.TemperatureLength ... temperature length (number of iterations between temperature decrements, default 25000)
* <li>SimulatedAnnealing.CoolingRate ... temperature cooling rate (default 0.95)
* <li>SimulatedAnnealing.ReheatLengthCoef ... temperature re-heat length coefficient (multiple of temperature length, default 5)
* <li>SimulatedAnnealing.ReheatRate ... temperature re-heating rate (default (1/coolingRate)^(reheatLengthCoef*1.7))
* <li>SimulatedAnnealing.RestoreBestLengthCoef ... restore best length coefficient (multiple of re-heat length, default reheatLengthCoef^2)
* <li>SimulatedAnnealing.StochasticHC ... true for stochastic search acceptance criterion, false for simulated annealing acceptance (default false)
* <li>SimulatedAnnealing.RelativeAcceptance ... true for relative acceptance (different between the new and the current solutions, if the neighbour is accepted), false for absolute acceptance (difference between the new and the best solutions, if the neighbour is accepted)
* <li>SimulatedAnnealing.Neighbours ... semicolon separated list of classes implementing {@link NeighbourSelection}
* <li>SimulatedAnnealing.AdditionalNeighbours ... semicolon separated list of classes implementing {@link NeighbourSelection}
* <li>SimulatedAnnealing.Random ... when true, a neighbour selector is selected randomly
* <li>SimulatedAnnealing.Update ... when true, a neighbour selector is selected using {@link NeighbourSelector#getPoints()} weights (roulette wheel selection)
* </ul>
*
* @param properties
* problem properties
*/
public SimulatedAnnealing(DataProperties properties) {
super(properties);
iInitialTemperature = properties.getPropertyDouble(getParameterBaseName() + ".InitialTemperature", iInitialTemperature);
iReheatRate = properties.getPropertyDouble(getParameterBaseName() + ".ReheatRate", iReheatRate);
iCoolingRate = properties.getPropertyDouble(getParameterBaseName() + ".CoolingRate", iCoolingRate);
iRelativeAcceptance = properties.getPropertyBoolean(getParameterBaseName() + ".RelativeAcceptance", iRelativeAcceptance);
iStochasticHC = properties.getPropertyBoolean(getParameterBaseName() + ".StochasticHC", iStochasticHC);
iTemperatureLength = properties.getPropertyLong(getParameterBaseName() + ".TemperatureLength", iTemperatureLength);
iReheatLengthCoef = properties.getPropertyDouble(getParameterBaseName() + ".ReheatLengthCoef", iReheatLengthCoef);
iRestoreBestLengthCoef = properties.getPropertyDouble(getParameterBaseName() + ".RestoreBestLengthCoef", iRestoreBestLengthCoef);
iCoolingRateAdjusts = properties.getPropertyDoubleArry(getParameterBaseName() + ".CoolingRateAdjustments", null);
iTrainingValues = properties.getPropertyInt(getParameterBaseName() + ".TrainingValues", iTrainingValues);
iTrainingProbability = properties.getPropertyDouble(getParameterBaseName() + ".TrainingProbability", iTrainingProbability);
if (iReheatRate < 0)
iReheatRate = Math.pow(1 / iCoolingRate, iReheatLengthCoef * 1.7);
if (iRestoreBestLengthCoef < 0)
iRestoreBestLengthCoef = iReheatLengthCoef * iReheatLengthCoef;
}
示例10: ExamTabuSearch
import org.cpsolver.ifs.util.DataProperties; //导入方法依赖的package包/类
/**
* <ul>
* <li>TabuSearch.MaxIdle ... maximum number of idle iterations (default is
* 10000)
* <li>TabuSearch.MinSize ... minimum size of the tabu list
* <li>TabuSearch.MaxSize ... maximum size of the tabu list
* <li>Value.ValueWeight ... weight of a value (i.e.,
* {@link Value#toDouble(Assignment)})
* <li>Value.ConflictWeight ... weight of a conflicting value (see
* {@link Model#conflictValues(Assignment, Value)}), it is also weighted by the past
* occurrences when conflict-based statistics is used
* </ul>
* @param properties solver configuration
* @throws Exception thrown when the initialization fails
*/
public ExamTabuSearch(DataProperties properties) throws Exception {
iTabuMinSize = properties.getPropertyInt("TabuSearch.MinSize", iTabuMinSize);
iTabuMaxSize = properties.getPropertyInt("TabuSearch.MaxSize", iTabuMaxSize);
iMaxIdleIterations = properties.getPropertyLong("TabuSearch.MaxIdle", iMaxIdleIterations);
iConflictWeight = properties.getPropertyDouble("Value.ConflictWeight", iConflictWeight);
iValueWeight = properties.getPropertyDouble("Value.ValueWeight", iValueWeight);
}