class, override=False)[source]


class, default_priority=Priority<MANDATORY>, override=False)[source]


class<MANDATORY>, priority_for_non_matches=Priority<MANDATORY>, case_sensitive=False, override=False)[source]



Looks for known priority names inside constraint names.

class<MEDIUM>, override=False)[source]



Bases: object

Abstract base class for prioritizers. This class acts like a functor to be called on each model constraint.

class'all', verbose=False, precision=1e-05, override=False, **kwargs)[source]

Bases:, object

This class is an abstract algorithm, in the sense that it operates on interfaces.

It takes a prioritizer, which an implementation of ConstraintPrioritizer. For convenience, predefined prioritizer types are accessible through names:

  • all relaxes all constraints using a MEDIUM priority; this is the default.
  • named relaxes all constraints with a user name but not the others.
  • match looks for priority names within constraint names; unnamed constraints are not relaxed.


All predefined prioritizers apply various forms of logic, but, when a constraint has been assigned a priority by the user, this priority is always used. For example, the named prioritizer relaxes all named constraints with MEDIUM, but if an unnamed constraint was assigned a HIGH priority, then HIGH will be used.


Returns the infeasibility computed for this constraint.

Parameters:ct – A constraint.
Returns:The amount by which the constraint has been relaxed by the relaxer. The method returns 0 if the constraint has not been relaxed.

Returns true if the constraint ct has been relaxed

Parameters:ct – The constraint to check.
Returns:True if the constraint has been relaxed, else False.

Iterates on relaxations.

Relaxations are built as a dictionary with constraints as keys and numeric violations as values, so this iterator returns (ct, violation) pairs.


This property returns the number of relaxations found.

relax(mdl, relax_mode=None, **kwargs)[source]

Runs the relaxation loop.

  • mdl – The model to be relaxed.
  • relax_mode – the relaxation mode. Accept either None (in which case the default mode is used, or an instance of RelaxationMode enumerated type, or a string that can be translated to a relaxation mode.
  • kwargs – Accepts named arguments similar to solve.

If the relaxation succeeds, the method returns a solution object, an instance of SolveSolution; otherwise returns None.


Returns a dictionary with all relaxed constraints.

Returns:A dictionary where the keys are the relaxed constraints,

and the values are the numerical slacks.


Returns the objective value of the relaxed solution.

Raises:DOCplexException – If the relaxation has not been successful.
class, Priority, Amount)

Bases: tuple


Alias for field number 2


Alias for field number 0


Alias for field number 1

class<MEDIUM>, override=False)[source]