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


Java Criterion.getValue方法代码示例

本文整理汇总了Java中org.cpsolver.ifs.criteria.Criterion.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Criterion.getValue方法的具体用法?Java Criterion.getValue怎么用?Java Criterion.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.cpsolver.ifs.criteria.Criterion的用法示例。


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

示例1: toInstructorInfo

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
protected InstructorInfo toInstructorInfo(TeachingAssignment assignment) {
	InstructorInfo info = toInstructorInfo(assignment.getInstructor());
	info.setAssignmentIndex(assignment.variable().getInstructorIndex());
	Instructor.Context context = assignment.getInstructor().getContext(currentSolution().getAssignment());
	if (context != null)
		info.setAssignedLoad(context.getLoad());
	for (Criterion<TeachingRequest.Variable, TeachingAssignment> c: assignment.variable().getModel().getCriteria()) {
		double value = c.getValue(currentSolution().getAssignment(), assignment, null);
		if (value != 0) info.setValue(c.getName(), value);
	}
	return info;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:13,代码来源:InstructorSchedulingSolver.java

示例2: getInfo

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
@Override
public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info) {
    super.getInfo(assignment, info);
    double conf = getValue(assignment);
    if (conf > 0.0) {
        Criterion<Lecture, Placement> c = getModel().getCriterion(InstructorStudentHardConflict.class);
        double hard = (c == null ? 0.0 : c.getValue(assignment));
        info.put("Instructor student conflicts", sDoubleFormat.format(conf) + (hard > 0.0 ? " [hard: " + sDoubleFormat.format(hard) + "]" : ""));
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:11,代码来源:InstructorStudentConflict.java

示例3: getInfo

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
@Override
public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info) {
    super.getInfo(assignment, info);
    double conf = getValue(assignment);
    if (conf > 0.0) {
        Criterion<Lecture, Placement> c = getModel().getCriterion(ImportantStudentHardConflict.class);
        double hard = (c == null ? 0.0 : c.getValue(assignment));
        info.put("Important student conflicts", sDoubleFormat.format(conf) + (hard > 0.0 ? " [hard: " + sDoubleFormat.format(hard) + "]" : ""));
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:11,代码来源:ImportantStudentConflict.java

示例4: getInfo

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
@Override
public void getInfo(Assignment<Lecture, Placement> assignment, Map<String, String> info) {
    super.getInfo(assignment, info);
    double conf = getValue(assignment);
    if (conf > 0.0) {
        Criterion<Lecture, Placement> c = getModel().getCriterion(IgnoredCommittedStudentConflict.class);
        double committed = (c == null ? 0.0 : c.getValue(assignment));
        info.put("Ignored student conflicts", sDoubleFormat.format(conf) + (committed > 0.0 ? " [committed: " + sDoubleFormat.format(committed) + "]" : ""));
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:11,代码来源:IgnoredStudentConflict.java

示例5: getCost

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
private double getCost(Assignment<Lecture, Placement> assignment, int level, Placement value, Set<Placement> conflicts) {
    double ret = 0.0;
    for (Criterion<Lecture, Placement> criterion: value.variable().getModel().getCriteria()) {
        if (criterion instanceof TimetablingCriterion) {
            double w = ((TimetablingCriterion)criterion).getPlacementSelectionWeight(level, assignment.getIndex() - 1);
            if (w != 0.0)
                ret += w * criterion.getValue(assignment, value, conflicts);
        } else {
            ret += criterion.getWeightedValue(assignment, value, conflicts);
        }
    }
    return ret;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:14,代码来源:PlacementSelection.java

示例6: getInstructors

import org.cpsolver.ifs.criteria.Criterion; //导入方法依赖的package包/类
@Override
public List<InstructorInfo> getInstructors(FilterRpcRequest filter) {
       Lock lock = currentSolution().getLock().readLock();
       lock.lock();
       try {
       	Query q = TeachingRequestsFilterBackend.toQuery(filter);
       	List<InstructorInfo> ret = new ArrayList<InstructorInfo>();
       	Set<Long> instructorIds = null;
       	if (filter.hasOption("instructorId")) {
       		instructorIds = new HashSet<Long>(); instructorIds.add(Long.valueOf(filter.getOption("instructorId")));
       	} else if (filter.hasOption("departmentId")) {
       		instructorIds = new HashSet<Long>(CourseOfferingDAO.getInstance().getSession().createQuery(
       				"select i.uniqueId from DepartmentalInstructor i where i.department.uniqueId = :departmentId"
       					).setLong("departmentId", Long.valueOf(filter.getOption("departmentId"))).list());
       	} else if (filter.hasOption("department")) {
       		instructorIds = new HashSet<Long>(CourseOfferingDAO.getInstance().getSession().createQuery(
       				"select i.uniqueId from DepartmentalInstructor i where i.department.deptCode = :deptCode and i.department.session.uniqueId = :sessionId"
       					).setString("deptCode", filter.getOption("department")).setLong("sessionId", filter.getSessionId()).list());
       	}
       	InstructorSchedulingModel model = (InstructorSchedulingModel)currentSolution().getModel();
       	for (Instructor instructor: model.getInstructors()) {
       		if (instructorIds != null && !instructorIds.contains(instructor.getInstructorId())) continue;
       		Instructor.Context context = instructor.getContext(currentSolution().getAssignment());
       		
       		InstructorInfo info = toInstructorInfo(instructor);
       		info.setAssignedLoad(context.getLoad());
   			for (TeachingAssignment assignment: context.getAssignments()) {
   				TeachingRequestInfo request = toRequestInfo(assignment.variable().getRequest());
   				for (Criterion<TeachingRequest.Variable, TeachingAssignment> c: model.getCriteria()) {
   					double value = c.getValue(currentSolution().getAssignment(), assignment, null);
   					if (value != 0) {
   						request.setValue(c.getName(), value);
   						info.addValue(c.getName(), value);
   					}
   				}
   				request.setMatchingFilter(q.match(new TeachingRequestMatcher(request, info, filter)));
       			info.addAssignedRequest(request);
   			}
   			if (q.match(new TeachingRequestMatcher(info, filter)))  ret.add(info);
       	}
           return ret;
       } finally {
       	lock.unlock();
       }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:46,代码来源:InstructorSchedulingSolver.java


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