def optimise_partition_multiplex(self, partitions, layer_weights=None):
if not layer_weights:<EOL><INDENT>layer_weights = [<NUM_LIT:1>]*len(partitions)<EOL><DEDENT>diff = _c_louvain._Optimiser_optimise_partition_multiplex(<EOL>self._optimiser,<EOL>[partition._partition for partition in partitions],<EOL>layer_weights)<EOL>for partition in partitions:<EOL><INDENT>partition._update_internal_membership()<EOL><DEDENT>return diff<EOL>
Optimise the given partitions simultaneously.

        Parameters
        ----------
        partitions
          List of :class:`~VertexPartition.MutableVertexPartition` layers to optimise.

        layer_weights
          List of weights of layers.

        Returns
        -------
        float
          Improvement in quality of combined partitions, see `Notes <#notes-multiplex>`_.


        .. _notes-multiplex:

        Notes
        -----

        This method assumes that the partitions are defined for graphs with the
        same vertices. The connections between the vertices may be different, but
        the vertices themselves should be identical. In other words, all vertices
        should have identical indices in all graphs (i.e. node `i` is assumed to be
        the same node in all graphs). The quality of the overall partition is
        simply the sum of the individual qualities for the various partitions,
        weighted by the layer_weight. If we denote by :math:`Q_k` the quality of
        layer :math:`k` and the weight by :math:`\\lambda_k`, the overall quality
        is then

        .. math:: Q = \sum_k \\lambda_k Q_k.

        This is particularly useful for graphs containing negative links. When
        separating the graph in two graphs, the one containing only the positive
        links, and the other only the negative link, by supplying a negative weight
        to the latter layer, we try to find relatively many positive links within a
        community and relatively many negative links between communities. Note that
        in this case it may be better to assign a node to a community to which it
        is not connected so that :attr:`consider_comms` may be better set to
        :attr:`louvain.ALL_COMMS`.

        Besides multiplex graphs where each node is assumed to have a single
        community, it is also useful in the case of for example multiple time
        slices, or in situations where nodes can have different communities in
        different slices. The package includes some special helper functions for
        using :func:`optimise_partition_multiplex` in such cases, where there is a
        conversion required from (time) slices to layers suitable for use in this
        function.

        See Also
        --------
        :func:`slices_to_layers`

        :func:`time_slices_to_layers`

        :func:`find_partition_multiplex`

        :func:`find_partition_temporal`

        Examples
        --------
        >>> G_pos = ig.Graph.SBM(100, pref_matrix=[[0.5, 0.1], [0.1, 0.5]], block_sizes=[50, 50])
        >>> G_neg = ig.Graph.SBM(100, pref_matrix=[[0.1, 0.5], [0.5, 0.1]], block_sizes=[50, 50])
        >>> optimiser = louvain.Optimiser()
        >>> partition_pos = louvain.ModularityVertexPartition(G_pos)
        >>> partition_neg = louvain.ModularityVertexPartition(G_neg)
        >>> diff = optimiser.optimise_partition_multiplex(
        ...                     partitions=[partition_pos, partition_neg],
        ...                     layer_weights=[1,-1])