org.cpsolver.studentsct.online.selection

## Class BestPenaltyCriterion

- java.lang.Object
- - org.cpsolver.studentsct.online.selection.BestPenaltyCriterion

- All Implemented Interfaces:
    MultiCriteriaBranchAndBoundSelection.SelectionComparator, MultiCriteriaBranchAndBoundSelection.SelectionCriterion

      public class BestPenaltyCriterion
      extends Object
      implements MultiCriteriaBranchAndBoundSelection.SelectionCriterion

  A simple weighting multi-criteria selection criterion only optimizing on the over-expected penalty. This criterion is used to find a bound on the over-expected penalty to ensure no suggestion given to the student.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BestPenaltyCriterion(Student student, OnlineSectioningModel model)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canImprove(Assignment<Request,Enrollment> assignment, int maxIdx, Enrollment[] current, Enrollment[] best)` Bound
    `int` | `compare(Assignment<Request,Enrollment> assignment, Enrollment[] current, Enrollment[] best)` Compare two solutions
    `int` | `compare(Assignment<Request,Enrollment> assignment, Enrollment e1, Enrollment e2)` Compare two enrollments
    `double` | `getTotalWeight(Assignment<Request,Enrollment> assignment, Enrollment[] enrollments)` For backward compatibility, return a weighted sum

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BestPenaltyCriterion

          public BestPenaltyCriterion(Student student,
                                      OnlineSectioningModel model)

  - ### Method Detail

    - #### compare

          public int compare(Assignment<Request,Enrollment> assignment,
                             Enrollment[] current,
                             Enrollment[] best)

      Description copied from interface: `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      Compare two solutions
      Specified by:
        `compare` in interface `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      Parameters:
        `assignment` - current assignment
        `current` - current solution
        `best` - best known solution
      Returns:
        true if current solution is better than the best one

    - #### canImprove

          public boolean canImprove(Assignment<Request,Enrollment> assignment,
                                    int maxIdx,
                                    Enrollment[] current,
                                    Enrollment[] best)

      Description copied from interface: `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      Bound
      Specified by:
        `canImprove` in interface `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      Parameters:
        `assignment` - current assignment
        `maxIdx` - current request index
        `current` - current solution
        `best` - best known solution
      Returns:
        if the current solution can be extended and possibly improve upon the best known solution

    - #### getTotalWeight

          public double getTotalWeight(Assignment<Request,Enrollment> assignment,
                                       Enrollment[] enrollments)

      Description copied from interface: `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      For backward compatibility, return a weighted sum
      Specified by:
        `getTotalWeight` in interface `MultiCriteriaBranchAndBoundSelection.SelectionCriterion`
      Parameters:
        `assignment` - current assignment
        `enrollments` - current solution
      Returns:
        solution weight (weighted sum)

    - #### compare

          public int compare(Assignment<Request,Enrollment> assignment,
                             Enrollment e1,
                             Enrollment e2)

      Description copied from interface: `MultiCriteriaBranchAndBoundSelection.SelectionComparator`
      Compare two enrollments
      Specified by:
        `compare` in interface `MultiCriteriaBranchAndBoundSelection.SelectionComparator`
      Parameters:
        `assignment` - current assignment
        `e1` - first enrollment
        `e2` - second enrollment
      Returns:
        -1 if the first enrollment is better than the second etc.