.. index:: single: plackett_luce_common
.. _plackett_luce_common/0:

.. rst-class:: right

**category**

``plackett_luce_common``
========================

Shared helpers for grouped Plackett-Luce rankers.

| **Availability:** 
|    ``logtalk_load(ranking_protocols(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-04-26

| **Compilation flags:**
|    ``static``


| **Uses:**
|    :ref:`avltree <avltree/0>`
|    :ref:`list <list/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

(no local declarations; see entity ancestors if any)

Protected predicates
--------------------

.. index:: index_items/3
.. _plackett_luce_common/0::index_items/3:

``index_items/3``
^^^^^^^^^^^^^^^^^

Builds ``Item-Index`` pairs for the ordered training items.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``index_items(Items,Index,Indices)``
| **Mode and number of proofs:**
|    ``index_items(+list,+integer,-list)`` - ``one``


------------

.. index:: preprocess_groups/10
.. _plackett_luce_common/0::preprocess_groups/10:

``preprocess_groups/10``
^^^^^^^^^^^^^^^^^^^^^^^^

Builds per-group choice steps, selection counts, and forward and reverse adjacency dictionaries from grouped rankings under the selected traversal order.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``preprocess_groups(Order,Groups,Dataset,MissingRelevance,IndexDictionary,Count,Steps,SelectionCounts,DirectedAdjacency,ReverseAdjacency)``
| **Mode and number of proofs:**
|    ``preprocess_groups(+atom,+list,+object_identifier,+atom,+compound,+integer,-list,-list,-compound,-compound)`` - ``one``


------------

.. index:: selection_exposures/4
.. _plackett_luce_common/0::selection_exposures/4:

``selection_exposures/4``
^^^^^^^^^^^^^^^^^^^^^^^^^

Computes the per-item exposure counts implied by the grouped choice steps and the current value dictionary.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``selection_exposures(Steps,SelectionCounts,ValueDictionary,ExposureCounts)``
| **Mode and number of proofs:**
|    ``selection_exposures(+list,+list,+compound,-list)`` - ``one``


------------

.. index:: normalize_strengths/6
.. _plackett_luce_common/0::normalize_strengths/6:

``normalize_strengths/6``
^^^^^^^^^^^^^^^^^^^^^^^^^

Normalizes raw strength values to sum to one while tracking the maximum absolute change from the current strengths.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``normalize_strengths(RawStrengths,TotalRawStrength,CurrentStrengths,Strengths,MaximumDifference0,MaximumDifference)``
| **Mode and number of proofs:**
|    ``normalize_strengths(+list(number),+number,+list(number),-list(number),+number,-number)`` - ``one``


------------

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

