\section{Introduction}

Some tasks, due to their complexity, cannot be carried out by single individuals. They need the concourse of sets of people composing teams. Teams provide a structure and means of bringing together people with a suitable mix of individual properties (such as competences or personality). This can encourage the exchange of ideas, their creativity, their motivation and job satisfaction and can actually extend individual capabilities. In turn, a suitable team can improve the overall productivity, and the quality of the performed tasks. However, sometimes teams work less effectively than initially expected due to several reasons: a bad balance of their capacities, incorrect team dynamics, lack of communication, or difficult social situations. Team composition is thus a problem that has attracted the interest of research groups all over the world, also in the area of multiagent systems. MAS research has widely acknowledged competences as important for performing tasks of different nature \cite{Anagnostopoulos12onlineteam,Chen2015,Okimoto,Rangapuram2015}. However, the majority of the approaches represent capabilities of agents in a Boolean way (i.e., an agent either has a required skill or not). This is a simplistic way to model an agent's set of capabilities as it ignores any skill degree. In real life, capabilities are not binary since every individual (e.g. human or software) shows different performances for each competence. Additionally, the MAS literature has typically disregarded significant organizational psychology findings (with the exception of several recent, preliminary attempts like \cite{FarhangianPPS15} or \cite{alberola2016artificial}). Numerous studies in organizational psychology \cite{Arnold,Mount,White} underline the importance of personality traits or \emph{types} for team composition. Other studies have focused on how team members should differ or converge in their characteristics, such as experience, personality, level of skill, or gender, among others \cite{West}, in order to increase performance.

In this paper, we focus on scenarios where a complex task requires the collaboration of individuals within a team. More precisely, we consider a scenario, where there are \emph{multiple instances of the same complex task}. The task has a task type and a set of competence requests with competence levels needed to solve the task. We have a pool of human agents characterized by gender, personality, and a set of competences with competence levels.
Our goal is to partition agents into teams so that within a task all competence requirements are covered (whenever possible) and team members work well together. That is, each resulting team is both \emph{proficient} (covers the required competences) and \emph{congenial} (balances gender and psychological traits). We refer to these teams as \emph{synergistic teams}. We define the \emph{synergistic value} of a team as its balance in terms of competence, personality and gender. Each synergistic team works on the very same task. This scenario is present in many real-life settings, for instance a classroom or a crowdsourcing task.
With this purpose, we design an algorithm that uses a greedy technique both to match competences with the required ones and at the same time to balance the psychological traits of teams' members.

This paper makes the following contributions. To start with, we formalise the synergistic team formation problem as the problem of partitioning a group of individuals into teams with limited size.
We provide an approximate local algorithm to solve  the team composition problem. We empirically evaluate the algorithm using real data. Preliminary results show that our algorithm predicts better the performance of teams than the experts that know students' social situation, background and competences.

\textbf{Outline.} The remaining of this paper is structured as follows. Section~\ref{related} opens with an overview of the related work. Section~\ref{pers} gives the personality background for our model. Section~\ref{sec:model} describes the synergistic team composition problem and Section~\ref{sec:TeamForm} presents our algorithm to solve the synergistic team composition problem. Then, Section~\ref{sec:results} presents results of our algorithm in the context of team composition in the classroom. Finally, Section~\ref{sec:discuss} discusses our approach and future work.
\vspace{-2mm}
\section{Background} \label{related}
To the best of our knowledge, \cite{farhangian2015agent} is the only model that considers both personality and competences while composing teams.  There, the influence of personality on different task allocation strategies (minimizing either undercompetence or overcompetence) is studied. Henceforth, this work is the most relevant for us, however there are substantial differences between our work and \cite{farhangian2015agent}. Firstly, authors do not propose an algorithm to compose teams  based on \emph{both} personality and competences. Secondly, gender balance is not considered in their setting. Finally, \cite{farhangian2015agent} does not provide an evaluation involving real data (only an agent-based simulation is presented).

The rest of the literature relevant to this article is divided into two categories as proposed in \cite{andrejczuk}: those that consider agent capacities (individual and social capabilities of agents) and those that deal with agent personality (individual behaviour models).

\textbf{Capacity.}
The capacity dimension has been exploited by numerous previous works \cite{Anagnostopoulos12onlineteam,Chalkiadakis2012,Chen2015,Crawford,Liemhetcharat2014,Okimoto,JAR2015,Rangapuram2015}. In contrast to our work, where the competences are graded, in the majority of works agents are assumed to have multiple binary skills (i.e., the agent either has a skill or not). For instance, \cite{Okimoto,Crawford} use agents' capabilities to compose one k-robust team for a single task. A team is $k$-robust if removing any $k$ members from the team does not affect the completion of the task. \cite{Anagnostopoulos12onlineteam} uses competences and communication cost in a context where tasks sequentially arrive and teams have to be composed to perform them. Each task requires a specific set of competences and the team composition algorithm is such that the workload per agent is fair across teams.

\textbf{Personality.}
In the team formation literature, the only two models to our knowledge considering personality to compose teams are \cite{FarhangianPPS15} and \cite{alberola2016artificial}. \cite{alberola2016artificial} uses Belbin theory to obtain human predominant \emph{roles} (we discuss this method in Section \ref{pers}).  Additionally, the gender is not taken into account while composing heterogeneous teams, which we believe may be important for team congeniality. Regarding \cite{FarhangianPPS15}, Farhangian et al. use the classical MBTI personality test (this method is discussed in Section \ref{pers}). They look for the best possible team built around a selected leader. In other words, the \emph{best} team for a particular task is composed. Gender balance is not considered in this setting. Finally, although \cite{FarhangianPPS15}'s team composition considered real data, the resulting teams' performance was not validated in any real setting (Bayesian theory was used to predict the probability of success in various team composition conditions).
\vspace{-3mm}
\section{Personality} \label{pers}
In this section, we discuss the most prominent approaches to measure human personality and we explain the details of the method we have decided to examine.

Personality determines people's behaviour, cognition and emotion. Different personality theorists present their own definitions of personality and different ways to measure it based on their theoretical positions.

The most popular approach is to determine personality through a set of questions. There have been several simplified schemes developed over the years to profile human personality. The most populars are:
\begin{enumerate}
\vspace{-1.5mm}
\item the Five Factor Model (aka FFM or ``Big Five''), which uses five broad dimensions to describe human personality \cite{Costa};
\vspace{-1.5mm}
\item Belbin theory \cite{belbin}, which provides a theory on how different role types influence teamwork; and
\vspace{-1.5mm}
\item the Myers-Briggs Type Indicator (MBTI) scheme designed to indicate psychological preferences in how people perceive the world and make decisions \cite{Myers}.
\end{enumerate}
\vspace{-1.5mm}
According to \cite{Poropat}, FFM personality instruments fail to detect significant sex differences in personality structures. It is also argued that the Big Five dimensions are too broad and heterogeneous, and lack the specificity to make accurate predictions in many real-life settings \cite{Boyle,johnson2004genetic}.

Regarding Belbin theory, the results of previous studies considering the correlation between team composition and team performance are ambiguous. Even though some research shows weak support or does not show support for this theory at all \cite{batenburg2013belbin,van2008belbin,partington1999belbin}, it remains popular.

Finally, the MBTI measure consists of four dimensions on a binary scale (e.g. either the person is Extrovert or Introvert). Within this approach, every person falls into one of the sixteen possible combinations of the four letter codes, one letter representing one dimension. This approach is easy to interpret by non-psychologists, though reliance on dichotomous preference scores rather than continuous scores excessively restricts the level of statistical analysis \cite{devito}.

Having considered the arguments above,  we have decided to explore a novel method: the Post-Jungian Personality Theory, which is a modified version of the Myers-Briggs Type Indicator (MBTI) \cite{Myers}, the ``Step II'' version of Quenk, Hammer and Majors \cite{Wilde2013}. The questionnaire to determine personality is short, contains only 20 quick questions (compared to the 93 MBTI questions). This is very convenient for both experts wanting to design teams and individuals doing the test since completing the test takes just a few minutes (for details of the questionnaire, see \cite[p.21]{Wilde2013}). Douglass J. Wilde claims that it covers the same psychological territory as MBTI \cite{Wilde2009}. In contrast to the MBTI measure, which consists of four binary dimensions, the Post-Jungian Personality Theory uses the \emph{numerical} data collected using the questionnaire \cite{Wilde2011}. The results of this method seem promising, since  within a decade this novel approach has tripled the fraction of Stanford teams awarded national prizes by the Lincoln Foundation \cite{Wilde2009}.

The test is based on the pioneering psychiatrist Carl Gustav Jung's cognitive-mode personality model \cite{PT}. It has two sets of variable pairs called psychological functions:
\vspace{-1.5mm}
\begin{itemize}
\item {\bf Sensing / Intuition (SN)} --- describes the way of approaching problems
\vspace{-1.5mm}
\item {\bf Thinking / Feeling (TF)} --- describes the way of making decisions
\end{itemize}
\vspace{-1.5mm}
and two sets of psychological attitudes:
\vspace{-1.5mm}
\begin{itemize}
\item {\bf Perception / Judgment (PJ)} --- describes the way of living
\vspace{-1.5mm}
\item {\bf Extroversion / Introversion (EI)} --- describes the way of interacting with the world
\end{itemize}
\vspace{-1.5mm}
For instance, for the Feeling-Thinking (TF) dimension, a value between -1 and 0 means that a person is of the feeling type, and a value between 0 and 1 means she is of the thinking type. Psychological functions and psychological attitudes compose together a personality. Every dimension of a personality (EI, SN, TF, PJ) is tested by five multiple choice true/false questions.
\vspace{-2mm}
\section{Team Composition Model}\label{sec:model}

In this section we introduce and formalise our team composition problem. First, section \ref{ssec:basic} introduces the basic notions of agent, personality, competence, and team, upon which we formalise our problem. Next, we formalise the notion of task assignment for a single team and a single task, and we characterise different types of assignments. Sections \ref{ssec:proficiency} and \ref{ssec:congeniality} show how to evaluate the proficiency and congeniality degrees of a team. Based on these measures, in section \ref{ssec:synergisticProblem} we formalise the \emph{synergistic team composition problem}.
\subsection{Basic definitions}
\label{ssec:basic}

In our model, we consider that each agent is a human. We characterise each agent by the following properties:
\begin{itemize}
\vspace{-1.5mm}
\item A unique \emph{identifier} that distinguishes an agent from others (e.g. ID card number, passport number, employee ID, or student ID).
\vspace{-1.5mm}
\item \emph{Gender.} Human agents are either a man or a woman.
\item A \emph{personality} represented by four personality traits. Each personality trait is a number between -1 and 1.
\item A \emph{set of competences}. A competence integrates knowledge, skills, personal values, and attitudes that enable an agent to act correctly in a job, task or situation \cite{roe2002competences}. Each agent is assumed to possess a set of competences with associated competence levels. This set may vary over time as an agent evolves.
\end{itemize}
\vspace{-1.5mm}
Next, we formalise the above-introduced concepts.
\vspace{-1.5mm}
\begin{mydef}
A \emph{personality profile} is a vector $\langle sn, \mathit{tf}, ei, pj \rangle \in [-1, 1]^4$, where each $sn, \mathit{tf}, ei, pj$ represents one personality trait.
\end{mydef}

We denote by $C = \{c_1, \dots , c_m\}$ the whole set of competences, where each element $c_i \in C$ stands for a competence.

\begin{mydef}
A \emph{human agent} is represented as a tuple $\langle id, g, \emph{{\bf p}}, l \rangle$ such that:
\begin{itemize}
\item $id$ is the agent's identifier;
\item $g \in \{man, {\mathit woman}\}$ stands for their gender;
\item $\emph{\bf{p}}$ is a personality profile vector $\langle sn, \mathit{tf}, ei, pj \rangle \in [-1, 1]^4$;
\item $l: C \to{[0,1]}$  is a function that assigns the probability that the agent will successfully show competence $c$. We will refer to $l(c)$ as the \emph{competence level} of the agent for competence $c$. We assume that when an agent does not have a competence (or we do not know about it), the level of this competence is zero.
\end{itemize}
\end{mydef}

Henceforth, we will note the set of agents as $A =\{a_1,\ldots, \linebreak a_n\}$. Moreover, We will use super-indexes to refer to agents' components. For instance, given an agent $a \in A$, $id^{a}$ will refer to the $id$ component of agent $a$. We will employ matrix $L \in [0,1]^{n \times m}$ to represent the competence levels for each agent and each competence.
\vspace{-2mm}
\begin{mydef}[Team] A \emph{team} is any non-empty subset of $A$ with at least two agents. We denote by $\cal{K_A}$ $ = (2^A \setminus \{\emptyset\})\setminus \{\{a_i\}| a_i \in A\}$ the set of all possible teams in $A$.
\end{mydef}
\vspace{-2mm}
We assume that agents in teams coordinate their activities for mutual benefit.

\subsection{The task assignment problem}
\label{ssec:assignment}

In this section we focus on how to assign a team to a task.
A task type determines the competence levels required for the task as well as the importance of each competence with respect to the others. For instance, some tasks may require a high level of creativity because they were never performed before (so there are no qualified agents in this matter). Others may require a highly skilled team with a high degree of coordination and teamwork (as it is the case for rescue teams). Therefore, we define a task type as:
\begin{mydef}
A task type $\tau$ is defined as a tuple \\ $\langle \lambda, \mu, {\{(c_{i},l_{i}, w_{i})\}_{i \in I_{\tau}}} \rangle$ such that:
\begin{itemize}
\item $\lambda \in [0,1]$ importance given to proficiency;
\item $\mu \in [-1,1]$ importance given to congeniality;
\item $c_{i} \in C$ is a competence required to perform the task;
\item $l_{i} \in [0,1]$ is the required competence level for competence $c_i$;
\vspace{-1.5mm}
\item $w_{i} \in [0,1]$ is the importance of competence $c_i$ for the success of task of type $\tau$; and
\vspace{-1.5mm}
\item $\sum_{i \in I_{\tau}} w_i = 1$.
\end{itemize}
\end{mydef}
We will discuss the meaning of $\lambda$ and $\mu$  further ahead when defining synergistic team composition (see subsection \ref{ssec:synergisticProblem}).
Then, we define a task as:
\vspace{-1.5mm}
\begin{mydef}A \emph{task} $t$ is a tuple $\langle \tau, m \rangle$ such that $\tau$ is a task type and $m$ is the required number of agents, where $m\geq 2$.
\end{mydef}

Henceforth, we denote by $T$ the set of tasks and by $\mathcal{T}$ the set of task types. Moreover, we will note as $C_{\tau} =\{c_{i} | i \in I_{\tau}\}$ the set of competences required by task type $\tau$.

Given a team and a task type, we must consider how to assign competences to team members (agents). Our first, weak notion of task assignment only considers that all competences in a task type are assigned to some agent(s) in the team

\begin{mydef}Given a task type $\tau$ and a team $K \in \cal{}K_A$, an assignment is a function $\eta: K \to 2^{C_{\tau}}$ satisfying that
$C_{\tau} \subseteq \bigcup_{a \in K} \eta(a)$.
\end{mydef}

\subsection{Evaluating team proficiency} \label{ssec:prof}
\label{ssec:proficiency}

Given a task assignment for a team, next we will measure the \emph{degree of competence} of the team as a whole. This measure will combine both the degree of under-competence and the degree of over-competence, which we formally define first. Before that, we must formally identify the agents that are assigned to each competence as follows.
\vspace{-1.5mm}
\begin{mydef}
Given a task type $\tau$, a team $K$, and an assignment $\eta$, the set $\delta(c_{i}) = \{a \in K | c_{i} \in \eta(a)\}$ stands for the agents assigned to cover competence $c_{i}$.
\end{mydef}
\vspace{-1.5mm}
Now we are ready to define the degrees of undercompentence and overcompetence.
\vspace{-1.5mm}
\begin{mydef}[Degree of undercompentence] \item
\vspace{-1.6mm}
Given a task type $\tau$, a team $K$, and an assignment $\eta$, we define the degree of undercompetence of the team for the task as:
\vspace{-2.5mm}
\begin{equation*}
u(\eta)=
\sum_{i \in I_{\tau}} w_{i} \cdot \frac{\sum_{a \in \delta(c_{i})} |\min(l^{a}(c_{i}) - l_{i},0)|}{|\{a \in \delta(c_{i})|l^{a}(c_{i})-l_{i} < 0\}|}
\end{equation*}
\end{mydef}
\vspace{-2.5mm}
\begin{mydef}[Degree of overcompetence] \item
\vspace{-1.6mm}
Given a task type $\tau$, a team $K$, and an assignment $\eta$, we define the degree of overcompetence of the team for the task as:
\vspace{-2.5mm}
\begin{equation*}
o(\eta)=
\sum_{i \in I_{\tau}} w_i \cdot \frac{\sum_{a \in \delta(c_{i})} \max(l^{a}(c_{i}) - l_{i},0)}{|\{a \in \delta(c_{i})|l^{a}(c_{i})-l_{i} > 0\}|}
\end{equation*}
\end{mydef}
\vspace{-1.5mm}
Given a task assignment for a team, we can calculate its competence degree to perform the task by combining its overcompetence and undercompetence as follows.
\vspace{-1.5mm}
\begin{mydef}Given a task type $\tau$, a team $K$ and an assignment $\eta$, the competence degree of the team to perform the task is defined as:
\begin{equation}
\label{eq:uprof}
u_{\mathit{prof}}(\eta) = 1-(\upsilon \cdot u(\eta)+(1-\upsilon) \cdot o(\eta))
\end{equation}
where $\upsilon \in [0,1]$ is the penalty given to the undercompetence of team $K$.
\end{mydef}
\vspace{-1.5mm}
Notice that the larger the value of $\upsilon$ the higher the importance of the competence degree of team $K$, while the lower the value $\upsilon$, the less important its undercompetence. The intuition here is that we might want to penalize more the undercompetency of teams, as some tasks strictly require teams to be at least as competent as defined in the task type.
\vspace{-1.5mm}
\begin{proposition}
For any $\eta$,  $u(\eta) + o(\eta) \in [0,1]$.
\label{prop1}
\end{proposition}

\begin{proof}
Given that (1) $l^{a}(c_{i}) \in [0,1]$ and $l_{i} \in [0,1]$;
(2) If $\min(l^{a}(c_{i}) - l_{i},0)<0$ then $\max(l^{a}(c_{i}) -l_{i},0) = 0$; and
(3) If $\max(l^{a}(c_{i})-l_{i},0) > 0$ then $\min(l^{a}(c_{i}) - l_{i},0)=0$. Thus, from (1--3)
we have
$|\min(l^{a}(c_{i}) - l_{i},0)|$ + $\max(l^{a}(c_{i})-l_{i},0) \in [0,1]$.
Let $n=|\{a \in \delta(c_{i})|l^{a}(c_{i})-l_{i} > 0\}|$, then obviously it holds that
$\frac{n \cdot (|\min(l^{a}(c_{i}) - l_{i},0)| + \max(l^{a}(c_{i})-l_{i},0))}{n} \in [0,1]$ and as $|\delta(c_i)| \leq n$ then
$\frac{\sum_{a \in \delta(c_{i})}(|\min(l^{a}(c_{i}) - l_{i},0)| + \max(l^{a}(c_{i})-l_{i},0))}{n} \in [0,1]$  holds; and
since $\sum_{i \in I_{\tau}} w_i = 1$ then \\
$\sum_{i \in I_{\tau}} w_i \cdot \frac{\sum_{a \in \delta(c_{i})}(|\min(l^{a}(c_{i}) - l_{i},0)| + \max(l^{a}(c_{i})-l_{i},0))}{n} \in [0,1]$;
Finally, distributing, this equation is equivalent to: \\
$\sum_{i \in I_{\tau}} w_i \frac{\sum_{a \in \delta(c_{i})}(|\min(l^{a}(c_{i}) - l_{i},0)|}{n} \\
+ \sum_{i \in I_{\tau}} w_i \frac{\sum_{a \in \delta(c_{i})}(\max(l^{a}(c_{i})-l_{i},0))}{n} \in [0,1]$ which in turn is equivalent to $ u(\eta) + o(\eta) \in [0,1]$.
\end{proof}
\vspace{-1.5mm}
Function $u_{\mathit{prof}}$ is used to measure how proficient a team is for a given task assignment. However, counting on the required competences to perform a task does not guarantee that the team will succeed at performing it. Therefore, in the next subsection we present an evaluation function to measure \emph{congeniality} within teams. Unlike our measure for proficiency, which is based on considering a particular task assignment, our congeniality measure will solely rely on the personalities and genders of the members of a team.
\subsection{Evaluating team congeniality} \label{ssec:con}
\label{ssec:congeniality}

Inspired by the experiments of Douglass J. Wilde \cite{Wilde2009} we will define the team utility function for congeniality $u_{con}(K)$, such that:
\begin{itemize}
\vspace{-1.5mm}
\item it values more teams whose SN and TF personality dimensions are as diverse as possible;
\vspace{-1.5mm}
\item it prefers teams with at least one agent with positive EI and TF dimensions and negative PJ dimension, namely an extrovert, thinking and judging agent (called ETJ personality),
\vspace{-1.5mm}
\item it values more teams with at least one introvert agent;
\vspace{-2.5mm}
\item it values gender balance in a team.
\end{itemize}
Therefore, the higher the value of function $u_{con}(K)$, the more diverse the team is.
Formally, this team utility function is defined as follows:
\vspace{-1mm}
\begin{equation}
\label{eq:ucon}
\begin{aligned}
u_{con}(K) = & \sigma_{SN}(K) \cdot \sigma_{TF}(K) +  \max_{a_i \in K}{((0,\alpha, \alpha, \alpha) \cdot {\bf p_i}, 0)} \\
 & + {\max_{a_i \in K}{((0,0,-\beta,0) \cdot {\bf p_i}, 0)}} + \gamma \cdot \sin{(\pi \cdot g(K))}
\end{aligned}
\vspace{-2.5mm}
\end{equation}
where the different parameters are explained next.
\begin{itemize}
\vspace{-1.5mm}
\item $\sigma_{SN}(K)$ and $\sigma_{TF}(K)$: These variances are computed over the SN and TF personality dimensions of the members of team $K$. Since we want to maximise $u_{con}$, we want these variances to be as large as possible. The larger the values of $\sigma_{SN}$ and $\sigma_{TF}$ the larger their product will be, and hence the larger team diversity too.
\vspace{-4mm}
\item $\alpha$:  The maximum variance of any distribution over an interval $[a,b]$ corresponds to a distribution with the elements evenly situated at the extremes of the interval. The variance will always be $\sigma^2 \le ((b-a)/2)^2$. In our case with $b=1$ and $a=-1$ we have $\sigma \le 1$. Then, to make the four factors equally important and given that the maximum value for ${\bf p_i}$ (the personality profile vector of agent $a_i$) would be $(1, 1, 1, 1)$ a maximum value for $\alpha$ would be $3 \alpha = ((1-(-1))/2)^2 = 1$, as we have the factor $\sigma_{SN} \cdot \sigma_{TF}$, so $\alpha \le 0.33(3)$. For values situated in the middle of the interval the variance will be $\sigma^2 \le \frac{(b-a)^2}{12}$, hence a reasonable value for $\alpha$ would be $\alpha = \frac{\sqrt[]{(1-(-1))^2)/12}}{3} = 0.19$
\vspace{-1.5mm}
\item $\beta$: A similar reasoning shows that $\beta \le 1$.
\vspace{-1.5mm}
\item $\gamma$ is a parameter to weigh the importance of a gender balance and $g(K) = \frac{w(K)}{w(K) + m(K)}$. Notice that for a perfectly gender balanced team with $w(K) = m(K)$ we have that
$\sin{(\pi \cdot g(K))} = 1$. The higher the value of $\gamma$, the more important is that team $u_{con}$ is gender balanced. Similarly to reasoning about $\alpha$ and $\beta$, we assess $\gamma \leq 1$. In order to make this factor less important than the others in the equation we experimentally assessed that $\gamma = 0.1$ is a good compromise.
\end{itemize}
\vspace{-1.5mm}
In summary, we will use a utility function $u_{con}$ such that: $\alpha = \frac{\sigma_{SN}(K) \cdot \sigma_{TF}(SK)} 3$, $\beta = 3 \cdot \alpha $ and $\gamma = 0.1$.

\subsection{Evaluating synergistic teams}

Depending on the task type, different importance for congeniality and proficiency should be given. For instance, creative tasks require a high level of communication and exchange of ideas, and hence, teams require a certain level of congeniality. While, repetitive tasks require good proficiency and less communication. The importance of proficiency ($\lambda$) and congeniality ($\mu$) is therefore a fundamental aspect of the task type. Now, given a team, we can combine its competence value  (in equation \ref{eq:uprof}) with its congeniality value (in equation \ref{eq:ucon}) to measure its \emph{synergistic value}.
\vspace{-1.5mm}
\begin{mydef}
Given a team $K$, a task type $\tau = \linebreak \langle \lambda, \mu, {\{(c_{i},l_{i}, w_{i})\}_{i \in I_{\tau}}} \rangle$ and a task assignment $\eta: K \rightarrow 2^{C_{\tau}}$, the synergistic value of team $K$ is defined as:
\vspace{-1.5mm}
\begin{equation}
s(K,\eta) = \lambda \cdot u_{\mathit{prof}}(\eta) + \mu \cdot u_{con}(K)
\end{equation}
where $\lambda \in [0,1]$ is the grade to which the proficiency of team $K$ is important, and $\mu \in [-1,1]$ is the grade to which the task requires diverse personalities.
\end{mydef}

\begin{figure}
\caption{Values of congeniality and proficiency with respect to the task type.}
\begin{tikzpicture}
\begin{axis}[
    axis line style={->},
    x label style={at={(axis description cs:0.5,-0.1)},anchor=north},
    y label style={at={(axis description cs:-0.1,.5)},anchor=south},
  xlabel=Proficiency ($\lambda$),
  ylabel=Congeniality ($\mu$),
  xmin=0,
  xmax=1,
  ymin=-1,
  ymax=1,

  unit vector ratio=6 1,
]
    \node[black] at (axis cs:0.25,0.5) {
    \begin{tabular}{c}
    Creative \\ General tasks
  \end{tabular}};
        \node[black] at (axis cs:0.25,-0.5) {\begin{tabular}{c}
    Structured \\ General tasks
  \end{tabular}};
        \node[black] at (axis cs:0.75,0.5) {\begin{tabular}{c}
    Creative \\ Specialized tasks
  \end{tabular}};
        \node[black] at (axis cs:0.75,-0.5) {\begin{tabular}{c}
    Structured \\ Specialized tasks
  \end{tabular}};

    \draw [black, thick] (axis cs:0,-1) rectangle (axis cs:0.5,1);
	\draw (0,0) -- (1,0);

\end{axis}
\end{tikzpicture}
\label{tbl:parameters}
\vspace{-6mm}
\end{figure}

Figure \ref{tbl:parameters} shows the relation between the parameters $\lambda$ and $\mu$.
In general, the higher the $\lambda$, the higher importance is given to the proficiency of a team. The higher the $\mu$ the more important is personality diversity. Notice, that the $\mu$ can be lower than zero. Having $\mu$ negative, we impose that the congeniality value will be as low as possible (to maximize $s(K,\eta)$) and so, team homogeneity is preferred. This situation may happen while performing tasks in unconventional performance environments that have serious consequences associated with failure. In order to quickly resolve issues, a team needs to be proficient and have team-mates who understand one another with minimum communication cost (which is associated to homogeneity of a team).

\subsection{The synergistic team composition problem}
\label{ssec:synergisticProblem}

In what follows we consider that there are multiple instances of the same task to perform. Given a set of agents $A$, our goal is to split them into teams so that each team, and the whole partition of agents into teams, is balanced in terms of competences, personality and gender.
We shall refer to these balanced teams as \emph{synergistic teams}, meaning that they are both congenial and proficient.

Therefore, we can regard our team composition problem as a particular type of set partition problem. We will refer to any partition of $A$ as a team partition. However, we are interested in a particular type of team partitions, namely those where teams are constrained by size $m$ as follows.

\begin{mydef}
Given a set of agents $A$, we say that a team partition $P_m$ of $A$ is constrained by size $m$ iff: (i) for every team $K_i \in P_m$, $K_i \in \cal{K}_A$, $\max(m-1, 2) \leq |K| \leq m+1$ holds; and (ii) for every pair of teams $K_i, K_j \in P_m$ $||K_i| - |K_j|| \le 1$.
\end{mydef}

As $|K| / m$ is not necessarily a natural number, we may need to allow for some flexibility in team size within a partition. This is why we introduced above the condition $\max(m-1, 2) \leq |K| \leq m+1$. In practical terms, in a partition we may have teams differing by one agent. We note by ${\cal P}_m(A)$ the set of all team partitions of $A$ constrained by size $m$. Henceforth, we will focus on team partitions constrained by some size. Since our goal is to find the most competence-balanced and psychologically-balanced team partition, we need a way to measure the synergistic value of a team partition, which we define as follows:

\begin{mydef}
Given a task $t = \langle \tau, m \rangle$, a team partition $P_m$ and an assignment $\eta_i$ for each team $K_i \in P_m$, the synergistic value of $P_m$ is computed by:
\vspace{-1.5mm}
\begin{equation}
u(P_m,\bm{\eta}) = \prod_{i =1}^{|P_m|} s(K_i,\eta_i)
\end{equation}
\vspace{-1.5mm}
where $\bm{\eta}$ stands for the vector of task assignments $\eta_1,\ldots, \linebreak \eta_{|P_m|}$.
\end{mydef}

Notice that the use of a Bernoulli-Nash function over the synergistic values of teams will favour team partitions whose synergistic values are balanced.

Now we are ready to cast the synergistic team composition problem as the following optimisation problem:

\begin{mydef}
Given task $t = \langle \tau, m \rangle$ and set of agents $A$ the \textbf{synergistic team formation problem (STFP)} is the problem of finding a team partition constrained by size $m$, together with competence assignment for its teams, whose synergistic value is maximal. Formally, the STFP is the problem of finding the partition in $P \in \mathcal{P}_m(A)$ and the task assignments $\bm{\eta}$ for the teams in $P_m$ that maximises  $u(P_m,\bm{\eta})$.
\end{mydef}

\vspace{-2mm}
\section{Solving STFP}\label{sec:TeamForm}
In this section we detail an algorithm, the so-called \emph{SynTeam}, which solves the synergistic team formation problem described above. We will start from describing how to split agents into a partition (see subsection \ref{ssec:dist}). Next, we will move on to the problem of assigning competences in a task to team members (see subsection \ref{ssec:asg}), so that the utility of synergistic function is maximal. Finally, we will explain \emph{SynTeam} that is a greedy algorithm that quickly finds a first, local solution, to subsequently improve it, hoping to reach a global optimum.

\subsection{How do we split agents?} \label{ssec:dist}

We note by $n = |A|$ the number of agents in $A$, by $m \in \mathbb{N}$ the target number of agents in each team, and by $b$ the minimum total number of teams, $b = \left\lfloor  n/m\right\rfloor$. We define the quantity distribution of agents in teams of a partition, noted $T: \mathbb{N} \times \mathbb{N} \to \mathbb{N} \times \mathbb{N} \cup (\mathbb{N} \times \mathbb{N})^2 $ as:
\vspace{-2mm}
\begin{equation}
\begin{multlined}
T(n,m) = \\
\begin{cases}
\{(b, m)\}  & \text{if  } n \geq m \textit{ and } n \bmod m  = 0
\\
 \{(n \bmod m,m + 1), \\(b - (n \bmod m),m)\}
  & \text{if  } n \geq m \textit{ and } n \bmod m  \le b
\\
\{(b, m),(1, n \bmod m)\} & \text{if  } n \geq m \textit{ and } n \bmod m > b
\\
\{(0,m)\} & \text{otherwise}
\end{cases}
\end{multlined}
\end{equation}

Note that depending on the cardinality of $A$ and the desired team size, the number of agents in each team may vary by one individual (for instance if there are $n=7$  agents in $A$ and we want to compose duets ($m=2$), we split agents into two duets and one triplet).

\subsection{Solving an Assignment} \label{ssec:asg}

There are different methods to build an assignment. We have decided to solve our assignment problem by using the minimum cost flow model \cite{ahuja1993network}. This is one of the most fundamental problems within network flow theory and it can be efficiently solved. For instance, in \cite{orlin1993faster}, it was proven that the minimum cost flow problem can be solved in $O(m \cdot log(n) \cdot (m + n \cdot log(n)))$ time with $n$ nodes and $m$ arcs.

Our problem is as follows:
There are a number of agents in team $K$ and a number of competence requests in task $t$. Any agent can be assigned to any competence, incurring some cost that varies depending on the agent competence level of the assigned competence. We want to get each competence assigned to at least one agent and each agent assigned to at least one competence in such a way that the total cost (that is both undercompetence and overcompetence) of the assignment is minimal with respect to all such assignments.

Formally, let $G = (N, E)$ be a directed network defined by a set $N$ of $n$ nodes and a set $E$ of $e$ directed arcs. There are four types of nodes: (1) one source node; (2) $|K|$ nodes that represent agents in team $K$; (3) $|C_{\tau}|$ competence requests that form task type $\tau$; and (4) one sink node. Each $arc$ $(i, j) \in E$ has an associated cost $p_{ij} \in \mathbb{R}^+$ that denotes the cost per unit flow on that $arc$.  We also associate with each $arc$ $(i, j) \in E$ a capacity $u_{ij} \in \mathbb{R}^+$ that denotes the maximum amount that can flow on the arc. In particular, we have three kinds of edges: (1) Supply arcs. These edges connect the source to agent nodes. Each of these arcs has zero cost and a positive capacity $u_{ij}$ which define how many competences at most can be assigned to each agent. (2) Transportation arcs. These are used to ship supplies. Every transportation edge $(i, j) \in E$ is associated with a shipment cost $p_{ij}$ that is equal to:
\begin{equation*}
p_{ij} =
\begin{cases}
(l^{a_i}(c_{\mathit{j}}) - l_{\mathit{j}}) \cdot (1-\upsilon) \cdot w_{\mathit{j}} & \text{if  } l^{a_i}(c_{\mathit{j}} - l_{\mathit{j}}) > 0\\
-(l^{a_i}(c_{\mathit{j}}) - l_{\mathit{j}}) \cdot \upsilon \cdot w_{\mathit{j}} & \text{if  } l^{a_i}(c_{\mathit{j}} - l_{\mathit{j}}) < 0
\end{cases}
\label{costeq}
\end{equation*}
\noindent
where $v \in [0,1]$ is the penalty given to the undercompetence of team $K$(see subsection \ref{ssec:prof} for the definition).
(3) Demand arcs. These arcs connect the competence requests nodes to the sink node. These arcs have zero costs and positive capacities $u_{ij}$ which equal the demand for each competence.

Thus, a network is denoted by $(G, w, u, b)$. We associate with each node $i \in N$ an integer number $b(i)$ representing its supply. If $b(n) > 0$ then $n$ is a source node, if $b(n) < 0$ then $n$ is a sink node. In order to solve a task assignment problem, we use the implementation of \cite{goldberg1990finding} provided in the ort-tools.\footnote{\url{https://github.com/google/or-tools/blob/master/src/graph/min_cost_flow.h}}
\vspace{-2mm}
\begin{figure}
\includegraphics[max size={\textwidth}{10.35cm}]{attach/asg.png}
\caption{An example of an assignment graph $G(N,E)$}\label{asg}
\vspace{-6mm}
\end{figure}

\paragraph{Example} Let us consider a team of three agents $K = \{a_1, a_2, a_3\}$:
\begin{itemize}
\vspace{-1.5mm}
\item $a_1 = \langle id_1, `woman', p_1, [l(c_1) = 0.9, l(c_2) = 0.5]\rangle$
\vspace{-1.5mm}
\item $a_2 = \langle id_2, `man', p_2, [l(c_2) = 0.2, l(c_3) = 0.8]\rangle$
\vspace{-1.5mm}
\item $a_3 = \langle id_3, `man', p_3, [l(c_2) = 0.4, l(c_4) = 0.6]\rangle$
\end{itemize}
and task type $\tau$ containing four competence requests \\ $\{(c_{1},0.8, 0.25), (c_{2}, 0.6, 0.25), (c_{3},0.6, 0.25),(c_{4},0.6, 0.25)\}$. \\ The penalty given to undercompetence is equal to $\upsilon=0.6$.

Our goal is to assign agents to competence requests, so that: (1) every agent is responsible for at least one competence, (2) every competence is covered by at least one agent, (3) the overall ``cost'' in minimal.
As shown in figure \ref{asg}, we build a graph out of $n = 9$ nodes that is: one source node ($N_0$), three agents nodes ($N_1 - N_3$), four competences nodes ($N_4 - N_7$) and a sink node ($N_8$). Next, we add edges: (1) between source node $N_0$ and all agent nodes $N_1 - N_3$ that have a cost $p_{si} = 0$ and capacity $u_{si} = 2$ for all $i$ as the maximum number of competences assigned to one agent cannot be bigger than two if we want to make sure that all agents are assigned to at least one competence; (2) between agent nodes $N_1 - N_3$ and competence nodes ($N_4 - N_7$), where each capacity $u_{ij} = 1$ and we calculate costs according to the equation \ref{costeq}. For instance, the cost between $N_1$ and $N_4$ is equal to: $(0.9 - 0.8) \cdot (1-0.6) \cdot 0.25 = 0.01$. We multiply all costs by $1000$ to meet the requirements of the solver (edges need to be integer). Hence, the final cost $p_{14}=10$; (3) edges between competence nodes $N_4 - N_7$ and sink node $N_8$ that have costs $p_{jw} = 0$ and capacities $u_{jw} = 1$ to impose that each is assigned.
Once the graph is built, we pass it to the solver to get the assignment, and we get $c_1$ and $c_2$ assigned to $a_1$, $c_3$ assigned to $a_2$ and $c_4$ assigned to $a_3$.

\subsection{SynTeam algorithm} \label{ssec:SynTeam}

Algorithm \ref{alg:teamDistribution} shows the SynTeam pseudocode.
Algorithm \ref{alg:teamDistribution} is divided into two parts:

{\bf 1. \textsl{Find a first team partition}}. This part of the algorithm simply builds a partition by randomly assigning agents to teams of particular team sizes. This part goes as follows. Given a list of agents $A$, we start by shuffling the list so that the order of agents in the list is random (line~1). Next, we determine the quantitative distribution of individuals among teams of size $m$ using function $T(|A|,m)$ as defined in section \ref{ssec:dist} (line~2). We start from the top of the shuffled list of agents (line~3). For each number of teams (line~4), we define a temporary set $team$ to store a current team (line~5). We add to $team$ subsequent $size$ agents from the shuffled list of agents (line~7). We add the newly created team to the team partition $P_{\mathit{best}}$ that we intend to build (line~10). When reaching line~14, $P_{\mathit{best}}$ will contain a first disjoint subset of teams (a team partition).

{\bf 2. \textsl{Improve the current best team partition}}. The second part of the algorithm consists in improving the current best team partition. The idea is to obtain a better team partition by performing crossovers of two randomly selected teams to yield two better teams. In this part, we took inspiration from simulated annealing methods, where the algorithm might accept swaps that actually decrease the solution quality with a certain probability. The probability of accepting worse solutions slowly decreases as the algorithm explores the solution space (as the number of iterations increases). The annealing schedule is defined by the $\mathit{cooling\_rate}$ parameter. We have modified this method to store the partition with the highest synergistic evaluation found so far.
In detail, the second part works as follows. First, we select two random teams, $K_1$ and $K_2$, in the current team partition (line~15). Then we compute all team partitions of size $m$ with agents in $K_1 \cup K_2$ (line~19), and we select the best candidate team partition, named $P_{\mathit{bestCandidate}}$ (lines~19~to~26). If the best candidate synergistic utility is larger than the utility contribution of $K_1$ and $K_2$ to the current best partition $P_{\mathit{best}}$ (line~27), then we replace teams $K_1$ and $K_2$ by the teams in the best candidate team partition (line~28). If the best candidate team partition utility is lowe
, then we check if the probability of accepting a worse solution is higher than a uniformly sampled value from $[0,1]$ (line~29).
If so,
we replace teams $K_1$ and $K_2$ by the teams in the best candidate team partition (line~30) and we lower $heat$ by a cooling rate. This part of the algorithm continues until the value of $heat$ reaches $1$ (line~13). We also store the best partition found so far (line~34) to make sure we do not end up with worse solution. Finally, we return found best partition $P_{\mathit{bestEver}}$ as well as the assignment $\eta$ for each team.
\begin{algorithm}[h]
\small
\caption{\quad SynTeam}
\label{alg:teamDistribution}
\begin{algorithmic}[1]
    \Require $A$ \Comment{The list of agents}
	\Require $T(|A|,m)$ \Comment{Quantitative team distribution}
    \Require $P_{\mathit{best}} = \emptyset$ \Comment{Initialize best partition}
     \Require $\mathit{heat=10}$ \Comment{Initial temperature for second step}
     \Require $\mathit{Cooling\_rate}$ \Comment{Heating decrease}
     \Ensure $(P, \bm{\eta})$ \Comment{Best partition found and best assignments}
    \State $\mathit{random.shuffle(A)}$
    \If {$T(|A|,m) \ne (0,m)$}
    \State $\mathit{index} = 0$ \Comment{Used to iterate over the agent list}
    \ForAll{$(\mathit{numberOfTeams}, \mathit{size)} \in T(|A|,m)$}
      \State $team = \emptyset$
      \For {$i \in (0,\dots ,\mathit{(size-1))}$}
      \State $team = team \cup A[\mathit{index}]$
      \State $\mathit{index}=\mathit{index} + 1$
      \EndFor
      \State $P_{\mathit{best}} = P_{\mathit{best}} \cup \{team\}$

          \EndFor
              \State $\bm{ \eta_{\mathit{best}}} = \mathit{assign\_agents}(P_{\mathit{best}})$ \Comment{see Subsection \ref{ssec:asg}}
          \State $(P_{\mathit{bestEver}}, \mathit{bestValueEver}) = (P_{\mathit{best}},u(P_{\mathit{best}},\bm{ \eta_{\mathit{best}}}))$
    \While{$\mathit{heat} > 1$}
    \State $(K_1,K_2) = selectRandomTeams(P_{\mathit{best}}$)
        \State $(\eta_1,\eta_2) = \mathit{assign\_agents}(\{K_1,K_2\})$
     \State $\mathit{contrValue} = u(\{K_1,K_2\},(\eta_1,\eta_2))$
    \State $(P_{\mathit{bestCandidate}}, \mathit{best Candidatevalue}) = (\emptyset,0)$
    \ForAll {$P_{\mathit{candidate}} \in P_m(K_1 \cup K_2) \setminus \{K_1,K_2\}$}
    \State $(\eta_1,\eta_2) = assign\_agents(P_{\mathit{candidate}})$
    \State $\mathit{candidateValue} = u(P_{\mathit{candidate}},(\eta_1,\eta_2))$
    \If{$\mathit{candidateValue} > \mathit{bestCandidateValue}$}
    \State $P_{\mathit{bestCandidate}} = P_{\mathit{candidate}}$
    \State $\mathit{bestCandidateValue} = \mathit{candidateValue}$
    \EndIf
    \EndFor
   \If{$\mathit{bestCandidateValue} > \mathit{contrValue}$}
   \State $P_{\mathit{best}} = replace(\{K_1,K_2\},P_{\mathit{bestCandidate}}, P_{\mathit{best}})$
   \ElsIf{$\mathbb{P}(\mathit{bestCandidateValue}, \mathit{contrValue}, heat)$ \StatexIndent[2] $\geq \mathit{random}(0, 1)$}
   \State $P_{\mathit{best}} = replace(\{K_1,K_2\},P_{\mathit{bestCandidate}},P_{\mathit{best}})$
    \EndIf
    \State $\bm{ \eta_{\mathit{best}}} = \mathit{assign\_agents}(P_{\mathit{best}})$
    \If {$\mathit{bestValueEver} < u(P_{\mathit{best}},\bm{ \eta_{\mathit{best}}})$}
    \State $P_{\mathit{bestEver}} = P_{\mathit{best}}$

   \EndIf
      	\State $heat$ = $heat-\mathit{Cooling\_rate}$
    \EndWhile
    \State $return(P_{\mathit{bestEver}},\mathit{assign\_agents(P_{\mathit{bestEver}}}))$
    \EndIf
\end{algorithmic}
\end{algorithm}
\vspace{-4mm}
\section{Experimental Results} \label{sec:results}

\subsection{Experimental Setting}
``Institut Torras i Bages'' is a state school near Barcelona. Collaborative work has been implemented there for the last 5 years in their final assignment (``Treball de S\'{\i}ntesi'') with a steady and significant increase in the scores and quality of the final product that students are asked to deliver. This assignment takes one week and is designed to check if students have achieved, and to what extent, the objectives set in the various curricular areas. It is a work that encourages teamwork, research, and tests relationships with the environment. Students work in teams and at the end of every activity present their work in front of a panel of teachers that assess the content, presentation and cooperation between team members. This is a creative task, although requiring high level of competences.
\subsection{Data Collection}
In current school practice, teachers group students according to their own, manual method based on the knowledge about students, their competences, background and social situation. This year we have used our grouping system based only on personality (SynTeam\ with $\lambda = 0, \mu = 1$) upon two groups of students: `3r ESO A' (24 students), and `3r ESO C' (24 students). Using computers and/or mobile phones, students answered the questionnaire (described in section \ref{pers}) which allowed us to divide them into teams of size three for each class. Tutors have evaluated each team in each partition giving an integer value $v \in [1,10]$ meaning their expectation of the performance of each team.
Each student team was asked to undertake the set of interdisciplinary activities (``Treball de S\'{\i}ntesi'') described above. We have collected each student's final mark for ``Treball de S\'{\i}ntesi'' as well as final marks obtained for all subjects. That is:  Catalan, Spanish, English, Nature, Physics and Chemistry, Social Science, Math, Physical Education, Plastic Arts, Technology. We have used a matrix provided by the tutors to relate each subject to different kinds of intelligence (that in education are understood as competences) needed for this subject. There are eight types of human intelligence \cite{gardner1987theory}, each representing different ways of processing information: Naturalist, Interpersonal, Logical/Mathematical, Visual/Spatial, Body/Kinaesthetic, Musical, Intrapersonal and Verbal/Linguistic. This matrix for each subject and each intelligence is shown in figure \ref{matrix}.

\begin{figure}[h]
\centering
$\begin{bmatrix}
  0 & 1 & 0 & 0 & 0 & 0 & 1 & 1
\\0 & 1 & 0 & 1 & 0 & 1 & 1 & 1
\\0 & 1 & 0 & 0 & 0 & 1 & 1 & 1
\\1 & 1 & 0 & 1 & 1 & 0 & 1 & 1
\\1 & 1 & 1 & 1 & 0 & 0 & 1 & 1
\\1 & 1 & 0 & 0 & 0 & 0 & 1 & 1
\\0 & 1 & 1 & 1 & 0 & 0 & 1 & 1
\\0 & 1 & 0 & 1 & 1 & 0 & 1 & 1
\\0 & 1 & 0 & 1 & 1 & 0 & 1 & 0
\\1 & 1 & 1 & 0 & 1 & 0 & 1 & 1
\end{bmatrix}$
\label{matrix}
\caption{Matrix matching Intelligence with subjects (each row corresponds to a subject, each column to an intelligence)}
\end{figure}

\noindent Subjects are represented by rows and intelligences by columns of the matrix in the order as provided above. Based on this matrix we calculate values of intelligences for every student by averaging all values obtained by her that are relevant for this intelligence. For instance, for Body/Kinaesthetic intelligence, we calculate an average of student marks obtained in Nature, Physical Education, Plastic Arts and Technology. An alternative way to measure students' competences level can be by calculating the collective assessments of each competence (like proposed by \cite{andrejczukCompetences}).

Finally, having competences (Intelligences), personality and actual performance of all students, we are able to calculate synergistic values for each team. We also calculate the average of marks obtained by every student in a team to get teams' performance values.

\subsection{Results}
\noindent
Given several team composition methods, we are interested in comparing them to know which method better predicts team performance. Hence, we generate several team rankings using the evaluation values obtained through different methods. First, we generate a ranking based on actual team performance that will be our base to compare other rankings. Second, we generate a ranking based on the expert evaluations. Finally,  we generate several rankings based on calculated synergistic values with varying importance of congeniality and proficiency. Since ``Traball de S\'{\i}ntesi'' is a creative task, we want to examine the evaluation function with parameters $\mu > 0$ and $\lambda = 1-\mu$. In particular, we want to observe how the rankings change when increasing the importance of competences.
Notice that teacher and actual performance rankings may include ties since the pool of possible marks is discrete (which is highly improbable in case of SynTeam\ rankings). Therefore, before generating rankings based on synergistic values, we round them up to two digits to discretize the evaluation space. An ordering with ties is also known as a \emph{partial ranking}.

Next, we compare teacher and SynTeam\ rankings with the actual performance ranking using the standardized Kendall Tau distance. For implementation details, refer to the work by Fagin et al. \cite{Fagin:2004:CAR,fagin2006comparing}, which also provide sound mathematical principles to compare partial rankings. The results of the comparison are shown in Figure \ref{asg}. Notice that the lower the value of Kendall Tau, the more similar the rankings. We observe that the SynTeam\ ranking improves as the importance of competences increases, and it is best at predicting students' performance for $\lambda = 0.8$ and $\mu = 0.2$ (Kendall Tau equal to $0.15$).  A standardised Kendall Tau distance for teacher ranking is equal to $0.28$, which shows that SynTeam\ predicts the performance better than teachers, when competences are included ($\lambda > 0.2$). We also calculate the values of Kendall Tau for random ($0.42$) and reversed ($0.9$) rankings to benchmark teacher and SynTeam\ grouping methods. The results show that both teachers and SynTeam\ are better at predicting students' performance than the random method.

\begin{figure}
\includegraphics[max size={\textwidth}{10.35cm}]{attach/KendallTauComparison.png}
\caption{Comparison of Kendall-Tau distances between different methods.}\vspace{-2mm}
\label{asg}
\vspace{-2mm}
\end{figure}

\section{Discussion} \label{sec:discuss}
In this paper we introduced SynTeam, an algorithm for partitioning groups of humans into competent, gender and psychologically balanced teams.

To our knowledge, SynTeam\ is the first computational model to build synergistic teams that not only work well together, but  are also competent enough to perform an assignment requiring particular expertise.

We have decided to evaluate our algorithm in the context of a classroom. Besides obvious advantages of observing students work in person, this scenario gave us an opportunity to compare our results with real-life, currently used practice. The results show that SynTeam\ is able to predict team performance better that the experts that know the students, their social background, competences, and cognitive capabilities.

The algorithm is potentially useful for any organisation that faces the need to optimise their problem solving teams (e.g. a classroom, a company, a research unit). The algorithm composes teams in a purely automatic way without consulting experts, which is a huge advantage for environments where there is a lack of experts.

Regarding future work, We would like to investigate how to determine quality guarantees of the algorithm.

Additionally, there is a need to consider richer and more sophisticated models to capture the various factors that influence the team composition process in the real world. We will consider how our problem relates to the constrained coalition formation framework \cite{Rahwan}. This may help add constraints and preferences coming from experts that cannot be established by any algorithm, e.g. Anna cannot be in the same team with Jos\'e as they used to have a romantic relationship.

\newpage
\bibliographystyle{plain}


\section{Introduction}
For more than three decades, understanding the mechanism of superconductivity observed at high critical temperature (HTC) in
strongly correlated cuprates~\cite{LaCuO2_Bednorz_86} has been the ``holy grail”
of many theoretical and experimental condensend matter researchers.
In this context, the observation of superconductivity in
 nickelates $Ln$NiO$_2$, $Ln$=\{La, Nd and Pr\} ~\cite{li_superconductivity_2019,osada_superconducting_2020,osada_nickelate_2021} upon doping with holes is remarkable.
 These superconducting nickelates are isostructural as well as isoelectronic to
HTC cuprate superconductors and thus enable the comparison of
the essential physical features that may be playing a crucial role in the mechanism driving superconductivity.

$Ln$NiO$_2$ family of compounds are synthesized in the so-called infinite-layer structure, where NiO$_2$ and $Ln$ layers are stacked alternatively~\cite{li_superconductivity_2019}.
The NiO$_2$ planes are identical to the CuO$_2$ planes in HTC cuprates which host much of the physics leading to superconductivity~\cite{keimer_quantum_2015}.
A simple valence counting of the these nickelates reveals a {1+} oxidation state for Ni ({2-} for O and {3+} for $Ln$) with 9 electrons in the $3d$ manifold.
In the cuprates, the Cu$^{2+}$ oxidation state gives rise to the same $3d^9$ electronic configuration.
Contrary to many nickel oxides where the Ni atom sits in an octahedral cage of oxygens, in the infinite-layered structure, square planar NiO$_4$ plaques are formed without the apical oxygens.
The crystal field due to square-planar oxygen coordination stabilizes the $d_{z^2}$ orbital of the $e_g$ manifold, making its energy close to the $t_{2g}$ orbitals (the $3d$ orbitals split to 3-fold $t_{2g}$ and 2-fold $e_g$ sub-shells in an octahedral environment). With $d^9$ occupation, a half-filled $d_{x^2-y^2}$-orbital system is realized as in cuprates.
In fact, recent resonant inelastic X-ray scattering (RIXS) experiments~\cite{rossi2020orbital} as well as the {\it ab initio} correlated multiplet calculations~\cite{katukuri_electronic_2020} confirm that the Ni$^{1+}$ $d$-$d$ excitations in NdNiO$_2$\ are similar to the Cu$ ^{2+} $ ions in cuprates~\cite{moretti_sala_energy_2011}.

 Several electronic structure calculations based on density-functional theory (DFT) have shown that in monovalent nickelates the Ni 3$d_{x^2-y^2}$ states sit at the Fermi energy level ~\cite{lee_infinite-layer_2004,liu_electronic_njpqm_2020,zhang_effective_prl_2020}.
 These calculations further show that the nickelates are more close to the Mott-Hubbard insulating limit with a decreased Ni  $3d$- O $2p$ hybridization compared to cuprates.
 The latter are considered to be charge transfer insulators~\cite{zsa_mott_charge_transfer_1985} where excitations across the electronic band gap involves O $2p$ to Cu $3d$ electron transfer.
Correlated wavefunction-based calculations~\cite{katukuri_electronic_2020} indeed find that the contribution from the O $2p$ hole configuration to the ground state wavefunction in NdNiO$_2$\ is four times smaller than in the cuprate analogue CaCuO$_2$.
 X-ray absorption and photoemission spectroscopy experiments~\cite{hepting2020a,goodge-a} confirm the Mott behavior of nickelates.

In the cuprate charge-transfer insulators, the strong hybridization of the Cu 3$d_{x^2-y^2}$\ and O $2p$ orbitals result in O $2p$ dominated bonding and Cu 3$d_{x^2-y^2}$\ -like antibonding orbitals. As a consequence, the doped holes primarily reside on the bonding O $2p$ orbitals, making them singly occupied.
The unpaired electrons on the Cu $d_{x^2-y^2}$\ and the O $2p$ are coupled antiferromagnetically resulting in the famous Zhang-Rice (ZR) spin singlet state~\cite{zhang_effective_1988}.
In the monovalent nickelates, it is unclear where the doped-holes reside. Do they form a ZR singlet as in cuprates? Instead, if the holes reside on the Ni site, do they form a high-spin local triplet  with two singly occupied Ni $3d$ orbitals and aligned ferromagnetically or a low-spin singlet with either both the holes residing in the Ni 3$d_{x^2-y^2}$\ orbital or two singly occupied Ni 3$d$ but aligned anti-parallel.
While Ni L-edge XAS and RIXS measurements~\cite{rossi2020orbital} conclude that an orbitally polarized singlet state is predominant, where doped holes reside on the Ni 3$d_{x^2-y^2}$\ orbital, O K-edge electron energy loss spectroscopy~\cite{goodge-a} reveal that some of the holes also reside on the O $2p$ orbitals.
On the other hand, calculations based on multi-band $d-p$ Hubbard models show that the fate of the doped holes is determined by a subtle interplay of Ni onsite ($U_{dd}$), Ni $d$ - O $2p$ inter-site ($U_{dp}$) Coulomb interactions and the Hund's coupling along with the charge transfer gap~\cite{jiang_critical_prl_2020,Plienbumrung_condmat_2021}.
However, with the lack of extensive experimental data, it is difficult to identify the appropriate interaction parameters for a model Hamiltonian study, let alone identifying the model that best describes the physics of superconducting nickelates.

Despite the efforts to discern the similarities and differences between the monovalent nickelates and superconducting cuprates, there is no clear understanding on the nature of doped holes in NdNiO$_2$.
Particularly, there is no reliable parameter-free \textit{ab initio} analysis of the hole-doped situation.
In this work, we investigate the hole-doped ground state in NdNiO$_2$\ and draw parallels to the hole doped ground state of cuprate analogue CaCuO$_2$.
We use fully {\it ab initio} many-body wavefunction-based quantum chemistry methodology
to compute the ground state wavefunctions for the hole doped NdNiO$_2$\ and CaCuO$_2$.
We find that the doped hole in NdNiO$_2$ mainly localizes on the Ni 3$d_{x^2-y^2}$\ orbital to form a closed-shell singlet, and this singlet configuration contributes to $\sim$40\% of the wavefunction.
In contrast, in CaCuO$_2$ the Zhang-Rice singlet configurations contribute to $\sim$65\% of the wavefunction.
The persistent dynamic radial-type correlations within the Ni $d$ manifold result in stronger $d^8$ multiplet effects than in CaCuO$_2$,
and consequently the additional hole foot-print is more three-dimensional in NdNiO$_2$.
Our analysis shows that the most commonly used three-band Hubbard model to express the doped scenario in cuprates represents ~ 90\% of the $d^8$ wavefunction for CaCuO$_2$, but such a model grossly approximates the $d^8$ wavefunction for the NdNiO$_2$ as it only stands for $\sim$60\% of the wavefunction.

In what follows, we first describe the computational methodology we employ in this work where we highlight the novel features of the methods and provide all the computational details.
We then present the results of our calculations and conclude with a discussion.

\section{The wavefunction quantum chemistry method}
{\it Ab initio} configuration interaction (CI) wavefunction-based quantum chemistry methods, particularly
the post Hartree-Fock (HF) complete active space self-consistent field (CASSCF) and the multireference perturbation theory (MRPT), are employed.
These methods not only facilitate systematic inclusion of electron correlations, but also enable to quantify different types of correlations, static vs dynamic~\cite{helgaker_molecular_2000}.
These calculations do not use any \textit{ad hoc} parameters to incorporate electron-electron interactions unlike other many-body methods, instead, they are computed fully {\it ab initio} from the kinetic and Coulomb integrals.
Such \textit{ab initio} calculations provide techniques to systematically analyze electron correlation effects and offer insights into the electronic structure of correlated solids that go substantially beyond standard DFT approaches, e.g., see Ref.~\cite{Munoz_afm_htc_qc_prl_2000,CuO2_dd_hozoi11,book_Liviu_Fulde,Bogdanov_Ti_12,katukuri_electronic_2020} for the $ 3d $ TM oxides and Ref.~\cite{katukuri_PRB_2012,Os227_bogdanov_12,213_rixs_gretarsson_2012,Katukuri_ba214_prx_2014,Katukuri_njp_2014} for $ 5d $ compounds.
\subsection{Embedded cluster approach}
Since strong electronic correlations are short-ranged in nature \cite{fulde_new_book}, a local approach for the calculation of the $N$ and $N\pm$1 –electron wavefunction is a very attractive option for transition metal compounds.
In the embedded cluster approach, a finite set of atoms, we call quantum cluster (QC), is cut out from the infinite solid and many-body quantum chemistry methods are used to calculate the electronic structure of the atoms within the QC.
The cluster is ``embedded” in a potential that accounts for the part of the crystal that is not treated explicitly.
In this work,  we represent the embedding potential with an array of point charges (PCs) at the lattice positions that are fitted to reproduce the Madelung crystal field in the cluster region~\cite{ewald}.
Such procedure enables the use of quantum chemistry calculations for solids  involving transition-metal or lanthanide ions, see Refs.~\cite{katukuri_ab_2012,katukuri_electronic_2014,babkevich_magnetic_2016}.

\subsection{Complete active space self-consistent field}
CASSCF method~\cite{book_QC_00} is a specific type of multi-configurational (MC) self-consistent field technique in which a complete set of Slater determinants or configuration state functions (CSFs) is used in the expansion of the CI wavefunction is defined in a constrained orbital space, called the active space.
In the CASSCF(n,m) approach, a subset of $n$ active electrons are
fully correlated among an active set of $m$ orbitals, leading to a highly multi-configurational (CAS) reference wavefunction.
CASSCF method with a properly chosen active space guarantees a qualitatively correct wavefunction for strongly correlated systems where static correlation~\cite{book_QC_00} effects are taken into account.
 %
We consider active spaces as large as CAS(24,30) in this work.
Because the conventional CASSCF implementations based on deterministic CI space (the Hilbert space of all possible configurations within in the active space) solvers are limited to active spaces of 18 active electrons in 18 orbitals,
we use the full configuration interaction quantum Monte Carlo (FCIQMC)~\cite{booth_fermion_2009,cleland_survival_2010,guther_neci_2020} and density matrix renormalization group (DMRG) theory~\cite{chan_density_2011,sharma_spin-adapted_2012} algorithms to solve the eigenvalue problem defined within the active space.

\subsection{Multireference perturbation theory}
While the CASSCF calculation provides a qualitatively correct wavefunction, for a quantitative description of a strongly correlated system, dynamic correlations~\cite{book_QC_00} (contributions to the wavefunction from those configurations related to excitations from inactive to active and virtual, and active to virtual orbitals) are also important and must be accounted for.
A natural choice is variational multireference CI (MRCI) approach where the CI wavefunction is extended with excitations involving orbitals that are doubly occupied and empty in the reference CASSCF wavefunction \cite{book_QC_00}.
An alternative and computationally less demanding approach to take into account dynamic correlations is based on perturbation theory in second- and higher-orders.
In multireference perturbation theory (MRPT) MC zeroth-order wavefunction is employed and excitations to the virtual space are accounted by means of perturbation theory.
If the initial choice of the MC wavefunction is good enough to capture the large part of the correlation energy, then the perturbation corrections are typically small.
The most common variations of MRPT are the complete active space second-order perturbation theory (CASPT2)~\cite{anderson_caspt2_1992} and the n-electron valence second-order perturbation theory (NEVPT2)~\cite{angeli_nevpt2_2001} which differ in the type of zeroth-order Hamiltonian $H_0$ employed.

\begin{figure}[!t]
	\begin{center}
		\includegraphics[width=0.450\textwidth]{fig1.pdf}
		\caption{Quantum cluster of five NiO$_4$ (a) and CuO$_4$ (b) plaques considered in our calculations.  The point-charge embedding is not shown.
			The symmetry adapted localized 3$d_{x^2-y^2}$\ and the  oxygen Zhang-Rice-like  2$p$ orbitals, the  basis in which the wavefunction in Table~\ref{wfn} is presented are shown in yellow and green color. }
		\label{fig1}
	\end{center}
\end{figure}

\section{The {\em ab initio} model}
Before we describe the {\em ab initio} model we consider, let us summarize the widely used and prominent model Hamiltonian to study the nature of doped hole in HTC cuprates and also employed for monovalent nickelates lately.
It is the three-band Hubbard model~\cite{emery_3b_hubbard_prl_1987} with
three orbital degrees of freedom (bands) which include the $d$ orbital of Cu with $x^2-y^2$ symmetry and the in-plane oxygen $p$ orbitals aligned in the direction of the nearest Cu neighbours.
These belong to the $b_1$ irreducible representation (irrep) of the $D_{4h}$ point group symmetry realized at the Cu site of the CuO$_4$ plaque, the other Cu $d$ orbitals belong to $a_1$  ($d_{z^2}$), $b_2$ ($d_{xy}$) and $e$  ($d_{xz,yz}$) irreps.
The parameters in this Hamiltonian include the most relevant hopping and Coulomb interactions within this set of orbitals.
More recently, the role of the Cu $3d$ multiplet structure on the hole doped ground state is also studied~\cite{jiang_cuprates_prb_2020}.
While this model explains certain experimental observations, there is still a huge debate on what is the minimum model to describe the low-energy physics of doped cuprates.
Nevertheless, this model has also been employed to investigate the character of the doped hole in monovalent nickelates~\cite{jiang_critical_prl_2020,Plienbumrung_condmat_2021, Plienbumrung_prb_2021}.

Within the embedded cluster approach described earlier,
we consider a QC of five NiO$_4$ (CuO$_4$) plaques that includes five Ni (Cu) atoms, 16 oxygens and 8 Nd (Ca) atoms. The 10 Ni (Cu) ions neighbouring to the cluster are also included in the QC, however, these are considered as total ion potentials (TIPs).
The QC is embedded in point charges that reproduce the electrostatic field of the solid environment.
We used the crystal structure parameters for the thin film samples reported in Ref.~\cite{li_superconductivity_2019,hayward_synthesis_2003,kobayashi_compounds_1997,karpinski_single_1994}.

We used all-electron atomic natural orbital (ANO)-L basis sets of tripple-$\zeta$ quality with additional polarization functions -- [$7s6p4d2f1g$] for Ni (Cu)~\cite{roos_new_2005}
and [$4s3p2d1f$] for oxygens~\cite{roos_main_2004}.
For the eight Nd (Ca) atoms large core effective potentials~\cite{dolg_energy-adjusted_1989,dolg_combination_1993,kaupp_pseudopotential_1991} and associated [$3s2p2d$] basis functions were used.
In the case of Nd, the $f$-electrons were incorporated in the core.
Cu$ ^{1+} $ (Zn$^{2+}$) total ion potentials (TIPs) with [$2s1p$] functions were used for the 10 Ni$^{1+}$ (Cu$^{2+}$)~\cite{ingelmann_thesis}~\footnote{Energy-consistent Pseudopotentials of Stuttgart/Cologne group, \url{http://www.tc.uni-koeln.de/cgi-bin/pp.pl?language=en,format=molpro,element=Zn,job=getecp,ecp=ECP28SDF}, [Accessed: 15-Sept-2021]}
neighbouring ions of the QC.

  \begin{table}[!t]
	\caption{The different active spaces (CAS) considered in this work.
		NEL is number of active electrons and NORB is the number of active orbitals.
		The numbers in parenthesis indicate the orbital numbers in Fig~\ref{activespace_orb}.
	}
	\label{activespaces}
	\begin{center}
		\begin{tabular}{lcc}
			\hline
			\hline\\
			CAS       & NEL  & NORB  \\
			\hline\\
			CAS-1     & 18   & 24 (1-24)  \\
			CAS-2     & 24   & 30 (25-30) \\
			CAS-3\footnote{The four neighbouring Ni$^{1+}$ (Cu$^{2+}$) ions in the quantum cluster are treated as closed shell Cu$^{1+}$ (Zn$^{2+}$) ions.}
			          & 12   & 14  (1, 6, 11, 16 and 21-30)   \\
			\hline
			\hline
		\end{tabular}
	\end{center}
\end{table}
 To investigate the role of different interactions in the $d^8$ ground state,
 two different active spaces were considered.
In the first active space, CAS-1 in Table ~\ref{activespaces}, only the orbitals in the $b_1$ and $a_1$ irreps are active.
These are $d_{x^2-y^2}$ and $d_{z^2}$-like orbitals respectively, and the corresponding double-shell $4d$ orbitals of each of the five Ni (Cu) atoms.
CAS-1 also contains the symmetry-adapted ZR-like composite O 2$p$ and the double-shell 3$p$-like orbitals, numbers 1-20 and 21-24  in Fig.~\ref{activespace_orb}.
At the mean-field HF level of theory, there are 16 electrons within this set of orbitals, resulting in CAS(16,22) active space.
In the second active space, CAS-2, orbitals of $b_2$ and the $e$ irreps from the central Ni (Cu) $d$ manifold are also included.
These are the 3$d_{xy}$, 3$d_{xz,yz}$-like orbitals and the corresponding $4d$ orbitals and the  six electrons, numbers 25-30 in Fig.~\ref{activespace_orb}, resulting in a CAS(24,30) active space.
The latter active space takes into account the $d^8$ multiplet effects within the $3d$ manifold explicitly.

The two active spaces considered in this work not only describe all the physical effects included in the above mentioned three-band Hubbard model but go beyond.
More importantly, we do have any \textit{ad-hoc} input parameters for the calculation as
all the physical interactions are implicitly included in the {\it ab initio} Hamiltonian describing the actual scenario in the real materials.
 We employed {\sc OpenMolcas}~\cite{fdez_galvan_openmolcas_2019} quantum chemistry package for all the calculations.

\begin{figure}[!t]
	\begin{center}
		\includegraphics[width=0.480\textwidth]{cas_orbitals.pdf}
		\caption{Active orbital basis used in the CASSCF calculations,
			plotted using Jmol~\cite{jmol}.
		}
		\label{activespace_orb}
	\end{center}
\end{figure}

 \section{Results}
\subsection{Ground state of the \boldmath${d^8}$ configuration}

Starting from the electronic structure of the parent compounds, where each Ni (Cu) is in the $d^9$ configuration, we compute the electron-removal (in the photoemission terminology) $d^8$ state to investigate the hole-doped quasiparticle state.
Since the parent compounds in $d^9$ configuration have strong nearest neighbour antiferromagnetic (AF) correlations~\cite{katukuri_electronic_2020}, the total spin of our QC in undoped case, with five Ni (Cu) sites, in the AF ground state is $S_{QC}=3/2$.
By introducing an additional hole (or removing an electron) from the central Ni (Cu) in our QC, the $S_{QC}$ values range from 0 to 3.
To simplify the analysis of the distribution of the additional hole, we keep the spins on the four neighbouring Ni (Cu) sites parallelly aligned in all our calculations and from now on we only specify the spin multiplicity of the central Ni (Cu)O$_4$ plaque.
The multiplet structure of the $d^8$ configuration thus consists of only spin singlet and triplet states, spanned by the four irreps of the $3d$ manifold.
The active spaces we consider in this work allow us to compute accurately the excitations only within the $b_1$ and $a_1$ irreps
\footnote{For an accurate quantitative description of the multiplet structure spanned by the other two irreps $b_1$ and $e$, one would need to extend the active space and include the $3d$ and $4d$ manifolds of the four neighbouring Ni (Cu) atoms as well as the O 2$p$ orbitals of the same symmetry, resulting in a gigantic 68 electrons in 74 orbitals active space.}
and we address the full multiplet structure elsewhere.

When computing the  local excitations,  a local singlet state on the central Ni (Cu) corresponds to a total spin on the cluster $S_{QC}=2$.
However,  a local triplet state, with central spin aligned parallel to the neighboring spins, corresponds to $S_{QC}=3$ and do not satisfy the AF correlations.
To avoid the spin coupling between the central $d^8$ Ni (Cu) with the neighbouring $d^9$ Ni (Cu) ions, we replace the latter with closed shell, Cu (Zn) $d^{10}$, ions and freeze them at the mean-field HF level.
Such a simplification is justified, as the local excitation energy we compute is an order of magnitude larger than the exchange interaction~\cite{katukuri_electronic_2020}.
 %

In Table \ref{d8-excit}, the relative energies of the  lowest local spin singlets $^1\!A_{1g}$,  $^1\!B_{1g}$ and spin triplet $^3\!B_{1g}$ states are shown.
These are obtained from CASSCF + CASPT2 calculations with CAS(12,14) active space (CAS-3 in Table~\ref{activespaces}) which includes the 3$d$ and $4d$ orbitals of the central Ni (Cu) ion and the in-plane O 2$p $ and $3p$ orbitals in the $b_1$ irrep.
In the CASPT2 calculation, the remaining doubly occupied O $2p$, the central Ni (Cu) $3s$ and $3p$ orbitals  and all the unoccupied virtual orbitals are correlated.
\begin{table}[!t]
	\caption{Relative energies (in eV) of the electron removal $d^8$ states in NdNiO$_2$\ and the iso-structural CaCuO$_2$\ obtained from CAS(12,14)SCF and CASSCF+CASPT2 calculations.
	}
	\label{d8-excit}

	\begin{center}
		\begin{tabular}{lccccl}
			\hline
			\hline
			State      & \multicolumn{2}{c}{NdNiO$ _{2} $}  & \multicolumn{2}{c}{CaCuO$ _{2} $}  \\
                       & CASSCF & +CASPT2                   &      CASSCF & +CASPT2 \\
            \hline
			$^1\!A_{1g}$  & 0.00  & 0.00 & 0.00  &  0.00  \\
            $^3\!B_{1g}$  & 1.35  & 1.88 & 2.26  &  2.50  \\
            $^1\!B_{1g}$  & 2.98  & 3.24 & 3.21  &  3.33  \\
			\hline
			\hline
		\end{tabular}
	\end{center}
\end{table}
It can be seen that the ground state is of $^1\!A_{1g}$ symmetry and the lowest triplet excited state, with $^3\!B_{1g}$ symmetry, is around 1.88 eV and 2.5 eV for NdNiO$_2$\  and CaCuO$_2$\ respectively.
The AF magnetic exchange in these two compounds is 76 meV and 208 meV respectively~\cite{katukuri_electronic_2020}, and thus we expect that our simplification of making the neighbouring $d^9$ ions closed shell do not over/underestimate  the excitation energies.
At the CASSCF level, the $^1\!A_{1g}$-$^3\!B_{1g}$ excitation energy is 1.35 eV in NdNiO$_2$\ while it is 2.26 eV in CaCuO$_2$.
Interestingly, the inclusion of dynamical correlations via the CASPT2 calculation, the $^1\!A_{1g}$ in NdNiO$_2$\ is stabilized by 0.53 eV compared to $^3\!B_{1g}$ state.
However, in CaCuO$_2$, the $^1\!A_{1g}$ state is stabilized by only 0.24 eV.
This indicates that the dynamical correlations are more active in the $^1\!A_{1g}$ state in NdNiO$_2$\ than in CaCuO$_2$.
We note that the hole excitations within the $3d$ orbitals in the irreps $b_2$ and $e$, calculated with this limited active space (CAS-3) results in energies lower than the $^3\!B_{1g}$ and $^1\!B_{1g}$ states.
However, an accurate description of those states requires an enlarged active space that includes not only the same symmetry oxygen 2$p$ and $3p$ orbitals from the central NiO$_4$ plaque but also the 3$d$, 4$d$ manifold of the neighbouring Ni (Cu) ions, making the active space prohibitively large.
Here, we concentrate on the analysis of the $^1\!A_{1g}$ ground state and address the complete $d^8$ multiplet spectrum elsewhere.
\begin{table}[!b]
	\caption{
		Ni and Cu $3d^8$ $^1\!A_{1g}$ ground state wavefunction: Weights (\%) of the leading configurations
		in the wavefunction computed for  NdNiO$_2$\ and CaCuO$_2$\ with active spaces CAS-1 and CAS-2 (see Table~\ref{activespaces}).
		$d_{b_1}$ and $p_{b_1}$ are the localized  Ni (Cu) $3d_{x^2-y^2}$ and the oxygen  $2p$ ZR-like orbitals (see Fig.~\ref{fig1}) in the $b_1$ irrep respectively.
		Arrows in the superscript indicate the spin of the electrons and a $\square$ indicates two holes.
	}
	\begin{center}
		\begin{tabular}{l llll}
			\hline
			\hline\\[-0.30cm]
			  &   \multicolumn{2}{c}{NdNiO$ _{2} $}  & \multicolumn{2}{c}{CaCuO$ _{2} $}  \\
			  $^1\!A_{1g}$                         &  CAS-1     & CAS-2   & CAS-1    & CAS-2 \\
			\hline
			\\[-0.20cm]
			$|d_{b_{1}}^\square p_{b_{1}}^{\uparrow \downarrow} \rangle$        &  51.87 & 42.40 &  4.20  & 20.25  \\[0.3cm]
			$|d_{b_{1}}^{\uparrow}p_{b_{1}}^{\downarrow} \rangle$        &   8.27  & 10.48 & 42.58 & 38.52  \\[0.3cm]
			$|d_{b_{1}}^{\downarrow}p_{b_{1}}^{\uparrow} \rangle$        &   6.07  &  7.60  & 25.00 & 25.60  \\[0.3cm]
			$|d_{b_{1}}^{\uparrow \downarrow}p_{b_{1}}^\square \rangle$        &   0.09  &  0.23  & 21.56 &  5.14   \\[0.3cm]

			\hline
			\hline
		\end{tabular}
	\end{center}
	\label{wfn}
\end{table}

\subsection{Wavefunction of the electron-removal \boldmath$d^8$ ground state}
The $^1\!A_{1g}$ ground wavefunction in terms of
the weights of the four leading configurations (in the case of CaCuO$_2$) is shown in Table~\ref{wfn}.
The wavefunctions corresponding to the CASSCF calculations with the active spaces CAS-1 and CAS-2 are shown.
The basis in which the wavefunctions are represented is constructed in two steps:
1) A set of natural orbitals are generated by diagonalising the CASSCF one-body reduced density matrix.
2) To obtain a set of atomic-like symmetry-adapted localized orbital basis, we localize the Ni (Cu) $3d$ and O $2p$ orbitals on the central NiO$_4$ (CuO$_4$) plaque through a unitary transformation.
Such partial localization within the active space keeps the total energy unchanged.
The resulting 3$d_{x^2-y^2}$\ and the ZR-like oxygen 2$p$ orbital basis is shown in Fig~\ref{fig1}.
FCIQMC calculation was performed in this partial localized basis to obtain the wavefunction as a linear combination of Slater determinants.
10 million walkers were used to converge the FCIQMC energy to within 0.1 mHartree.

From Table~\ref{wfn} it can be seen that the electron-removal $d^8$ ground state wavefunction for the two compounds is mostly described by the four configurations spanned by the localized 3$d_{x^2-y^2}$\ ($d_{b_1}$) and the symmetry-adapted ZR-like oxygen 2$p$ ($p_{b_1}$) orbitals that are shown in Fig.~\ref{fig1}.
Let us first discus the wavefunction obtain from the CAS-1 active space.
For NdNiO$_2$, the dominant configuration involves two holes on 3$d_{x^2-y^2}$, $|d_{b_{1}}^\square p_{b_{1}}^{\uparrow \downarrow} \rangle$, and contributes to $\sim$52\% of the wavefunction,
while the configurations that make up the ZR singlet, $|d_{b_{1}}^{\uparrow}p_{b_{1}}^{\downarrow} \rangle$ and $|d_{b_{1}}^{\downarrow}p_{b_{1}}^{\uparrow} \rangle$, contributes to only $\sim$14\%.
On the other hand, the $d^8$ $^1\!A_{1g}$ state in CaCuO$_2$\ is predominantly the ZR singlet with $\sim$68\% weight.
In the CASSCF calculation with CAS-2 active space, where all the electrons in the 3$d$ manifold are explicitly correlated,
we find that the character of the wavefunction remains unchanged in NdNiO$_2$\ but weight on the dominant configurations is slightly reduced.
On the other hand, in CaCuO$_2$, while the contribution from the ZR singlet is slightly reduced, the contribution from $|d_{b_{1}}^\square p_{b_{1}}^{\uparrow \downarrow} \rangle$ configuration is dramatically increased at the expense of the weight on
$|d_{b_{1}}^{\uparrow \downarrow}p_{b_{1}}^\square \rangle$.
This demonstrates that the additional freedom provided by the $d_{xy}$ and $d_{xz/yz}$ orbitals for the electron correlation helps to accommodate the additional hole on the Cu ion.

We note that the four configurations shown in Table~\ref{wfn} encompass almost 90\% of the $d^8$ wavefunction (with CAS-2 active space) in CaCuO$_2$.
Thus, the use of a three-band Hubbard model~\cite{emery_3b_hubbard_prl_1987,jiang_cuprates_prb_2020} to investigate the role of doped holes in CuO$_2$ planes is a reasonable choice.
However, for NdNiO$_2$\ these configurations cover only 60\% of the $d^8$ wavefunction, hence a three-band Hubbard model is too simple to describe the hole-doped monovalent nickelates.

A more intuitive and visual understanding of the distribution of the additional hole can be obtained by plotting the difference of the $d^8$ and the $d^9$ ground state electron densities as shown in Fig.~\ref{fig2}.
Electron density of a multi-configurational state can be computed as a sum of densities arising from the natural orbitals and corresponding (well-defined) occupation numbers.
We used Multiwfn program \cite{Multiwfn} to perform this summation.
The negative values of the heat map of the electron density difference (blue color) and the positive values (in red) represent respectively the extra hole density and additional electron density in $d^8$ state compared to the $d^9$ state.
From Fig.~\ref{fig2}(a)/(c) that show the density difference in the NiO$_2$/CuO$_2$ planes (xy-plane), we conclude the following:
\begin{enumerate}
\item The hole density is concentrated on the Ni site (darker blue) with $b_1$ ($d_{x^2-y^2}$) symmetry in NdNiO$_2$\ whereas
 it is distributed evenly on the four oxygen and the central Cu ions with $b_1$ symmetry in CaCuO$_2$, a result consistent with the wavefunction reported in Table~\ref{wfn}.
\item In NdNiO$_2$, the hole density is spread out around the Ni ion with larger radius, and otherwise in CaCuO$_2$.
 This demonstrates that the $3d$ manifold in Cu is much more localized than in Ni and therefore the onsite Coulomb repulsion $U$ is comparatively smaller for Ni.
\item  The darker red regions around the Ni site in NdNiO$_2$\ indicate stronger $d^8$ multiplet effects that result in rearrangement of electron density compared to $d^9$ configuration.
\item  In CaCuO$_2$, we see darker red regions on the oxygen ions instead, which shows that the significant presence of a hole on these ions results in noticeable electron redistribution.
\end{enumerate}

The electron density difference in the xz-plane (which is perpendicular to the NiO$_2$/CuO$_2$ planes) is quite different in the two compounds.
The hole density in NdNiO$_2$\ is spread out up to 2\,\AA\ in the $z$-direction, unlike in CaCuO$_2$, where it is confined to within 1\,\AA .
We attribute this to the strong radial-type correlations in NdNiO$_2$.
With the creation of additional hole on the 3$d_{x^2-y^2}$\ orbital, the electron density which is spread out in the $d_{z^2}$\ symmetry via the dynamical correlation between 3$d_{z^2}$\ and 4$d_{z^2}$\ orbitals~\cite{katukuri_electronic_2020}, becomes more compact in the $d_{z^2}$\ symmetry through the reverse breathing.
Thus, we see a strong red region with 3$d_{z^2}$\ profile and a blue region with expanded 4$d_{z^2}$\ profile.

\begin{figure}[!t]
\begin{center}
	\includegraphics[width=0.48\textwidth]{Density_difference_2.pdf}
	\caption{Electron density difference of the $d^8$ and $d^9$ ground states ($\rho(d^8) - \rho(d^9)$) for NdNiO$_2$\ in the xy-plane (a) and xz-plane (b),  and for CaCuO$_2$\ xy-plane (c) and xz-plane (d).
	The coordinates of the central Ni (Cu) $d^8$ ion are set to (0,0). The scale of the heat-bar is logarithmic between $\pm$0.001 to $\pm$1.0 and is linear between 0 and $\pm$0.001.
	(e) Electron density difference integrated over a sphere centered on on the central Ni(Cu) atoms (full curves) as a function of the radius $r$ shown in (a).
	The result of an additional radial integration (dashed curves) as a function of the upper integration limit.}
	\label{fig2}
\end{center}
\end{figure}
To obtain a quantitative understanding of the charge density differences for the two compounds, in Fig.~\ref{fig2}(e) we plot the electron density difference integrated over a sphere centered on the central Ni(Cu) atom as a function of the radius $r$ shown in Fig.~\ref{fig2}(a).
Four features, which we marked A-D, clearly demonstrate the contrast in the charge density differences in the two compounds.
From the feature A at $r$ close to Ni (Cu), it is evident that
the extent of hole density around Ni in NdNiO$_2$\ is larger than around Cu in CaCuO$_2$.
The features B and C that are on either side of the position of oxygen ions show that the hole density is significantly larger on oxygen atoms in CaCuO$_2$\ than in the NdNiO$_2$.
It is interesting to note that we see a jump (feature D) in the electron density above zero at $r$ close to the position of Nd ions in NdNiO$_2$, while in CaCuO$_2$\ the curve is flat in the region of Ca ions.
This shows that there is some electron redistribution happening around the Nd ions.

The hole density within a solid sphere (SS) around the central Ni (Cu) atom obtained by additional integration over the radius $r$ is also shown in Fig.~\ref{fig2}(e) with dashed curves.
It can be seen that the total hole density within the SS of $r\sim$4\,\AA, where the neighboring Ni (Cu) ions are located, is only $\sim$0.5 in both the compounds, with slight differences related to the feature D.
This is due to the screening of the hole with the electron density pulled in from the farther surroundings.
As one would expect, a SS with $r$ of the size of the cluster, the total hole density is one in both the compounds.

\begin{figure}[!b]
	\begin{center}
		\includegraphics[width=0.480\textwidth]{entropy_4.pdf}
		\caption{Single orbital entanglement entropy, $s(1)_i$, (dots) and mutual orbital entanglement entropy, $I_{i,j}$, (colored lines) of the orbital basis used to expand the $d^8$ wavefunction in Table~\ref{wfn} for NdNiO$_2$\ (a) and CaCuO$_2$\ (b).
		Entanglement entropy of the orbitals centred on the central NiO$_4$/CuO$_4$ plaque are only shown.
		The irrep to which the orbitals belong to are also shown.
		The green and magenta colors represent the two different set of orbitals, occupied (at the HF level) and the corresponding double-shell (virtual), respectively.
		The thickness of the black, blue and green lines denote the strength of $I_{i,j}$, and the size of the dots is proportional to $s(1)_i$.
		}
		\label{entanglement}
	\end{center}
\end{figure}

\subsection{Orbital entanglement entropy }
To analyse the different type of correlations active in the two compounds in $d^8$ configuration, we compute the entanglement entropy~\cite{boguslawski_entanglement_2012,boguslawski_orbital_2013,boguslawski_orbital_2015}.
While the single orbital entropy, $s(1)_i $, quantifies the correlation between $i$-th orbital and the remaining set of orbitals,
the mutual information,  $I_{i,j}$ is the two-orbital entropy between $i$ and $j$~\cite{legeza_optimizing_2003,rissler_measuring_2006}, and illustrates the correlation of an orbital with another, in the embedded environment comprising of all other orbitals.
We used {\sc QCMaquis}~\cite{keller_an_2015} embedded in {\sc OpenMolcas}~\cite{fdez_galvan_openmolcas_2019} package to compute the entropies.

In Figure~\ref{entanglement}, $s(1)_i$ and $I_{i,j}$ extracted from CASSCF calculations with CAS-2 active space for NdNiO$_2$\ and CaCuO$_2$\ are shown.
The orbital basis for which the entropy is computed is the same as the basis in which the wavefunction presented in Table~\ref{wfn} is expanded.
As mentioned previously, this orbital basis is obtained from partial localization of the natural orbitals in a way that only the 3$d_{x^2-y^2}$\ and the O 2$p$ ZR-like orbitals are localized.
Since a large part of electron correlation is compressed in natural orbitals, we see a tiny $s(1)_i$ for all orbitals except for the localized  3$d_{x^2-y^2}$\ and the O 2$p$ ZR-like orbitals where it is significant. This is consistent with the wavefunction in Table~\ref{wfn}.
The mutual orbital entanglement between pairs of orbitals shows strong entanglement between the  3$d_{x^2-y^2}$\ and the O 2$p$ ZR-like orbitals for both NdNiO$_2$\ and CaCuO$_2$, a consequence of the dominant weight of the configurations spanned by these two orbitals in the wavefunction.
The next strongest entanglement is between the Ni/Cu 3$d$ valence and their double-shell $4d$ orbitals.
Such strong entanglement also observed for the undoped $d^9$ ground state~\cite{katukuri_electronic_2020}, is a result of dynamical radial correlation \cite{helgaker_molecular_2000} and orbital breathing effects~\cite{gunnarsson_density-functional_1989,bogdanov_natphys_2021}.
Interestingly, the entanglement entropy in the range 0.001-0.01 (green lines) is quite similar in the two compounds, although one sees more entanglement connections in NdNiO$_2$.
A comparison of the entropy information between NdNiO$_2$\ and CaCuO$_2$\ reveals that the Ni 3$d$ and 4$d$-like orbitals contribute rather significantly (thicker blue lines) to the total entropy, in contrast to the Cu 3$d$ and 4$d$-like orbitals, something that is also seen in the undoped compounds~\cite{katukuri_electronic_2020}.

\section{Conclusions and discussion}
In conclusion,
our {\it ab initio} many-body quantum chemistry calculations for the electron removal ($d^8$) states find a low-spin closed-shell singlet ground state in NdNiO$_2$\ and  that the additional hole is mainly localized on the Ni 3$d_{x^2-y^2}$\ orbital, unlike in CaCuO$_2$, where a Zhang-Rice singlet is predominant.
We emphasise that the $d^8$ wavefunction is highly multi-configurational where the dominant closed-shell singlet configuration weight is only $\sim$42\%.
This result is consistent with the experimental evidence~\cite{rossi2020orbital,goodge-a} of orbitally polarized singlet state as well as the presence of holes on the O $2p$ orbitals.
Importantly, the persistent dynamic radial-type correlations within the Ni $d$ manifold result in stronger $d^8$ multiplet effects in NdNiO$_2$, and consequently the additional hole foot-print is more three dimensional.
In CaCuO$_2$, we find that the electron correlations within the $d_{xy}$ and $d_{xz/yz}$ orbitals changes the hole-doped wavefunction significantly. Specifically, the double hole occupation of Cu $d_{x^2-y^2}$\ is significantly increased and this can influence the transport properties.

It was recently proposed that nickelates could be a legitimate realization of the single-band Hubbard model~\cite{kitatani_nickelate_2020}.
However, our analysis shows that even the three-band Hubbard model~\cite{eskes1991a}, which successfully describes the hole-doped scenario in cuprates, falls short to describe hole-doped nickelates and additional orbital degrees of freedom are indeed necessary for the description of the strong multiplet effects we find.
Much has been discussed about the importance of  rare-earth atoms for the electronic structure of superconducting nickelates, e.g. see~\cite{nomura2021superconductivity}.
The three-dimensional nature of the hole density we find in NdNiO$_2$\ might also be hinting at the importance of out-of-plane Nd ions.
It would be interesting to compare the hole density of NdNiO$_2$\ with other iso-structural nickelates such as LaNiO$_2$\ where La $5d$ states are far from the Fermi energy.
Since the infinite-layered monovalent nickelates are thin films and often grown on substrates, one could ask the question of how the electronic structure of the undoped and doped compounds changes with varying Ni-O bond length. Would this influence the role of electronic correlations in $d^9$ nickelates? We will address these in the near future.

\section*{Conflict of Interest Statement}
The authors express no conflict of interests.

\section*{Author Contributions}
VMK and AA designed the project. VMK and NAB performed the calculations. All the authors analysed the data. VMK wrote the paper with inputs from NAB and AA.

\section*{Funding}
We gratefully acknowledge the Max Plank Society for financial support.

\section*{Acknowledgments}
VMK would like to acknowledge Giovanni Li Manni and Oskar Weser for fruitful discussions.