A Python package for solving Generalized Nash Equilibrium Problems by active learning of best-response models.
gnep-learn is a Python package for solving Generalized Nash Equilibrium Problems with
The package implements the approach described in the following paper:
[1] F. Fabiani, A. Bemporad, "An active learning method for solving competitive multi-agent decision-making and control problems," submitted for publication. Available on arXiv at http://arxiv.org/abs/2212.12561, 2024. [bib entry]
pip install gnep-learn
Consider a set of agents
The central entity proposes iteratively a tentative decision vector N_init
iterations, the vectors
Let us set up a simple problem with two agents, each one optimizing a single variable within the range
from gnep_learn import GNEP
n = 2 # number of agents
dim = [1, 1] # each agent optimizes one variable
N_init = 10 # number of initial random sampling iterations
N = 20 # total number of iterations
def J1(x1,x2):
return x1**2 -x1*x2 - x1 # function minimized by agent #1
def J2(x2,x1):
return x2**2 +x1*x2 -x2 # function minimized by agent #2
J = [lambda x1, x2: J1(x1,x2)[0],
lambda x2, x1: J2(x2,x1)[0]] # collection of agents' objectives
lbx = -10. * np.ones(2) # lower bound on x used during optimization
ubx = 10. * np.ones(2) # upper bound on x used during optimization
gnep = GNEP(J, dim, lbx=lbx, ubx=ubx) # Create GNEP object
xeq, XX, XXeq, _ = gnep.learn(N=N, N_init=N_init) # Learn equilibrium
The returned vector xeq
is a stationary profile. The learning function learn
also returns the sequence XX
of tentative equilibria suggested by the central entity and XXeq
the corresponding best responses.
xeq, XX, XXeq, TH = gnep.learn(N=N, N_init=N_init, save_model_params = True)
also returns the sequence TH
of parameters of the affine best response models learned, where TH[k][j][i]
contains the parameter vector
More generally, each agent can minimize an objective function
See the example files in the examples
folder for how to set up and solve different generalized Nash equilibrium problems.
This package was coded by Alberto Bemporad.
This software is distributed without any warranty. Please cite the paper below if you use this software.
@article{FB24,
author = {F. Fabiani and A. Bemporad},
title={An active learning method for solving competitive multi-agent decision-making and control problems},
note = {submitted for publication. Also available on arXiv
at \url{http://arxiv.org/abs/2212.12561}},
year=2024
}
Apache 2.0
(C) 2024 A. Bemporad