This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Policy-Adaptable Methods For Resolving Normative Conflicts Through Argumentation and Graph Colouring

Johnny Joyce
(Supervisor: Timothy Norman)
Abstract

In a multi-agent system, one may choose to govern the behaviour of an agent by imposing norms, which act as guidelines for how agents should act either all of the time or in given situations. However, imposing multiple norms on one or more agents may result in situations where these norms conflict over how the agent should behave. In any system with normative conflicts (such as safe reinforcement models or systems which monitor safety protocols), one must decide which norms should be followed such that the most important and most relevant norms are maintained. We introduce a new method for resolving normative conflicts through argumentation and graph colouring which is compatible with a variety of normative conflict resolution policies. We prove that this method always creates an admissible set of arguments under argumentation semantics, meaning that it produces coherent outputs. We also introduce more robust variants of this method, each building upon their predecessor to create a superior output, and we include further mathematical proof of their coherence. Our most advanced variant uses the existing concept of curtailment, where one norm may supersede another without fully eliminating it. The methods we introduce are all compatible with various pre-existing policies for resolving normative conflicts. Empirical evaluations are also performed to compare our algorithms to each other and to others in existing literature.

 

University of Southampton

Faculty of Engineering and Physical Sciences

Electronics and Computer Science


Policy-Adaptable Methods For Resolving Normative Conflicts Through Argumentation and Graph Colouring

by

Johnny Joyce

September 2020


Supervisor: Timothy Norman

Second Examiner: Corina Cirstea


A dissertation submitted in partial fulfilment of the degree

of MSc Artificial Intelligence

 


Statement of Originality

——————————

  • I have read and understood the ECS Academic Integrity information and the University’s Academic Integrity Guidance for Students

  • I am aware that failure to act in accordance with the Regulations Governing Academic Integrity may lead to the imposition of penalties which, for the most serious cases, may include termination of programme.

  • I consent to the University copying and distributing any or all of my work in any form and using third parties (who may be based outside the EU/EEA) to verify whether my work contains plagiarised material, and for quality assurance purposes.

——————————

  • I have acknowledged all sources, and identified any content taken from elsewhere.

  • I have not used any resources produced by anyone else.

  • I did all the work myself, or with my allocated group, and have not helped anyone else

  • The material in the report is genuine, and I have included all my data/code/designs.

  • I have not submitted any part of this work for another assessment

  • My work did not involve human participants, their cells or data, or animals.

——————————

1 Introduction

In a computerised or non-computerised system, there may exist one or more autonomous entities, which we call agents. In systems containing at least one agent, one may wish to govern agent behaviour either by giving direct commands or by setting guidelines for how the agent should interact with its environment. We call such guidelines norms. If an agent is given more than one norm to follow, some of these norms may contradict one another on how the agent should act in certain situations. We call this a normative conflict. The goal of this paper is to devise a way of resolving normative conflicts by deciding which norms to keep and which norms to modify or remove such that the agent continues to follow the most relevant and most important norms.

A norm may be an obligation, a prohibition, or a permission. As an example, let us consider agent Andy, who works in retail and must follow the given norms:

Norm 1: “Andy is obligated to go to work each weekday”.
Norm 2: “Andy is prohibited from disclosing confidential work information to employees of other companies”.
Norm 3: “Andy is permitted to take a day off of work if he has requested it in advance”.

Here, we see an example of each type of norm. Generally, a permission is able to override an obligation — in this case, if Andy were to request a day off of work, then norm 3 would override norm 1. Norms may also be conditional — in norm 3, the condition for activation is that Andy must have requested the day off.

Prohibitions and obligations can conflict with one another. For example, if Andy’s company is working together with another company called CompanyCorp on a project, we may decide to introduce a fourth norm together with the previous three:

Norm 4: “Andy is obligated to share information with CompanyCorp about the joint project”.

Now norms 2 and 4 conflict with one another, so we must decide which norms must be prioritised. Two obligations may also conflict with one another if both cannot be fulfilled simultaneously. Suppose we impose the following new norms:

Norm 5: “Andy is obligated to immediately answer the phone when a customer calls”.
Norm 6: “Andy is obligated to attend to customers at the cash register between 10:00-11:00 each weekday”.

Then if the phone were to ring whilst Andy is attending to a customer at the register, he would be unable to fulfil his obligation to answer the phone. Norms 5 and 6 also show examples of time dependencies within norms. Norm 5 is time-sensitive in its fulfilment condition in that Andy must answer immediately (presumably within a given time limit). On the other hand, norm 6 is time-sensitive in that its effects only apply at specific times. For most of this paper, we will not be thoroughly analysing time dependencies of norms.

To resolve normative conflicts, one needs to decide to prioritise certain norms above others, since by definition it is not possible for an agent to follow all conflicting norms it is given. As described by Oren et al., “An agent may drop a conflicting norm […] or temporarily ignore it […] We assume that an agent in this situation has no choice but to drop a norm permanently, and must determine which norms to drop” [1]. We will also make this assumption for the initial sections in this paper, but we will also consider situations later where agents can temporarily ignore norms. When we do so, the specifics of how our assumptions change will be discussed. For now, we will assume that certain norms must be dropped whilst others must be adopted (or admitted). Our goal is to adopt a set of norms which do not conflict with one another such that the set contains the most important and most relevant norms possible. This will ensure that the agent(s) following these norms have a clear, well-defined objective which aligns with the tasks of highest priority. This will also ensure that the agent need not engage in normative reasoning whilst it is deployed, allowing its resources to instead be put towards its own agenda.

In this paper, we will introduce a method for deciding which norms to adopt and for resolving normative conflicts in a way which is versatile and coherent. We want this method to be compatible with some common policies for normative conflict resolution (which we will discuss in detail in Section 3), so this method should be adaptable with respect to policies. This will ensure that the method we introduce will be as flexible as possible to maximise applicability in different settings. We also want the results of this method to demonstrably align with notions in argumentation [2] — that is, we want to be able to show that this method produces a set which is admissible or is a equivalent to an extension (these notions will be discussed in section 2.1). Achieving this goal would ensure that our method produces solutions which are logically sound and which prioritise norms sensibly.

Further to the above goals, we want to extend our method to allow for adoption of norms which directly conflict with one another. In doing so, the set of norms we admit will be moved past the semantics of argumentation, where conflicts can only be resolved by admitting one argument (or norm) or the other.

The structure of the remainder of this paper is as follows:

  • In Section 2, we give a brief introduction to the existing tools we will use for resolving normative conflicts — namely argumentation (Section 2.1), conflict graphs (Section 2.2), and graph colouring (Section 2.3).

  • In Section 3, we discuss relevant work on policies which have been used for normative conflict resolution — these policies give us a specific objective in judging the adaptability of our system. We also discuss relevant work within argumentation.

  • In Section 4, we introduce new methods for resolving normative conflicts using the tools discussed in Section 2. In Section 4.1, we introduce ColourResolveColourResolve, our first new method which we will build upon throughout the remainder of Section 4. Section 4.2 discusses how our new method can be used with different policies. Section 4.3 highlights a shortcoming of our new result and introduces a remedy, ColourResolveCompleteColourResolveComplete. Section 4.4 further refines our method, resulting in the most robust of all the new methods introduced so far, ColourCurtailCompleteColourCurtailComplete — this method’s computational complexity is discussed in Section 4.5.

  • In Section 5, we compare the empirical results of the new methods we have introduced to existing methods in literature using existing methodology. We also perform our own empirical evaluations.

  • In Section 6, we discuss potential areas for further exploration beyond our work.

  • Finally, we conclude in Section 7.

2 Argumentation and graph colouring

In standard logic, the discovery of new information does not alter the conclusions at which one has already arrived. The counterpart to this type of reasoning is called non-monotonic logic, where conclusions can be withdrawn or overturned on the basis of new information. For example, if one were looking at a starry sky at night and saw a light, it might be assumed that the light was a star. However, if one then sees that the star is moving, it may be more reasonable to instead assume that the light is a meteor. If one then sees that the light is flashing, one could again revise their assumption and presume that the light belongs to an aeroplane. Non-monotonic reasoning provides a basis for argumentation, which we will now discuss.

2.1 Argumentation

We will need tools to allow us reason about the conflicts between norms directly. To do so, we can use argumentation, a type of framework pioneered by Dung in 1995 [2]. Argumentation involves a set of arguments AA and an attack relation RR between these arguments. For two arguments a,bAa,b\in A, if there is a tuple (a,b)R(a,b)\in R, we say that argument aa attacks argument bb. In our case, we will view each norm as an argument (and will henceforth use “norm” and “argument” interchangeably) and we will view a conflict between two norms as their corresponding arguments attacking one another. Note that we will therefore be considering attack arguments to be bidirectional — if argument aa attacks argument bb, then argument bb attacks argument aa. This is not usually the case in argumentation, but this assumption will simplify the remainder of this paper.

By using argumentation, we now have access to notions within the field which are used to reason about which arguments are reasonable and should be accepted and which arguments should be rejected. This will help us resolve conflicts by discarding norms we value less highly than others when a conflict arises. The following list contains some common notions within argumentation which we will be using throughout the remainder of this paper:

Note: We will use Ω\Omega to denote a subset of the set all arguments AA. This is non-standard notation which we are adopting due to a notational conflict which will arise later in Section 2.3.

  • We say that a set of arguments Ω\Omega is conflict-free iff there are no arguments a,bΩa,b\in\Omega s.t. aa attacks bb

  • We say that an argument aAa\in A is acceptable wrt. a set of arguments Ω\Omega iff for any bAb\in A s.t. bb attacks aa, there exists some cΩc\in\Omega s.t. cc attacks bb. That is, Ω\Omega attacks every argument which attacks aa (or in other words, Ω\Omega defends aa).

  • We say that a set of arguments Ω\Omega is admissible iff it is conflict-free and for every aΩa\in\Omega, aa is acceptable wrt. Ω\Omega

  • A set of arguments ΩA\Omega\subset A is a complete extension of AA iff Ω\Omega is admissible and for every aAa\in A which is acceptable wrt. Ω\Omega, aΩa\in\Omega

  • A set of arguments ΩA\Omega\subset A is a preferred extension of AA iff Ω\Omega is a maximal admissible set. That is, |Ω|=max{|E||EA is admissible wrt. A}\left|\Omega\right|=\max\big{\{}\left|E\right|\big{|}E\subset A\text{ is admissible wrt.\ }A\big{\}}.

There are also other notions and types of extensions within argumentation, such as stable extensions and grounded extensions, but we will not consider these in this paper. For further reading on notions in argumentation, the reader is directed to Dung’s seminal paper [2].

2.2 Conflict graphs

Though there are various ways of representing normative conflicts, we will be using conflict graphs, put forth by Oren et al. [1]. The advantage of conflict graphs is that we can use existing work from both argumentation and graph theory to our advantage when resolving conflicts, as well as standard normative reasoning.

In standard graph theory, a graph consists of a finite set of discrete vertices VV (often also called nodes, as with Oren et al.) and a set of edges EE. Each edge consists of a pair of two vertices v,wVv,w\in V and can be thought of as a link or a relation between vertices vv and ww. Edges may be unordered pairs {v,w}\{v,w\} or ordered pairs (v,w)(v,w) — if a graph contains ordered pairs as edges, then these edges are said to be directional, and the corresponding graph is called a directed graph, or a digraph. Directional edges represent a relation which is one-sided. On the other hand, graphs without directed edges are called undirected graphs, or simply “graphs”.

In a conflict graph, each vertex represents a norm (or an argument), while each edge represents a normative conflict between two norms. We will assume that edges are undirected — that is, whenever norm vv conflicts with norm ww, norm ww also conflicts with norm vv. A potential area for further work may involve directional conflicts, but we will not consider these cases in this paper.

As an example, let us consider a system where our agent Andy from before has been given the six norms we discussed in Section 1:

Norm 1: “Andy is obligated to go to work each weekday”.
Norm 2: “Andy is prohibited from disclosing confidential work information to employees of other companies”.
Norm 3: “Andy is permitted to take a day off of work if he has requested it in advance”.
Norm 4: “Andy is obligated to share information with CompanyCorp about the joint project”.
Norm 5: “Andy is obligated to immediately answer the phone when a customer calls”.
Norm 6: “Andy is obligated to attend to customers at the cash register between 10:00-11:00 each weekday”.

Here, we have that norms 2 and 4 directly conflict with one another in their statements. Whenever Andy is busy attending to customers, there is also a conflict between norms 5 and 6 since Andy would be unable to fulfil both duties at once. Therefore, the normative conflict graph would appear as shown in Figure 1. Note that we have not drawn an edge from norm 1 to norm 3 because Andy’s permission to take time off of work can override his obligation to go to work when norm 3 is applicable.

Figure 1: A conflict graph representation of the set of norms discussed in Section 1. The number inside each vertex corresponds to the number of the norm it represents. An edge connecting two vertices represents a conflict between the two corresponding norms.

2.3 Graph colouring

As we continue, we will use graph colouring as one of our tools to solve normative conflicts, which we will introduce in this section. Given a graph consisting of vertices and edges, the aim of graph colouring is to assign each vertex a colour such that no two vertices of the same colour are connected by an edge — typically, one tries to accomplish this using the fewest possible number of colours.

A graph colouring which uses at most kk colours is called a kk-colouring, and a graph GG is said to be kk-colourable if there exists a proper kk-colouring for GG. The minimum kk for which a graph GG is kk-colourable is called the chromatic number of GG, denoted χ(G)\chi(G). For a given colour cc, the set of vertices corresponding to colour cc is called the colour class of cc.

In general, deciding whether there exists a kk-colouring for k{0,1,2}k\in\mathbb{N}\setminus\{0,1,2\} for a graph is an NP-complete problem. Furthermore, finding the chromatic number χ(G)\chi(G) for a graph GG is an NP-hard problem [3]. As such, we will not focus on finding graph colourings which use the exact minimum number of colours. Instead, we will consider known algorithms for creating colourings which may use more colours than the chromatic number, which we will discuss later. Some examples of possible colourings for a graph can be seen in Figure 2. For further reading on graph colouring, the reader is directed to Lewis’ book on graph colouring [4].

Figure 2: An example of a graph with — (a) A valid 5-colouring. (b) A valid 2-colouring. (c) An invalid 3-colouring.

Note that for any valid colouring of any graph, each colour class is an independent set — that is, there are no edges connecting any two vertices in the same colour class. This fact will serve as the backbone of the algorithms we will propose, where we will compare colour classes to find independent sets which correspond to the most important norms in the system.

As we continue into subsequent sections, we will use the following notation:

  • We will use standard graph-theoretic notation for most objects. G=(V,E)G=(V,E) will represent a graph with vertex set VV and edge set EE.

  • When colouring any graph, one can create a bijection from the set of colours to {1,2,3,,n}\{1,2,3,...,n\}\subset\mathbb{N}, where nn is the number of colours being used in the graph (so n|V|n\leq\left|V\right|). As such, \mathbb{N} will represent the space of all possible colours which can be used and cc\in\mathbb{N} will represent an arbitrary colour.

  • For a graph G=(V,E)G=(V,E), a graph colouring ϕ\phi is equivalent to a function ϕ:V\phi:V\rightarrow\mathbb{N} since each vertex maps to a colour and each colour can be represented by an arbitrary natural number. We will denote arbitrary graph colourings by ϕ\phi and the set of possible graph colourings by Φ\Phi.

  • Since EE represents the edge set of a graph, this notation conflicts with the standard notation for an extension or a set of arguments in argumentation (also EE). Therefore, we will use Ω\Omega to denote a set of arguments/norms or a selected set of vertices while EE will represent the edge set of a graph.

  • We will use AA to denote the set of all arguments in the domain of our problem. Since we are modelling norms as arguments and arguments as vertices in a conflict graph, the set of arguments AA and the set of vertices VV represent the same objects seen through a different level of abstraction.

3 Related work on conflict resolution

Having introduced argumentation, we can now discuss existing materials on normative conflicts. Normative conflicts can be resolved using many different approaches, some of which involve argumentation, while others do not. In Section 3.1, we discuss how policies for normative conflict resolution are used, both in settings involving and not involving argumentation. In Section 3.2, we discuss the relation between argumentation and normative reasoning, and also discuss some criteria for how arguments be used to can defeat one another, building upon the policies discussed in Section 3.1.

3.1 Policies for normative conflict resolution

One example of a method for resolving normative conflicts without argumentation comes from Vasconcelos et al. [5]. They show that a normative conflict arises when any action is within scope of two conflicting norms, such as a prohibition and an obligation. That is, a conflict exists when an action is both simultaneously forbidden and obliged by some agent. Vasconcelos et al. also discuss policies for resolving conflicts, including lex posterior (where the more recent norms takes priority over less recent norms) and lex superior (where norms put forth by greater authorities take priority over others).

An appropriate example for demonstrating another type of policy comes from Horty [6], who put forth the following set of conflicting norms as a motivating example:

“Don’t eat with your fingers,

If you are served asparagus, eat it with your fingers.” [6]

Here, neither lex superior nor lex posterior are applicable as we do not have information on the sources of norms nor on when they were imposed. Instead, the policy of lex specialis (where norms which are more specific than others take priority) is more suitable, since the first norm should be ignored when presented with asparagus. Straßer and Arieli [7] have used an approach based on lex specialis to resolve normative conflicts through argumentation. In their work, arguments (or sequents as they call them) are eliminated when they contain another argument which attacks them either via rebuttal (directly refuting the opposing conclusion) or undercutting (refuting one or more of the opposing antecedents).

One of our previously stated aims for creating a new framework for conflict resolution is that we wish for it to be adaptable with respect to policies. Setting this as a specific objective, we wish for our resulting system to be compatible with the policies of lex superior, lex posterior, and lex specialis.

Normative conflicts could also be resolved based on a system of trust. This bears a similarity to how one would apply lex superior, though instead of considering the amounts of authority of individuals who impose norms, we instead consider individuals based on their reputation. Examples include the work of Parsons et al. [8] [9] and of Keung et al. [10]. However, trust-based systems require more involved processes than the previously discussed policies since one would have to derive a measure of trust for each individual rather than using easily obtainable information within the system. That said, given a sufficiently adaptable system, should be possible to include trust-based policies as an “add-on” to the framework.

3.2 Policies and argumentation

Similarly to how policies exist for resolving normative conflicts, there are various criteria which can be used in argumentation for determining which arguments defeat others. One such example is the weakest link criterion. Consider a system where each argument is composed of several elementary arguments, called context arguments, where the conclusion of each context argument leads to the antecedent of the subsequent context argument. Here, the weakest link criterion dictates that the strength of an argument is determined by the strength its weakest context argument [11]. Another example would be the last link criterion, where the strength of an argument is determined by the strength of its final context argument. Our framework will not consider these criteria for defeating arguments and will instead focus on policies which do not involve argumentation-based reasoning. However, an alternate system based upon ours which uses argumentation-specific criteria to decide which norms to follow may be an avenue for future work.

Other criteria for defeating arguments exist where arguments can be attacked without being defeated. For example, Amgoud and Ben-Naim [12] have proposed a system where arguments are sorted by strongest to weakest based upon how many attackers an argument has.

Some frameworks and methods for non-monotonic reasoning have later been shown to have equivalent approaches using argumentation. For example, Liao et al [11] showed that using a “greedy” approach for creating an extension using the weakest link criterion creates a set of conclusions identical to those of an approach by Brewka and Eiter [13] from 17 years prior. It is expected that these parallels between argumentation and non-monotonic logic should exist, since it has been shown that Dung’s argumentation framework is equivalent to classical logic with the addition of the Peirce-Quine dagger (i.e. the “NAND” operator) [14]. As such, approaches with and without argumentation should not be seen as mutually exclusive, with various degrees of overlap existing between different approaches. Therefore, by applying argumentation to normative conflict resolution, loss of detail or generality should not be considered a major concern.

It should be noted that the approaches featured in [11] and [13] require the existence a preference relation over context arguments, which could be derived using policies as in Section 3.1, or they could be given a priori. Other argumentation-based systems, such as those of Modgil and Luck [15], do not require an a priori relation, while other systems which do not involve argumentation also do not require an a priori relation [5]. We can therefore see that whether or not one chooses to involve argumentation in a system or framework does not directly impose a requirement (or lack thereof) for an ordering to be given as a component of the system. However, it is more advantageous to have this relation be derived as a part of the system. As explained by Modgil and Luck, “flexible and adaptive agents need to engage in motivational argumentation over the respective merits of goals. Therefore, argumentation frameworks in which preferences […] are ‘given’, and not themselves subject to reasoning, do not suffice.” [15]. We will follow this philosophy with our own framework, aiming to use preference orderings which can be derived from the properties of norms and arguments, rather than relying on orderings given a priori.

4 Normative conflict resolution

4.1 Graph colouring for normative conflicts

Now that we have access to both graph colouring and conflict graphs, we can use these two tools to begin to solve normative conflicts. Now assume we have an arbitrary heuristic function h:G×Φ×h:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R} — calling hh would appear in the form h(G,ϕ,c)h(G,\phi,c). That is, hh takes a graph, a colouring, and a colour as inputs and evaluates the overall importance of the set of norms corresponding to the given colour by returning a real number.

Let us now introduce our first new algorithm ColourResolve in Algorithm 1, which uses graph colouring, conflict graphs, and an arbitrary heuristic to resolve normative conflicts.

1Inputs: A conflict graph G=(V,E)G=(V,E). A heuristic h:G×Φ×h:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R}.
2Use a graph colouring algorithm of choice to create a kk-colouring ϕ:V\phi:V\rightarrow\mathbb{N}
3cbestargmaxc{1,,k}(h(G,ϕ,c))c_{\text{best}}\leftarrow\operatorname*{argmax}\limits_{c\in\{1,...,k\}}\Big{(}h(G,\phi,c)\Big{)}
4V{vVϕ(v)=cbest}V^{\prime}\leftarrow\{v\in V\mid\phi(v)=c_{\text{best}}\}
5Ω{Norm corresponding to vvV}\Omega\leftarrow\{\text{Norm corresponding to }v\mid v\in V^{\prime}\}
6Return Ω\Omega
Algorithm 1 ColourResolve(G) — resolves normative conflicts in a conflict graph through graph colouring.

ColourResolve first creates a colouring using an arbitrary graph colouring algorithm (we will discuss this further later). On line 1, it then uses the given heuristic to find the colour which maximises the heuristic value, then assigns this to the variable cbestc_{\text{best}}. On line 4, it finds the subset of vertices VVV^{\prime}\subset V corresponding to the colour cbestc_{\text{best}}. On line 1, the norms corresponding to the vertices with colour cbestc_{\text{best}} are found, which are then returned on line 1. ColourResolve always produces an admissible set, which we will now prove.

Proposition 1.

Let G=(V,E)G=(V,E) be any conflict graph. When using ColourResolve on GG with any proper graph colouring algorithm and any heuristic hh, the resulting set of arguments Ω\Omega is always admissible.

Proof.

To show that Ω\Omega is admissible, we need to demonstrate both of the following facts:

  1. 1.

    Ω\Omega is conflict-free.

  2. 2.

    For each aΩa\in\Omega, aa is acceptable wrt. Ω\Omega. That is, for each bAb\in A s.t. bb attacks aa, there exists cΩc\in\Omega s.t. cc attacks bb.

Let us start with showing that statement 1 holds. Suppose for contradiction that Ω\Omega was not conflict-free. Then there exist two arguments u,vΩu,v\in\Omega such that uu attacks vv. Therefore, there exists an edge {u,v}E\{u,v\}\in E in the conflict graph. Since uu and vv are both in Ω\Omega, they must have been assigned the same colour regardless of which heuristic and graph colouring algorithm was used. However, it is not possible to assign the same colour to two vertices connected by an edge in a graph colouring problem. Thus, a conflict cannot exist and so Ω\Omega must be conflict-free.

As for statement 2, let aΩa\in\Omega and let bAb\in A s.t. bb attacks aa. Then there is a normative conflict between aa and bb, so there is a bidirectional edge {a,b}\{a,b\} in the conflict graph GG. Therefore aa attacks bb and aΩa\in\Omega, so aa defends itself.

Since statements 1 and 2 hold, we can conclude that Ω\Omega is admissible. ∎

Since both the graph colouring algorithm and heuristic in Algorithm 1 are arbitrary, ColourResolve is flexible and can be adapted to suit the needs of the situation at hand. For example, one could use advanced graph colouring algorithms to minimise the number of colours used in the graph, which would thereby maximise the number of vertices corresponding to any given colour — this would therefore maximise the number of norms which are admitted at the end of the algorithm. Alternatively, one could use simpler graph colouring algorithms to save computational time. As an example of a polynomial time algorithm one could use, we will briefly outline the DSatur algorithm [16], which has worst-case running time 𝒪(n2)\mathcal{O}(n^{2}) [4]. This was first put forth by Brélaz in 1979 [16] and can be seen in Algorithm 2.

1Input: A graph G=(V,E)G=(V,E)
2while not all vertices have been coloured do
3       Select an uncoloured vertex with maximal degree of saturation. Break ties by selecting the vertex of highest degree. Break further ties arbitrarily.
4      for each colour cc used so far do
5             Attempt to assign colour cc to vertex vv
6       end for
7      if no colours were suitable then
8             Assign vv to a new colour
9       end if
10      
11 end while
12
Algorithm 2 DSatur graph colouring algorithm by Brélaz [16]

Here, the degree of saturation of a vertex vv refers to the number of coloured vertices vv^{\prime} with an edge (v,v)(v,v^{\prime}) or (v,v)(v^{\prime},v). DSatur prioritises colouring vertices with the highest degree of saturation, thereby focusing on assigning colours to vertices which have the fewest colour options available. Ties are broken by selecting the highest-degree vertex, allowing DSatur to focus on vertices which impose the most constraints upon other vertices. The intended purpose of this example is to show the reader a powerful yet intuitive graph colouring method.

4.2 Heuristics

To demonstrate the flexibility of using arbitrary heuristics, we will now define some possible heuristics one could use with ColourResolve. Definition 1 defines a version of lex posterior adapted for use as a heuristic and Definition 2 defines an adapted version of lex superior. Definition 4 defines a heuristic which selects the colour class corresponding to the greatest number of vertices and therefore admits the greatest number of norms.

Definition 1.

Lex posterior (heuristic version)

Given a graph G=(V,E)G=(V,E), a colouring ϕ:V\phi:V\rightarrow\mathbb{N}, and a colour cc\in\mathbb{N}, define the heuristic hpos:G×Φ×h_{\text{pos}}:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R} by:

hpos(G,ϕ,c)vVϕ(v)=c|{v|{v,v}E,Tv<Tv}|h_{\text{pos}}(G,\phi,c)\coloneqq\sum_{v\in V\land\phi(v)=c}\left|\Big{\{}v^{\prime}\big{|}\{v,v^{\prime}\}\in E,T_{v}<T_{v^{\prime}}\Big{\}}\right|

Here, TvT_{v} refers to the time at which the norm corresponding to vertex vv was imposed.

The heuristic hposh_{\text{pos}} finds the number of times any argument corresponding to a vertex with colour cc defeats another argument by being declared earlier.

Our definition of hposh_{\text{pos}} checks for an edge “{v,v}E\{v,v^{\prime}\}\in E”. If we were to generalise our methods to directed graphs, then this edge could either be (v,v)(v,v^{\prime}) or (v,v)(v^{\prime},v), where we would accept either option. We do not need to check the colour of each vertex vv^{\prime} which each vv attacks since no two vertices with the same colour can be connected by an edge.

One could further modify this definition by subtracting the number of times each argument corresponding to a vertex with colour cc is defeated by another argument. In section 5 later, we will perform empirical evaluations on our newly proposed algorithms. There, we will use the modified version of this definition (and similarly modified versions of other definitions in this section). However, the version shown in Definition 1 is simpler to state, which is why this definition has been declared in this way.

Definition 2.

Lex superior (heuristic version)

Given a graph G=(V,E)G=(V,E), a colouring ϕ:V\phi:V\rightarrow\mathbb{N}, and a colour cc\in\mathbb{N}, define the heuristic hsup:G×Φ×h_{\text{sup}}:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R} by:

hsup(G,ϕ,c)vVϕ(v)=c|{v|{v,v}E,ρvρρv}|h_{\text{sup}}(G,\phi,c)\coloneqq\sum_{v\in V\land\phi(v)=c}\left|\Big{\{}v^{\prime}\big{|}\{v,v^{\prime}\}\in E,\rho_{v}\succ_{\rho}\rho_{v^{\prime}}\Big{\}}\right|

Here, ρv\rho_{v} refers to the power of the authority who imposed the norm corresponding to vertex vv.

The preference relation ρ\succ_{\rho} is defined by a weak ordering defined as follows:

For all norms a,ba,b: ρaρρba\rho_{a}\succ_{\rho}\rho_{b}\Leftrightarrow a was imposed by a stronger power than bb

This relation is a simplified version of one used by Vasconcelos et al. [5, Section 7]. Again, as with our definition for lex posterior, we check for edges going in both directions — (v,v)(v,v^{\prime}) and (v,v)(v^{\prime},v). We can also modify the definition by subtracting the number of times each argument with the specified colour is defeated.

In fact, this preference relation can be generalised to fit any preference ordering over vertices in a conflict graph, and new policies can be created when and where necessary. Definition 3 gives a generalised version of Definitions 1 and 2 which is compatible with any weak ordering over all vertices in the conflict graph.

Definition 3.

Heuristic for any general preference relation (generalises definitions 1 and 2)

Given a graph G=(V,E)G=(V,E), a colouring ϕ:V\phi:V\rightarrow\mathbb{N}, and a colour cc\in\mathbb{N}, and some weak ordering \succ on VV, define the heuristic h:G×Φ×h_{\succ}:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R} by:

h(G,ϕ,c)vVϕ(v)=c|{v|{v,v}E,vv}|h_{\succ}(G,\phi,c)\coloneqq\sum_{v\in V\land\phi(v)=c}\left|\Big{\{}v^{\prime}\big{|}\{v,v^{\prime}\}\in E,v\succ v^{\prime}\Big{\}}\right|

We see that Definition 3 becomes equivalent to Definition 1 if the given weak ordering depends only the time at which norms were declared. It also becomes equivalent to Definition 2 if the given weak ordering depends only on the power of the authority who imposed the given norm. We can also see that Definition 3 generalises lex specialis if the given weak ordering is defined by the following:

For all norms a,ba,b: aba\succ b\Leftrightarrow ant(aa) \subsetneq ant(bb)

…where ant(xx) is the set of antecedents of xx for any argument xx (or in the case of a norm, ant(xx) corresponds to the requirements for norm xx to come into effect).

Since we have shown that ColourResolveColourResolve is compatible with lex posterior, lex superior, and lex specialis, we have met our criteria for showing that our system is adaptable with respect to conflict resolution policies. In later sections, we will be modifying ColourResolveColourResolve, but as long as the system continues to use the notion of heuristics, it will remain policy-adaptable.

There is one more heuristic of note which we will define before we consider it further in Section 4.3. This heuristic selects the colour class which corresponds to the greatest number of vertices overall, and can be seen in Definition 4.

Definition 4.

Maximal colour class heuristic

Given a graph G=(V,E)G=(V,E), a colouring ϕ:V\phi:V\rightarrow\mathbb{N}, and a colour cc\in\mathbb{N}, define the heuristic hmax:G×Φ×h_{\max}:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R} by:

hmax(G,ϕ,c)|{vVϕ(v)=c}|h_{\max}(G,\phi,c)\coloneqq\Big{\lvert}\big{\{}v\in V\mid\phi(v)=c\big{\}}\Big{\rvert}

4.3 Producing argumentation extensions with ColourResolve

Upon inspection, it may appear that using the hmaxh_{\max} heuristic with a suitable graph colouring algorithm for ColourResolve would produce a preferred extension. Intuitively, both the preferred extension and the hmaxh_{\max} heuristic aim to maximise the number of arguments which are admitted. This certainly is the case with the graph and the colouring shown in Figure 2(b), where the colouring is both optimal and corresponds to a preferred extension under hmaxh_{\max}. However, although hmaxh_{\max} has the potential to often produce a preferred extension, this is not always the case.

Consider the graph shown in Figure 3(a) – let us arbitrarily call this graph G6G_{6} since it has 6 vertices. It is possible to create a valid 3-colouring for G6G_{6}, which can be seen in Figure 3(b). Furthermore, it is impossible to colour G6G_{6} using only two colours since G6G_{6} contains a fully-connected subgraph with three vertices. In other words, G6G_{6} contains “triangles”, and these cannot be coloured with two colours since at least one vertex of the triangle would neighbour a vertex with a colour which matches its own. Therefore, the 3-colouring shown in Figure 3(b) uses the optimal number of colours 111Here, we say that G6G_{6} is 3-chromatic and that χ(G6)=3\chi(G_{6})=3.. By using ColourResolve on G6G_{6} with heuristic hmaxh_{\max} and an exact graph colouring algorithm, we would admit exactly two arguments — those corresponding to either red, green, or blue.

Figure 3: (a) An uncoloured graph. (b) The same graph with a valid 3-colouring. (c) The same graph with an independent vertex set of size 3 (shown in grey).

If we now consider Figure 3(c), we can see that G6G_{6} contains a vertex subset of three disjoint vertices, shown in grey. If we consider G6G_{6} to be a conflict graph, then these grey vertices would correspond to a preferred extension of the corresponding set of arguments. If we wished to colour the graph in Figure 3, we would need one colour for the three grey vertices, then another distinct colour for each of the three remaining vertices. This would give a 4-colouring, which is sub optimal.

Therefore, an exact graph colouring algorithm used with hmaxh_{\max} on a problem with G6G_{6} as its conflict graph would admit two arguments, but a preferred extension would contain at least three arguments. So ColourResolve does not always find a preferred extension when using an exact colouring.

This example serves to show that although ColourResolve is highly versatile, there are situations where the results it produces differ from those of preferred semantics. The caveat here is that we assume that using an exact graph colouring algorithm will allow us to admit the highest possible amount of arguments with heuristic hmaxh_{\max}, but this may not always be the case. For example, it may be possible that other sub-optimal graph colouring algorithms would assign all vertices in the independent set in Figure 3(c) to a single colour while assigning each of the remaining vertices their own unique colours. This would create a 4-colouring of G6G_{6} and would allow heuristic hmaxh_{\max} to admit three vertices despite the colouring being sub-optimal. We can therefore see that colouring corresponding to other types of extensions exist, but to find them would depend on the colouring algorithm one uses.

Although a preferred extension is not guaranteed with ColourResolve, it is straightforward to guarantee a complete extension by modifying our algorithm. To do so, we will now introduce a variant of ColourResolve called ColourResolveComplete, which can be seen in Algorithm 3.

1Inputs: A conflict graph G=(V,E)G=(V,E). A heuristic h:G×Φ×h:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R}.
2Use a graph colouring algorithm of choice to create a kk-colouring ϕ:V\phi:V\rightarrow\mathbb{N}
3cbestargmaxc{1,,k}(h(G,ϕ,c))c_{\text{best}}\leftarrow\operatorname*{argmax}\limits_{c\in\{1,...,k\}}\Big{(}h(G,\phi,c)\Big{)}
4for each vertex vVv\in V do
5       if no neighbouring vertices of vv have colour cbestc_{\text{best}} then
6             ϕ(v)cbest\phi(v)\leftarrow c_{\text{best}}
7       end if
8      
9 end for
10
11V{vVϕ(v)=cbest}V^{\prime}\leftarrow\{v\in V\mid\phi(v)=c_{\text{best}}\}
12Ω{Norm corresponding to vvV}\Omega\leftarrow\{\text{Norm corresponding to }v\mid v\in V^{\prime}\}
13Return Ω\Omega
Algorithm 3 ColourResolveComplete(G) — a variant of ColourResolve which always produces a complete extension. Lines in blue are newly added and were not present in the original ColourResolve.

The difference between our new algorithm and our original algorithm is the addition of lines 3-3. Here, we loop through each vertex in the conflict graph. For each vertex vv, we check whether there exists a neighbouring vertex, say ww, such that {v,w}E\{v,w\}\in E and ϕ(w)=cbest\phi(w)=c_{\text{best}}. If no such ww exists, then we replace the colour of vv with the colour cbestc_{\text{best}}. Note that our colouring ϕ\phi will always remain valid since we have checked for conflicts between neighbouring vertices before changing any colours. We will now prove that ColourResolveComplete always produces a complete extension.

Proposition 2.

Given any conflict graph G=(V,E)G=(V,E), any heuristic hh, and any proper graph colouring algorithm, the resulting set Ω\Omega produced by ColourResolveComplete will always be a complete extension of GG.

Proof.

To show that Ω\Omega is a complete extension, we must demonstrate both of the following:

  1. 1.

    Ω\Omega is admissible.

  2. 2.

    For every argument aAa\in A which is acceptable wrt. Ω\Omega, it holds that aΩa\in\Omega.

For statement 1, the fact that Ω\Omega is admissible follows the same logic as in Proposition 1.

For statement 2, let us take any argument aAa\in A which is acceptable wrt. Ω\Omega. That is, for any bAb\in A where bb attacks aa, there exists some cΩc\in\Omega s.t. cc attacks bb. We need to show that aΩa\in\Omega.

Our algorithm ColourResolveComplete created some colouring ϕ\phi and chose all vertices corresponding to some colour cbestc_{\text{best}} to be assigned to set Ω\Omega. Consider any argument bAb\in A which attacks argument aa — by assumption, we have that there exists some argument cΩc\in\Omega which attacks argument bb. Therefore, there exists an edge {c,b}E\{c,b\}\in E in our conflict graph. Since ϕ(c)=cbest\phi(c)=c_{\text{best}}, we can conclude that ϕ(b)cbest\phi(b)\neq c_{\text{best}}.

Since bb attacks aa, there also exists an edge {b,a}E\{b,a\}\in E in our conflict graph. However, bb is any arbitrary argument, so no neighbouring vertices of vertex aa have the colour cbestc_{\text{best}} (since ϕ(b)cbest\phi(b)\neq c_{\text{best}}). Thus, when ColourResolveComplete (Algorithm 3) reaches vertex aa on line 3, the “if” statement on line 3 will resolve to True. Therefore aa will be assigned colour cbestc_{\text{best}} on line 3.

Hence ϕ(a)=cbest\phi(a)=c_{\text{best}}, so we have that aΩa\in\Omega, so statement 2 holds and therefore Ω\Omega is a complete extension. ∎

The proof of Proposition 2 is independent of the order in which we consider vertices to be recoloured, so we will obtain a complete extension regardless of this order. One could iterate through verices in a random order, create an ordering using the heuristic function, or through any other method. However, the complete extension created as a result may be different depending on the method used. Additionally, we cannot recolour all vertices simultaneously since recolouring one vertex may cause another to become the neighbour of a vertex with colour cbestc_{\text{best}}.

4.4 Admitting further norms through curtailment

So far, we have resolved normative conflicts by completely omitting one of the two conflicting norms. As such, only a single colour in the colourings we create is of any value to us in creating the output of the algorithms we have used so far. In this section, we will admit norms corresponding to multiple colours into our algorithm’s output, making the advantages of involving graph colouring more apparent.

We have so far used our heuristic function to find a best colour, but we can easily extend this to find an entire preference relation over all colours. We would define this preference relation for two colours c1,c2c_{1},c_{2}\in\mathbb{N} as c1c2c_{1}\succeq c_{2} iff h(c1)h(c2)h(c_{1})\geq h(c_{2}). From this, for any kk-colouring, we can infer a weak ordering of colours (c1,c2,,ck)(c_{1},c_{2},...,c_{k}) where c1c2ckc_{1}\succeq c_{2}\succeq...\succeq c_{k}.

With this ordering, we can first admit all arguments corresponding to our most preferred colour, then those corresponding to the next most preferred colour, and so on, until we have admitted as many arguments as possible. However, a key issue arises here in that we cannot admit two conflicting arguments with our current set of tools — this is where we will need curtailment.

Our inspiration for curtailment comes from Vasconcelos et al. [5, Definition 10]. In their work, curtailment is defined rigorously for constraining one norm with respect to another. Their framework takes into account the times at which norms were declared, when norms come into effect, and when norms expire, and they therefore introduce a robust definition of curtailment which utilises these factors. However, we will consider curtailment to be a generalised concept to keep our framework as broadly applicable and as abstract as possible. Given two conflicting norms, norm 1 and norm 2, we will consider the curtailed variant of norm 2 with respect to norm 1 to be as follows:

Whenever norm 1 is applicable and it is possible to abide by norm 1, then ignore norm 2. Else, abide by norm 2.

Replacing a norm with its curtailed version eliminates the conflict between the two corresponding norms and therefore removes an edge from the conflict graph. The concept of curtailment can also be viewed as another form of contrary-to-duty obligations, where an agent must abide by a secondary norm whenever some primary norm cannot be followed.

As an example, let us consider two norms with time dependencies. Norm x1x_{1} says “Between 09:00 and 17:00, Agent 1 should focus on work tasks”. Norm yy says “Between 12:00 and 13:00, Agent 1 should take a lunch break”. By curtailing norm xx wrt. norm yy, we obtain a new norm x2x_{2} which does not conflict with yy. Here, x2x_{2} would say “Between 09:00 and 12:00, and between 13:00 and 17:00, Agent 1 should focus on work tasks”. Figure 4(a) shows norms yy and x1x_{1} in a timeline, where we can see a conflict between 12:00 and 13:00. Figure 4(b) shows norms yy and x2x_{2}, where the normative conflict has been resolved through curtailment. This allows the agent to follow norm yy (take a lunch break) when it is applicable whilst also following norm x1x_{1} at all other times. One could view this example as an application of lex specialis since we have prioritised norm yy over norm x1x_{1} as it specifies a narrower time interval.

(a) Norms yy and x1x_{1}. Note that there is a normative conflict between 12:00 and 13:00.
(b) Norms yy and x2x_{2}, where x2x_{2} is the curtailed version of norm x1x_{1} wrt. norm yy. This curtailment eliminates the normative conflict whilst allowing norm x1x_{1} to be followed whenever norm yy is not applicable.
Figure 4: A timeline showing which norms an agent should follow over time. In (a), we have norm x1x_{1} which should be followed between 09:00 and 17:00, and a conflicting norm yy which should be followed between 12:00 and 13:00. Norm x2x_{2} in (b) is the curtailed version of norm x1x_{1} wrt. norm yy, which does not conflict with y.y.

With curtailment in place, we are now ready to introduce an algorithm which uses every colour in the conflict graph. This can be seen in Algorithm 4, which shows ColourCurtail.

1Inputs: A conflict graph G=(V,E)G=(V,E). A heuristic h:G×Φ×h:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R}.
2Use a graph colouring algorithm of choice to create a kk-colouring ϕ:V\phi:V\rightarrow\mathbb{N}
3Ω\Omega\leftarrow\varnothing
4for i=1i=1 to kk do
5       cic_{i}\leftarrow The colour corresponding to the ithi^{th}-highest heuristic value. Break ties arbitrarily.
6      V{vVϕ(v)=ci}V^{\prime}\leftarrow\{v\in V\mid\phi(v)=c_{i}\}
7      for each vertex vVv\in V^{\prime} do
8             for each wΩw\in\Omega s.t. {v,w}E\{v,w\}\in E do
9                   CURTAIL vv in-place wrt. ww
10             end for
11            
12       end for
13      
14      ΩΩ{Norm corresponding to vvV}\Omega\leftarrow\Omega\cup\{\text{Norm corresponding to }v\mid v\in V^{\prime}\}
15 end for
16
17Return Ω\Omega
Algorithm 4 ColourCurtail(G) — An extended version of ColourResolve which uses curtailment to admit every norm.

The algorithm starts in the same way as ColourResolve and ColourResolveComplete by creating a kk-colouring on line 4. However, rather than admitting only the vertices corresponding to a specified colour, we iterate over colours on line 4. Line 4 tells us that we iterate over colours in descending order of value according to our heuristic. On line 4 we select the set VVV^{\prime}\subset V of vertices corresponding to the colour on the current iteration of the main loop.

On lines 4 and 4, for each vertex vv with the colour in question, we find each vertex ww with an edge connected to vv where ww is already admitted into the final set Ω\Omega. Since ww is already admitted and ww is attacking vv or vice versa, either ww or vv must be curtailed with respect to the other. Since ww corresponds to a more valuable colour than vv, we should curtail vv with respect to ww, which we do on line 4. Since all arguments corresponding to the current colour are curtailed with respect to all arguments admitted so far, we can now admit all arguments which correspond to the current colour, which we do on line 4. Each time new arguments are admitted, the set Ω\Omega remains conflict-free since each possible conflict has been considered beforehand.

With this algorithm, every argument is eventually admitted into the final set, but some may be completely curtailed to the point of having no effect. For example, if we consider our previous example in Figure 4, we curtailed norm x1x_{1} wrt. norm yy. However, if we were to instead curtail norm yy wrt. norm x1x_{1}, then norm yy would no longer have any effect. However, ColourCurtail would seek to minimise situations where a higher priority norm is curtailed wrt. a lower priority norm since colour classes are considered in descending order of preference according to our heuristic.

As we did with ColourResolve, we can make ColourCurtail more robust by “completing” each colour class when we consider it. This results in our final algorithm, ColourCurtailComplete, which can be seen in Algorithm 5. This utilises all techniques we have seen so far by creating a colouring, iterating through colour classes in descending order of preference, then admitting each colour class with curtailment. The difference between ColourCurtailComplete and ColourResolveComplete is that when we try to complete a colour class with ColourCurtailComplete, we only consider vertices which do not correspond to a colour which has already been admitted into the final set.

On the first iteration of ColourCurtailComplete, a set equivalent to ColourResolveComplete is created, meaning that this set is a complete extension according to Proposition 2. However, on subsequent iterations, we continue to admit further norms into the set. Therefore the set created by ColourCurtailComplete does not fit into notions defined within argumentation (since we have directly altered the norms/arguments by curtailing them), but is nonetheless a superset of a complete extension.

1Inputs: A conflict graph G=(V,E)G=(V,E). A heuristic h:G×Φ×h:G\times\Phi\times\mathbb{N}\rightarrow\mathbb{R}.
2Use a graph colouring algorithm of choice to create a kk-colouring ϕ:V\phi:V\rightarrow\mathbb{N}
3Ω\Omega\leftarrow\varnothing
4for i=1i=1 to kk do
5       cic_{i}\leftarrow The colour corresponding to the ithi^{th}-highest heuristic value. Break ties arbitrarily.
6      for each vertex vVv\in V which has not been admitted into Ω\Omega do
7             if no neighbouring vertices of vv have colour cic_{i} then
8                   ϕ(v)ci\phi(v)\leftarrow c_{i}
9             end if
10            
11       end for
12      
13      V{vVϕ(v)=ci}V^{\prime}\leftarrow\{v\in V\mid\phi(v)=c_{i}\}
14      for each vertex vVv\in V^{\prime} do
15             for each wΩw\in\Omega s.t. {v,w}E\{v,w\}\in E do
16                   CURTAIL vv in-place wrt. ww
17             end for
18            
19       end for
20      
21      ΩΩ{Norm corresponding to vvV}\Omega\leftarrow\Omega\cup\{\text{Norm corresponding to }v\mid v\in V^{\prime}\}
22 end for
23
24Return Ω\Omega
Algorithm 5 ColourCurtailComplete(G) — a variant of ColourCurtail which attempts to “complete” the colour class upon each iteration. Lines in blue are newly added and were not present in the original ColourComplete.

4.4.1 A note on the relative performances of algorithms introduced so far

So far, we have introduced algorithms ColourResolveColour\allowbreak Resolve, ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete, ColourCurtailColour\allowbreak Curtail, and ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete. Of these, ColourResolveColourResolve is our most basic algorithm and serves as a baseline for the remaining algorithms. Given any heuristic, ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete admits the same number or more norms than ColourResolveColour\allowbreak Resolve since it “completes” the extension.

ColourCurtailColour\allowbreak Curtail also outperforms ColourResolveColour\allowbreak Resolve in terms of norms admitted since it iterates over each colour class to admit curtailed versions of the corresponding norms. On the first iteration of ColourCurtailColourCurtail, the norms corresponding to the strongest colour class are admitted, which is equivalent to the result of ColourResolveColourResolve — further norms are then admitted on subsequent iterations. We can use similar reasoning to conclude that ColourCurtailCompleteColourCurtailComplete outperforms ColourResolveCompleteColourResolveComplete

ColourCurtailCompleteColourCurtailComplete outperforms ColourCurtailColourCurtail since it “completes” the colour class at each iteration. Therefore, if a norm is admitted at an earlier iteration (due to completion) than it otherwise would have been, then it will be curtailed with respect to fewer norms than otherwise. Therefore, although ColourCurtailColour\allowbreak Curtail and ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete both admit all norms, we can see that ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete admits norms in a less curtailed state.

Since ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete outperforms ColourCurtailColour\allowbreak Curtail and ColourCurtailColour\allowbreak Curtail outperforms ColourResolveColour\allowbreak Resolve, we see that ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete also outperforms ColourResolveColour\allowbreak Resolve by transitivity.

A visual summary of which algorithms outperform one another can be seen in Figure 5.

Figure 5: A diagram comparing the relative performances of algorithms proposed in Section 4. An arrow from any algorithm aa to any algorithm bb represents that algorithm aa produces an equal or superior output to algorithm bb.

4.5 Complexity of final algorithm

Since ColourCurtailComplete in Algorithm 5 is the most robust algorithm out of those we have introduced, let us informally derive its computational complexity.

Suppose we use a graph G=(V,E)G=(V,E) as an input into ColourCurtailComplete, where |V|=n\left|V\right|=n for some nn\in\mathbb{N}. Then in the worst-case scenario, we would use one colour for each vertex, creating an nn-colouring. This would mean that the loop on line 5 would be executed nn times. Within this loop, on line 5 we would consider at most nn vertices. However, the other inner loop on line 5 is more computationally expensive. Here, we would consider at most nn vertices, then for each of these vertices we would consider at most another nn vertices (which would happen when the vertex in question is connected to every other vertex via an edge).

Therefore, the worst-case computational complexity of ColourCurtailComplete is dependent on three nested loops, each of which considers at most nn items, so the complexity is 𝒪(n×n×n)=𝓞(𝒏𝟑)\mathcal{O}(n\times n\times n)=\boldsymbol{\mathcal{O}(n^{3})}. This result assumes that we are not constrained by the complexity of our graph colouring algorithm (as would be the case with DSatur, for example, which has worst-case running time 𝒪(n2)\mathcal{O}(n^{2})).

5 Empirical Evaluation

So far, we have mathematically proven results about the algorithms we presented, but we yet to empirically assess these algorithms. As ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete do not involve curtailment and instead consider binary decisions as to whether each norm should be admitted, we can compare these to the results of Oren et al. [1] — this would be an especially prudent comparison considering that their work formed a basis for our own.

After they presented normative conflict graphs, another contribution from Oren et al. is that they found a preferred extension, then admitted each norm corresponding to an argument in the preferred extension. We will compare the performance of ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete to the performance of that of a preferred extension. However, we do not expect these algorithms to surpass the performance of a preferred extension. As discussed in Section 4.3, ColourResolveColour\allowbreak Resolve and ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete are not guaranteed to find a preferred extension of a graph — instead, they find an independent set (in the case of ColourResolveColour\allowbreak Resolve) and extend it to a complete extension (in the case of ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete). Both of these notions are subsets (or equal to) a preferred extension. However, the merits of ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete are that they provide a stepping stone towards creating the more powerful variants, ColourCurtailColour\allowbreak Curtail and ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete. As such, the fact that ColourResolveColour\allowbreak Resolve and ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete do not outperform a preferred extension should not diminish their worth. These empirical observations instead serve to provide insight into how much performance is lost by using ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete rather finding a preferred extension. The smaller the gap between the size of sets of admitted norms created by our algorithms and those of a complete extension, the greater a success we can consider our algorithms to be.

In Section 5.1, we will briefly summarise evaluations performed by Oren et al. on their own contributions. In Section 5.2, we will follow the methodology of Oren et al. to obtain a direct comparison of our contributions to theirs. We will then perform further evaluations through our own methodology in Section 5.3.

5.1 Evaluation by Oren et al. on their own work

Oren et al. [1] evaluated the performances of three heuristics for admitting norms with conflict graphs. The first heuristic, random drop, created a conflict-free set by repeatedly selecting a random edge in the conflict graph, then dropping the edge — this process repeats until the graph is conflict-free. The second heuristic, maximal conflict-free set, found the conflict-free set which was maximal wrt. the number of norms it contained, with ties being broken randomly. The final heuristic, preferred extension, found a preferred extension with the conflict graph, then admitted all norms corresponding to arguments in the extension.

These heuristics were evaluated by generating a system of 16 norms. The total number of (directional) conflicts between these norms ranged from 1 to 240 (222Though not explicitly discussed by Oren et al., 240 is the maximum number of edges possible in a directed graph with 16 edges. An undirected graph with nn vertices may have up to (n2){n\choose 2} vertices, so an undirected graph with 16 edges has (162)=120{16\choose 2}=120 edges. We call a graph with the maximal number of edges a complete graph. A complete directed graph with 16 vertices has twice as many edges, giving 240 total.). For each possible number of conflicts, 10 trials were run for each of the three heuristics and the average number of norms admitted over these 10 trials was recorded. The results can be seen in Figure 6.

Refer to caption
Figure 6: A direct copy of results of experiments by Oren et al. [1, Fig. 6]. Description: “An evaluation of the preferred extension based norm conflict resolution heuristic (solid line), compared to the size of the largest conflict free set (dashed line) and the size of the set of norms obtained when dropping the dominant conflicting norm in random order (dotted line). These results are averaged over 10 runs. The y-axis shows the number of norms retained, while the x-axis indicates the number of normative conflicts.” [1]

Oren et al. also point out that as the number of conflicts increases, the number of norms admitted goes down for all three heuristics.

5.2 Evaluations on our work and comparison to Oren et al.

By following the same methodology as Oren et al., we can obtain a direct comparison between the performances of ColourCurtailColourCurtail and ColourCurtailCompleteColourCurtailComplete and the performances of the heuristics proposed by Oren et al.

Although Oren et al. use directed graphs and our algorithms are built for undirected graphs, we can still obtain a direct comparison by allowing directed edges and treating them as though they were undirected. This way, we can go up to 240 edges in our graph. All other hyperparameters for our trials will remain the same as with Oren et al.; the graph will always have 16 vertices, edges will be randomly picked, and each number of edges will be trialled 10 times for each algorithm before the average is taken.

First, let us consider ColourCurtailColourCurtail. In Section 4.2, we showed that the policies of lex superior, lex posterior, and lex specialis can all be characterised in our algorithm by an arbitrary weak ordering. As such, we will consider the performance of our algorithm for both a weak ordering (Def. 3) and a heuristic which selects the largest colour overall class (Def. 4). Without loss of generality, a weak ordering was defined over the 16 norms by assigning each norm a unique integer representing their value from 1 to 16. We will use Brélaz’s DSatur algorithm [16] (Algorithm 2) for graph colouring. By following this methodology and the methodology of Oren et al. we obtain results which can be seen in Figure 7

Figure 7: The number of norms ColourResolveColourResolve when following the methodology of Oren et al. [1]. The blue line represents the performance under a heuristic which considers an arbitrary weak ordering (which generalises lex superior, lex posterior, and lex specialis). The red line represents the performance when selecting norms corresponding to the largest colour class.

As with Figure 6, we can see in Figure 7 that as the number of conflicts increases, the number of norms admitted decreases as expected. To obtain a direct comparison between our results and those of Oren et al., we can overlay Figures 6 and 7 directly — the results of doing so can be seen in Figure 8 333This was achieved by plotting our results over the same intervals as Oren et al. in each axis. GIMP, a photo manipulation program, was then used to scale raster images of the axes directly on top of one another before duplicate elements were erased..

Refer to caption
Figure 8: The results of the evaluations Oren et al. [1] with the results of our evaluations (Figure 7) overlaid directly.

Figure 8 shows us that ColourResolveColourResolve outperforms the random drop heuristic in terms of number of norms admitted both when using a weak ordering and the maximal colour class heuristic. The amount of norms admitted when using the maximal colour class heuristic appears to be approximately on par with the maximal conflict-free set heuristic by Oren et al. This is encouraging as it shows that our use of graph colouring has not restricted us to only being able to select sets which are significantly smaller than the largest independent set (though as discussed in Section 4.3, there are cases where restrictions exist). When using weak orderings, ColourResolveColourResolve was marginally outclassed by the maximal conflict-free set heuristic in terms of number of norms admitted — however, this is to be expected since the weak ordering heuristic’s strength comes from being able to admit the most important norms rather than the greatest overall number of norms. We can also see that the weak ordering and maximal colour class heuristic were both outperformed by the preferred extension heuristic, which as explained earlier in this section, is wholly expected

Let us now consider the performance of ColourResolveCompleteColourResolveComplete. We know that ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete will always admit either the same amount of norms or more than ColourResolveColour\allowbreak Resolve when given the same heuristic. By following the same evaluation procedures, we obtain results which can be seen in Figure 9. In particular, Figure 9(b) shows these results laid over those of Oren et al., as we did earlier. Again, we see that ColourCurtailColourCurtail performs roughly similarly to the maximal conflict-free set heuristic when we use the maximal colour class heuristic. However, a key difference compared to ColourResolveColourResolve is that when we use a weak ordering as a heuristic, the number of norms we admit is roughly similar to the amount admitted under the maximal conflict-free set heuristic. Therefore, we can see that by “completing” our set of admitted norms, the number of newly added norms is greatest when we use a weak ordering, so heuristics based on weak orderings benefit the most from completion.

Refer to caption
Figure 9: (a) The number of norms admitted by ColourCurtailCompleteColourCurtailComplete when following the methodology of Oren et al. (b) The results of the evaluations Oren et al. [1] with the graph from (a) overlaid directly.

5.3 Further evaluation

We have so far compared our results to those of Oren et al. by using the same methodology. We can also do some brief comparisons between the algorithms we have presented so far. Figure 10 shows a direct comparison between the performances of ColourCurtailColourCurtail and ColourCurtailCompleteColour\allowbreak Curtail\allowbreak Complete. The number of norms admitted is roughly the same for each algorthim under the maximal colour class heuristic, which serves to reaffirm our hypothesis that completing the admitted set is most beneficial when using a weak ordering. We can also see that the benefits of doing so are most pronounced when we have fewer conflicts between norms — this is to be expected, since it is easier to append more norms to the admitted set if there are fewer conflicts preventing us from doing so.

We can also observe that the maximal colour class heuristic appears to admit approximately the same number of norms under ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete, meaning that fewer extra norms are admitted by completing the colour class. This implies that, in practice, the largest colour class in a graph is often equal to the maximal independent set of vertices despite this not being a mathematical certainty.

Figure 10: Direct comparison of Figures 7 (performance of ColourCurtailColourCurtail) and 9(a) (performance of ColourCurtailCompleteColourCurtailComplete). Colours from these figures have been used, but lines from Figure 7 have been changed to dashed lines.

Our evaluation has so far focused on the number of norms admitted by each algorithm. However, this metric neglects the importance of each norm when we use a weak ordering. We can evaluate this by using the same methodology we have been using throughout this section, though instead of counting the number of vertices admitted, we will count the number of times each norm we admit is more preferred than a conflicting norm which was not admitted. In other words, we will measure the value of the arbitrary weak ordering heuristic over the set of norms we admit. Further to this, the number of times each vertex in the set is less preferred than a conflicting vertex, we will subtract 1 from the heuristic’s value. This way, the sum of the heuristic values over all norms is 0, so we can judge the worth of an admitted set of norms by how much greater is value is than 0.

Since we are no longer following the methodology of Oren et al., we will no longer allow two edges between each vertex in the conflict graph and we will run 250 trials per number of edges rather than 10 trials. The results of measuring the heuristic values for ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete can be seen in Figure 11(a). Additionally, Figure 11(b) shows the same results, except where the score of the admitted set is measured as an average over the admitted vertices.

Figure 11: Plots of the heuristic scores of the admitted sets created by ColourResolveColour\allowbreak Resolve and ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete (both under a weak ordering) for different numbers of undirected edges in a conflict graph with 16 vertices. (a) shows the sum of scores of admitted vertices while (b) shows the average score per admitted vertex. Duplicate edges were not allowed, and 250 trials were run per algorithm per number of edges.

Surprisingly, we can see that using ColourResolveCompleteColourResolveComplete rather than ColourResolveColourResolve did not result in a change in either the per-vertex score or the overall score of the set of admitted norms. We can also see from Figure 11(b) that the average score per vertex approaches 15 as the number of conflicts approaches its maximum of 120. This is as expected since when we have 120 conflicts, every norm conflicts with every other norm. The heuristic will therefore choose the most preferred norm in the whole set — this outranks every other norm in the weak ordering and therefore scores 15 by scoring 1 in each of its conflicts. On the other hand, when there are very few conflicts, the average score per vertex is near 0. This is to be expected since in this case we are likely to admit a large number of norms, only a few of which are involved in any conflicts.

5.3.1 A note on empirical evaluation of ColourCurtailColourCurtail and ColourCurtailCompleteColourCurtailComplete

Although ColourCurtailColourCurtail and ColourCurtailCompleteColourCurtailComplete were not evaluated, their performances outclass those of ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete respectively (see Section 4.4.1). However, the introduction of curtailment means that we cannot use similar methodology to Oren et al. since the question of a norm’s admittance is no longer binary. Rather, we choose the extent to which a norm should be curtailed. This requires more complex and nuanced evaluation, which we will not include in this paper. However, evaluating the performances of ColourCurtailColourCurtail and ColourCurtailCompleteColourCurtailComplete relative to other methods of resolving normative conflicts may be a potential avenue for future research.

6 Further work

The framework we have introduced opens up various avenues for further work. For example, one could attempt to create a similar system where instead of following a heuristic equivalent a policy for normative conflict resolution, the system would resolve conflicts by using semantics and criteria within the field of argumentation. Such criteria may include the last link or weakest link criteria for defeating arguments [11], as discussed in Section 3.2. It may also be interesting to attempt to find other heuristics which cannot be characterised as a weak ordering (as with the maximal colour class heuristic). Trust-based heuristics [8, 10] may fall under this category.

Alternatively, one could consider a system similar to ours which relies on a conflict graph, though where the edges in the conflict graphs are directed — that is, one argument could attack or conflict with another without the other attacking back. This would allow for graph pruning algorithms, such as those put forth by Oren et al. [1], to be used. These would reduce the number of normative conflicts and therefore reduce the number of edges in the conflict graph. Having fewer edges in the graph generally allows us to use fewer colours when colouring the graph and therefore allows more arguments to be admitted.

One could also investigate whether the algorithms presented in this paper could be modified to produce a preferred extension or a stable extension (detailed in [2]). It may be possible to produce these types of extensions by using a specific graph colouring algorithm which prioritises a specific colour class and therefore assigns as many vertices as possible to this colour — one could then use the hmaxh_{\max} heuristic to select this large colour class. The challenge here arises from guaranteeing that this large colour class is a maximal independent set. For a further challenge, one could try to create a colouring which corresponds to a stable extension, where each argument which is not in the extension is attacked by an argument which is in the extension. To achieve this, one would have to ensure that each vertex either belongs to a given colour class or is connected to a vertex with the given colour class via an edge whilst remaining a valid colouring.

Another area for investigation is how the order in which vertices are considered in ColourResolveComplete (Algorithm 3) affects which complete extension is found. For example, one could raise the question of whether a specific heuristic generate a preference ordering which always results in a preferred or stable extension.

For many of the challenges listed in this section, it may be prudent to investigate the link between maximum independent sets in graphs and graph colouring. For this, the work of Eppstein [17], which involves finding exact graph colourings by listing independent sets, may be useful. It may also be useful to investigate preference-based graph colouring, as with Koseki et al. [18]. Other avenues may include using more robust graph colouring algorithms, where methods such as those discussed by Lewis et al. [19] could be used.

7 Conclusion

We have used normative reasoning as the baseline for our problem with the goal of resolving normative conflicts. From there, we applied argumentation in the style of Dung [2] and conflict graphs in the style of Oren et al. [1], allowing us to use results from the field of graph theory. In our case, we applied graph colouring and briefly showed the efficient and easily comprehensible DSatur graph colouring algorithm by Brélaz [16].

We introduced the notion of a heuristic function to assign a value to each conflict-free set of norms corresponding to each colour class, allowing us to introduce our first algorithm, ColourResolve, in Algorithm 1. We discussed the versatility and shortcomings of ColourResolve and showed in Proposition 1 that ColourResolve always produces an admissible set. We showed some possible heuristics one could use with ColourResolve and demonstrated the equivalence of heuristics based off of weak orderings when using our algorithm. We then introduced ColourResolveComplete (Algorithm 3), which we proved would always produce a complete extension.

We then discussed the notion of curtailment in the style of Vasconcelos et al. [5], allowing us to create a preference ordering over colours and admit norms corresponding to more than one colour in ColourCurtail (Algorithm 4). By combining this with the logic of ColourResolve, we introduced our most robust algorithm, ColourCurtailComplete (Algorithm 5), which has computational complexity 𝒪(n3)\mathcal{O}(n^{3}). ColourCurtailComplete finds a graph colouring, then generates an order of preferences over norms corresponding to each colour class according to some heuristic. It then iterates over each colour class in descending order of preference and admits as many vertices as possible into the given colour class. It then uses curtailment to resolve any conflicts between the current colour class and any colour classes which have been admitted so far, then admits the colour class into the resulting set of norms.

Empirical evaluations were performed to compare ColourResolveColourResolve and ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete both to each other and to heuristics by Oren et al. [1]. We observed that, in practice, ColourResolveColour\allowbreak Resolve and ColourResolveCompleteColour\allowbreak Resolve\allowbreak Complete performed approximately similar to choosing a maximal conflict-free set despite their theoretical limitations. We also observed that when we use a weak ordering as a heuristic, ColourResolveColourResolve and ColourResolveCompleteColourResolveComplete achieve approximately the same heuristic score for admitted vertices.

In terms of our original goals we outlined in Section 1 and refined in Section 3, we have successfully created a system which is compatible with the policies of lex superior, lex posterior, and lex specialis, and we have successfully ensured that the results align with argumentation-based notions (in our case, complete extensions). By using the notion of curtailment, we were also able to successfully admit norms which directly conflict with one another, allowing all norms to be admitted in some form.

The results put forth in this paper could potentially be used in their own right or could be used to create more complex methods of conflict resolution via graph colouring. In terms of direct applications, single-agent or multi-agent systems which use norms may benefit from the algorithms proposed in this paper, including models for safe reinforcement learning, real-world intelligent agents, or systems aiming to uphold safety constraints. There may also be further avenues for research into the links between argumentation, normative reasoning, and graph theory. Other graph-theoretic notions involving independent sets may hold interesting results since they necessarily translate into conflict-free sets of norms.

References

  • [1] Nir Oren, Michael Luck, Simon Miles, and Timothy J Norman. An argumentation inspired heuristic for resolving normative conflict. In Proceedings of the Fifth Workshop on Coordination, Organizations, Institutions and Norms in Agent Systems, 2008.
  • [2] Phan Minh Dung. On the acceptability of arguments and its fundamental role in nonmonotonic reasoning, logic programming and nn-person games. Artificial Intelligence, 77(2):321–357, 1995.
  • [3] Richard M Karp. Reducibility among combinatorial problems. In Complexity of computer computations, pages 85–103. Springer, 1972.
  • [4] Rhyd Lewis. A Guide to Graph Colouring: Algorithms and Applications. Springer, 1st edition, 2015.
  • [5] Wamberto W Vasconcelos, Martin J Kollingbaum, and Timothy J Norman. Normative conflict resolution in multi-agent systems. Autonomous Agents and Multi-Agent Systems, 19(2):124–152, 2009.
  • [6] John F Horty. Moral dilemmas and nonmonotonic logic. Journal of Philosophical Logic, 23(1):35–65, 1994.
  • [7] Christian Straßer and Ofer Arieli. Normative reasoning by sequent-based argumentation. Journal of Logic and Computation, 29(3):387–415, 2019.
  • [8] Simon Parsons, Elizabeth Sklar, and Peter McBurney. Using argumentation to reason with and about trust. In International Workshop on Argumentation in Multi-Agent Systems, pages 194–212. Springer, 2011.
  • [9] Simon Parsons, Yuqing Tang, Elizabeth Sklar, Peter McBurney, and Kai Cai. Argumentation-based reasoning in agents with varying degrees of trust. In The 10th International Conference on Autonomous Agents and Multiagent Systems, volume 2, pages 879–886, 2011.
  • [10] Sarah N Lim Choi Keung and Nathan Griffiths. Using recency and relevance to assess trust and reputation. In Proceedings of AISB 2008 Symposium on Behaviour Regulation in Multi-Agent Systems. The Society for the Study of Artificial Intelligence and Simulation of Behaviour, volume 4, pages 13–18, 2008.
  • [11] Beishui Liao, Nir Oren, Leon van der Torre, and Serena Villata. Prioritized norms and defaults in formal argumentation. Deontic Logic and Normative Systems (2016), 2016.
  • [12] Leila Amgoud and Jonathan Ben-Naim. Ranking-based semantics for argumentation frameworks. In International Conference on Scalable Uncertainty Management, pages 134–147. Springer, 2013.
  • [13] Gerhard Brewka and Thomas Eiter. Preferred answer sets for extended logic programs. Artificial intelligence, 109(1-2):297–356, 1999.
  • [14] Dov M Gabbay. Dung’s argumentation is essentially equivalent to classical propositional logic with the peirce–quine dagger. Logica universalis, 5(2):255, 2011.
  • [15] Sanjay Modgil and Michael Luck. Argumentation based resolution of conflicts between desires and normative goals. In International Workshop on Argumentation in Multi-Agent Systems, pages 19–36. Springer, 2008.
  • [16] Daniel Brélaz. New methods to color the vertices of a graph. Communications of the ACM, 22(4):251–256, 1979.
  • [17] David Eppstein. Small maximal independent sets and faster exact graph coloring. J. Graph Algorithms Appl, 7(2):131–140, 2002.
  • [18] Akira Koseki, Hideaki Komatsu, and Toshio Nakatani. Preference-directed graph coloring. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation, PLDI ’02, page 33–44, New York, NY, USA, 2002. Association for Computing Machinery.
  • [19] Rhyd Lewis, J Thompson, C Mumford, and J Gillard. A wide-ranging computational comparison of high-performance graph colouring algorithms. Computers & Operations Research, 39(9):1933–1950, 2012.

Appendix A Copy of code used

The Python code shown below was used to run trials with ColourResolveCompleteColourResolveComplete. Equivalent trials were run with ColourResolveColourResolve by removing the block of code which “completes” the admitted set.

1import numpy as np
2
3norms = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
4values = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
5n = len(norms)
6np.random.seed(178231423)
7
8numconflicts = 30
9conflicts = []
10while len(conflicts) < numconflicts:
11 conflict = [np.random.choice(norms),np.random.choice(norms)]
12 if conflict[0] != conflict[1]:
13 if conflict not in conflicts:
14 conflicts.append(conflict)
15
16print(conflicts)
17
18def lexposterior(norms,whendeclared,conflict):
19 # Evaluate a norm according to arbitrary weak orderings
20 index0 = norms.index(conflict[0])
21 index1 = norms.index(conflict[1])
22 if whendeclared[index0] > whendeclared[index1]:
23 return 0
24 elif whendeclared[index1] > whendeclared[index0]:
25 return 1
26 elif index0 > index1:
27 return 0
28 else:
29 return 1
30
31def colour_dsatur(vertices,edges):
32 # colour a graph using dsatur algorithm
33
34 colours = [None for i in range(len(vertices))]
35 highestcolour = 0
36 n = len(vertices) # number of vertices
37
38 # get degrees of each vertex
39 degrees = []
40 flatedges = [i for x in edges for i in x]
41 for i in range(len(vertices)):
42 degree = 0
43 for j in flatedges:
44 if i==j:
45 degree += 1
46 degrees.append(degree)
47
48 # find max-degree vertex
49 maxdegree = 0
50 maxdegreevertex = None
51 for i in range(len(degrees)):
52 if maxdegree < degrees[i]:
53 maxdegree = degrees[i]
54 maxdegreevertex = vertices[i]
55 colours[maxdegreevertex] = 0
56
57 while None in colours: # while not all vertices have been coloured
58
59 # find a vertex with maximum degree of saturation
60 dsaturlist = [None for i in range(n)]
61 for i in range(n): # consider each vertex
62 if colours[i] == None: # if current vertex is not yet coloured
63
64 connectedcolours = []
65 for edge in edges: # consider each edge
66
67 if vertices[i] in edge: # if current vertex is in the edge
68 if edge[0] == vertices[i]: # consider colour of the other vertex in the edge
69 othercolour = colours[edge[1]]
70 else:
71 othercolour = colours[edge[0]]
72 if othercolour != None: # consider colour of other vertex
73 if othercolour not in connectedcolours:
74 connectedcolours.append(othercolour) # count colour of other vertex
75 dsaturlist[i] = len(connectedcolours) # save degree of saturation of current vertex
76
77 maxdsatur = max([i for i in dsaturlist if i != None]) # choose a vertex with maximal dsatur. break ties by choosing highest degree vertex
78 maxdegree = 0
79 for i in range(n):
80 if dsaturlist[i] == maxdsatur and degrees[i] > maxdegree and colours[i] == None:
81 maxdegree = degrees[i]
82 vertextocolour = i
83 if maxdegree == 0: # if the only remaining vertices are isolated
84 for i in range(n): # just pick the isolated vertices in order of index
85 if colours[i] == None:
86 vertextocolour = i
87 break
88
89 # assign the vertex the lowest possible colour
90 neighbouringcolours = []
91 for edge in edges:
92 if vertices[vertextocolour] in edge:
93 if vertices[vertextocolour] == edge[0]:
94 othervertex = edge[1] # get other vertex in edge
95 else:
96 othervertex = edge[0]
97 if colours[othervertex] != None: # if neighbouring vertex has been coloured
98 if colours[othervertex] not in neighbouringcolours: # append colour to list of neighbouring colours
99 neighbouringcolours.append(colours[othervertex])
100 for c in colours: # loop through each colour in order
101 if c != None:
102 if c not in neighbouringcolours: # check if colour can be used
103 colours[vertextocolour] = c
104 break
105 else: # if no colour can be used
106 colours[vertextocolour] = max([i for i in dsaturlist if i != None]) # create new colour
107 return colours
108
109
110def getcolourscores(vertices,edges,colouring):
111 colours = list(range(max(colouring)+1))
112 colourvalues = [0 for i in colours]
113
114 for c in colours: # go through each colour
115 for edge in conflicts: # find winner for each edge
116 if colouring[edge[0]] == c or colouring[edge[1]] == c:
117 winner = lexposterior(norms,values,edge)
118 if winner == 0 and colouring[edge[0]] == c:
119 colourvalues[colours.index(c)] += 1
120 elif winner == 1 and colouring[edge[0]] == c:
121 colourvalues[colours.index(c)] -= 1
122 elif winner == 1 and colouring[edge[1]] == c:
123 colourvalues[colours.index(c)] += 1
124 else:
125 colourvalues[colours.index(c)] -= 1
126 return colourvalues
127
128
129
130RUN TRIALS USING ARBITRARY WEAK ORDERING (i.e. lex superior, lex posterior, lex specialis, etc.)
131
132
133
134norms = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
135values = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
136n = len(norms)
137np.random.seed(178231423)
138
139
140results = []
141for numconflicts in range(1,241): # Perform a run of 10 trials for # of conflicts ranging from 1 to 240
142 print(”NUMCONFLICTS:”, numconflicts)
143
144 trialresults = []
145 for trial in range(10):
146
147 # Generate conflicts
148 conflicts = []
149 while len(conflicts) < numconflicts:
150 conflict = [np.random.choice(norms),np.random.choice(norms)]
151 if conflict[0] != conflict[1]:
152 if conflict not in conflicts:
153 conflicts.append(conflict)
154
155 # Colour conflict graph
156 colouring = colour_dsatur(norms,conflicts)
157 colours = list(range(max(colouring)+1))
158
159 # Score each colour
160 scores = getcolourscores(norms,conflicts,colouring)
161 maxcolour = scores.index(max(scores))
162
163 # Get a set of admitted norms
164 admitset = []
165 for i in range(n):
166 if colouring[i] == maxcolour:
167 admitset.append(norms[i])
168
169 for i in range(n): # COMPLETE the extension. Remove this block of code to turn into ColourResolve
170 for edge in conflicts:
171 if (norms[i] in edge) and (edge[0] in admitset or edge[1] in admitset):
172 break
173 else:
174 if norms[i] not in admitset:
175 admitset.append(norms[i])
176
177
178 # Save the size of the admitted set as the result of the trial
179 trialresults.append(len(admitset))
180
181 # Take the average for the entire trial
182 results.append(np.mean(trialresults))
183 np.save(”results-lexposterior-complete.npy”,results)
184
185print(results)
186
187
188
189RUN TRIALS USING MAXIMAL COLOUR CLASS HEURISTIC
190
191
192
193
194norms = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
195values = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
196n = len(norms)
197np.random.seed(178231423)
198
199
200results_maxheur = []
201for numconflicts in range(1,241): # Perform a run of 10 trials for # of conflicts ranging from 1 to 240
202 print(”NUMCONFLICTS:”, numconflicts)
203
204 trialresults = []
205 for trial in range(10):
206
207 # Generate conflicts
208 conflicts = []
209 while len(conflicts) < numconflicts:
210 conflict = [np.random.choice(norms),np.random.choice(norms)]
211 if conflict[0] != conflict[1]:
212 if conflict not in conflicts:
213 conflicts.append(conflict)
214
215 # Colour conflict graph
216 colouring = colour_dsatur(norms,conflicts)
217 colours = list(range(max(colouring)+1))
218
219 # Score each colour USING MAXIMAL COLOUR CLASS HEURISTIC
220 maxcolour = max(set(colouring), key=colouring.count)
221
222 # Get a set of admitted norms
223 admitset = []
224 for i in range(n):
225 if colouring[i] == maxcolour:
226 admitset.append(norms[i])
227
228 for i in range(n): # COMPLETE the extension. Remove this code to turn into ColourComplete
229 for edge in conflicts:
230 if (norms[i] in edge) and (edge[0] in admitset or edge[1] in admitset):
231 break
232 else:
233 if norms[i] not in admitset:
234 admitset.append(norms[i])
235
236 # Save the size of the admitted set as the result of the trial
237 trialresults.append(len(admitset))
238
239 # Take the average for the entire trial
240 results_maxheur.append(np.mean(trialresults))
241
242print(results_maxheur)
243np.save(”results-maxheur-complete.npy”,results_maxheur)

After the above code has was run, the code below was used to run trials where the heuristic scores of vertices in the admitted set were measured.

1
2
3RUN TRIALS USING ARBITRARY WEAK ORDERING (i.e. lex superior, lex posterior, lex specialis, etc.)
4
5
6
7norms = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
8values = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
9n = len(norms)
10np.random.seed(178231423)
11
12
13results = []
14for numconflicts in range(1,241): # Perform a run of 10 trials for # of conflicts ranging from 1 to 240
15 print(”NUMCONFLICTS:”, numconflicts)
16
17 trialresults = []
18 for trial in range(10):
19
20 # Generate conflicts
21 conflicts = []
22 while len(conflicts) < numconflicts:
23 conflict = [np.random.choice(norms),np.random.choice(norms)]
24 if conflict[0] != conflict[1]:
25 if conflict not in conflicts:
26 conflicts.append(conflict)
27
28 # Colour conflict graph
29 colouring = colour_dsatur(norms,conflicts)
30 colours = list(range(max(colouring)+1))
31
32 # Score each colour
33 scores = getcolourscores(norms,conflicts,colouring)
34 maxcolour = scores.index(max(scores))
35
36 # Get a set of admitted norms
37 admitset = []
38 for i in range(n):
39 if colouring[i] == maxcolour:
40 admitset.append(norms[i])
41
42 for i in range(n): # COMPLETE the extension. Remove this block of code to turn into ColourResolve
43 for edge in conflicts:
44 if (norms[i] in edge) and (edge[0] in admitset or edge[1] in admitset):
45 break
46 else:
47 if norms[i] not in admitset:
48 admitset.append(norms[i])
49
50
51 # Save the size of the admitted set as the result of the trial
52 trialresults.append(len(admitset))
53
54 # Take the average for the entire trial
55 results.append(np.mean(trialresults))
56 np.save(”results-lexposterior-complete.npy”,results)
57
58print(results)