Reinsertions#

Reinsertion logic for paradoxically rejected/accepted order handling.

PRMIC/PRB Reinsertion#

API path: apem.order_book_based_model.euphemia.reinsertions.prmic_prb_reinsertion

PRMIC_PRB_reinsertion(self, is_prmic_reinsertion)[source]#

Attempt to reinsert paradoxically rejected orders after a feasible solve.

Parameters:
  • is_prmic_reinsertion (bool) – When False, try to reinsert paradoxically rejected block orders (PRBs). When True, try to reinsert rejected complex and scalable-complex MIC or MP orders.

  • self (MasterProblem)

Return type:

None

calculate_paradoxically_rejected_orders(self, is_prmic_reinsertion)[source]#

Collect rejected orders and identify which of them are paradoxically rejected.

Parameters:
  • is_prmic_reinsertion (bool) – Whether to inspect complex-style orders instead of block orders.

  • self (MasterProblem)

Returns:

A pair (rejected_orders, paradoxically_rejected_orders), both keyed by block, complex, and scalable_complex.

Return type:

tuple[dict[str, list[int]], dict[str, list[int]]]

check_PRB(self, order)[source]#

Check whether a rejected block order is paradoxical at current prices.

Flexible blocks are always treated as candidates. Other block orders are evaluated by comparing their bid price against a volume-weighted average MCP.

Parameters:
Returns:

True when the rejected block would be in the money at the current prices.

Return type:

bool

check_PRCO_PRSCO(self, id, is_complex)[source]#

Check whether a rejected complex-style order is paradoxically rejected.

The test compares the order’s expected MIC or MP revenue against the revenue implied by the current prices, while skipping load-gradient orders.

Parameters:
  • id (int) – Parent order id.

  • is_complex (bool) – Whether the order lives in complex_orders instead of scalable_complex_orders.

  • self (MasterProblem)

Returns:

True when the rejected order could satisfy its condition at the current prices.

Return type:

bool