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


Java TeachingRequest类代码示例

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


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

示例1: InstructorSchedulingSuggestions

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
public InstructorSchedulingSuggestions(InstructorSchedulingSolver solver) {
	iSolver = solver;
	iModel = (InstructorSchedulingModel)solver.currentSolution().getModel();
	iAssignment = solver.currentSolution().getAssignment();
	for (TeachingRequest.Variable variable: iModel.variables()) {
		TeachingAssignment value = iAssignment.getValue(variable);
		if (value == null) {
			iInitialUnassignments.add(variable);
		} else {
			iInitialAssignments.put(variable, value);
		}
	}
	iValue = iModel.getTotalValue(iAssignment);
	for (Criterion<TeachingRequest.Variable, TeachingAssignment> c: iModel.getCriteria())
		iValues.put(c.getName(), c.getValue(iAssignment));
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:17,代码来源:InstructorSchedulingSuggestions.java

示例2: getTeachingRequestInfo

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public TeachingRequestInfo getTeachingRequestInfo(Long requestId) {
       Lock lock = currentSolution().getLock().readLock();
       lock.lock();
       try {
       	for (TeachingRequest request: getModel().getRequests()) {
       		if (request.getRequestId() == requestId) {
       			TeachingRequestInfo info = toRequestInfo(request);
               	for (TeachingRequest.Variable var: request.getVariables()) {
               		TeachingAssignment placement = currentSolution().getAssignment().getValue(var);
               		if (placement != null)
               			info.addInstructor(toInstructorInfo(placement));
               	}
           		return info;
           	}
           }
           return null;
       } finally {
       	lock.unlock();
       }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:InstructorSchedulingSolver.java

示例3: getCurrentPreference

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
/**
 * Current constraint preference (if soft)
 * @param assignment current assignment
 * @param value proposed change
 * @return change in the current preference value of this constraint
 */
public int getCurrentPreference(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, TeachingAssignment value) {
    if (isHard()) return 0; // no preference
    if (countAssignedVariables(assignment) + (assignment.getValue(value.variable()) == null ? 1 : 0) < 2) return 0; // not enough variables
    int nrViolatedPairsAfter = 0;
    int nrViolatedPairsBefore = 0;
    for (TeachingRequest.Variable v1 : variables()) {
        for (TeachingRequest.Variable v2 : variables()) {
            if (v1.getId() >= v2.getId()) continue;
            TeachingAssignment p1 = (v1.equals(value.variable()) ? null : assignment.getValue(v1));
            TeachingAssignment p2 = (v2.equals(value.variable()) ? null : assignment.getValue(v2));
            if (p1 != null && p2 != null && !isSatisfiedPair(assignment, p1, p2))
                nrViolatedPairsBefore ++;
            if (v1.equals(value.variable())) p1 = value;
            if (v2.equals(value.variable())) p2 = value;
            if (p1 != null && p2 != null && !isSatisfiedPair(assignment, p1, p2))
                nrViolatedPairsAfter ++;
        }
    }
    return (nrViolatedPairsAfter > 0 ? Math.abs(iPreference) * nrViolatedPairsAfter : 0) - (nrViolatedPairsBefore > 0 ? Math.abs(iPreference) * nrViolatedPairsBefore : 0);
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:27,代码来源:SameInstructorConstraint.java

示例4: toString

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
public String toString(TeachingRequest.Variable request) {
    StringBuffer sb = new StringBuffer();
    Long assId = getAssignmentId(request);
    sb.append(assId == null ? "" : assId);
    sb.append("," + request.getCourse().getCourseName());
    Section section = request.getSections().get(0);
    sb.append("," + section.getSectionName());
    sb.append("," + section.getTimeName(true));
    sb.append(",\"" + (section.hasRoom() ? section.getRoom() : "") + "\"");
    String link = getLink(request);
    sb.append("," + (link == null ? "" : link));
    Map<String, Integer> levels = new HashMap<String, Integer>();
    for (Preference<Attribute> p: request.getRequest().getAttributePreferences())
        levels.put(p.getTarget().getAttributeName(), - p.getPreference());
    sb.append(",\"" + levels + "\"");
    sb.append("," + new DecimalFormat("0.0").format(request.getRequest().getLoad()));
    return sb.toString();
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:19,代码来源:MathTest.java

示例5: toRequestInfo

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
protected TeachingRequestInfo toRequestInfo(TeachingRequest request) {
	TeachingRequestInfo info = iRequestInfos.get(request);
	if (info == null) {
		info = iSolver.toRequestInfo(request);
		iRequestInfos.put(request, info);
	}
	return info;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:9,代码来源:InstructorSchedulingSuggestions.java

示例6: InstructorSchedulingDatabaseLoader

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
public InstructorSchedulingDatabaseLoader(InstructorSchedulingModel model, Assignment<TeachingRequest.Variable, TeachingAssignment> assignment) {
	super(model, assignment);
	iProgress = Progress.getInstance(model);
	iSessionId = model.getProperties().getPropertyLong("General.SessionId", (Long)null);
	for (Long id: model.getProperties().getPropertyLongArry("General.SolverGroupId", null))
		iSolverGroupId.add(id);
	iInstructorFormat = getModel().getProperties().getProperty("General.InstructorFormat", NameFormat.LAST_FIRST.reference());
	iDefaultSameCourse = getModel().getProperties().getProperty("Defaults.SameCourse", "R");
	iDefaultSameCommon = getModel().getProperties().getProperty("Defaults.SameCommon", "R");
	iShowClassSuffix = ApplicationProperty.SolverShowClassSufix.isTrue();
	iShowConfigName = ApplicationProperty.SolverShowConfiguratioName.isTrue();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:13,代码来源:InstructorSchedulingDatabaseLoader.java

示例7: toHtml

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
protected String toHtml(org.unitime.timetable.model.TeachingRequest request) {
	String sections = "";
	for (TeachingClassRequest tcr: new TreeSet<TeachingClassRequest>(request.getClassRequests())) {
		sections += (sections.isEmpty() ? "" : ", ") + (tcr.isAssignInstructor() ? "" : "<i>") + toHtml(tcr.getTeachingClass()) + (tcr.isAssignInstructor() ? "" : "</i>");
	}
	return "<a href='instructionalOfferingDetail.do?io=" + request.getOffering().getUniqueId() + "&requestId=" + request.getUniqueId() + "&op=view#instructors'>" + request.getOffering().getCourseName() + "</a> " + sections;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:8,代码来源:InstructorSchedulingDatabaseLoader.java

示例8: loadRequests

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
protected void loadRequests(org.hibernate.Session hibSession) throws Exception {
	List<org.unitime.timetable.model.TeachingRequest> requests = (List<org.unitime.timetable.model.TeachingRequest>)hibSession.createQuery(
			"select r from TeachingRequest r inner join r.offering.courseOfferings co where co.isControl = true and co.subjectArea.department.solverGroup.uniqueId in :solverGroupId")
			.setParameterList("solverGroupId", iSolverGroupId).list();
	iProgress.setPhase("Loading requests...", requests.size());
	for (org.unitime.timetable.model.TeachingRequest request: requests) {
		iProgress.incProgress();
		if (!request.isCancelled()) loadRequest(hibSession, request);
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:InstructorSchedulingDatabaseLoader.java

示例9: toInstructorInfo

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的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

示例10: computeBounds

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
protected double[] computeBounds(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment) {
    double[] bounds = new double[] { 0.0, 0.0 };
    for (Instructor instructor: ((InstructorSchedulingModel)getModel()).getInstructors()) {
        bounds[1] += Math.abs(instructor.getBackToBackPreference());
    }
    return bounds;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:9,代码来源:BackToBack.java

示例11: getBounds

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public double[] getBounds(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, Collection<TeachingRequest.Variable> variables) {
    double[] bounds = new double[] { 0.0, 0.0 };
    for (Instructor instructor: getInstructors(assignment, variables)) {
        bounds[1] += Math.abs(instructor.getBackToBackPreference());
    }
    return bounds;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:9,代码来源:BackToBack.java

示例12: getValue

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public double getValue(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, Collection<TeachingRequest.Variable> variables) {
    double value = 0.0;
    for (Instructor instructor: getAssignedInstructors(assignment, variables))
        value += instructor.getContext(assignment).countBackToBackPreference(iDiffRoomWeight, iDiffTypeWeight);
    return value;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:8,代码来源:BackToBack.java

示例13: getValue

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public double getValue(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, Collection<TeachingRequest.Variable> variables) {
    double value = 0.0;
    for (Instructor instructor: getAssignedInstructors(assignment, variables)) {
        value += instructor.getContext(assignment).countTimeOverlaps();
    }
    return value;
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:9,代码来源:TimeOverlaps.java

示例14: getValue

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public double getValue(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, TeachingAssignment value, Set<TeachingAssignment> conflicts) {
    if (iMPP && value.variable().getInitialAssignment() != null) {
        return (value.getInstructor().equals(value.variable().getInitialAssignment().getInstructor()) ? 0.0 : 1.0);
    } else {
        return 0.0;
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:9,代码来源:OriginalInstructor.java

示例15: getInfo

import org.cpsolver.instructor.model.TeachingRequest; //导入依赖的package包/类
@Override
public void getInfo(Assignment<TeachingRequest.Variable, TeachingAssignment> assignment, Map<String, String> info) {
    double val = getValue(assignment);
    double[] bounds = getBounds(assignment);
    if (bounds[0] <= val && val <= bounds[1] && bounds[0] < bounds[1])
        info.put(getName(), getPerc(val, bounds[0], bounds[1]) + "% (" + sDoubleFormat.format(bounds[1] - val) + ")");
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:8,代码来源:OriginalInstructor.java


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