Learn R Programming

GNE (version 0.99-6)

CER: Constrained Equation Reformulation

Description

functions of the Constrained Equation Reformulation of the GNEP

Usage

funCER(z, dimx, dimlam, 
	grobj, arggrobj, 
	constr, argconstr,  
	grconstr, arggrconstr, 
	dimmu, joint, argjoint,
	grjoint, arggrjoint,
	echo=FALSE)

jacCER(z, dimx, dimlam, heobj, argheobj, constr, argconstr, grconstr, arggrconstr, heconstr, argheconstr, dimmu, joint, argjoint, grjoint, arggrjoint, hejoint, arghejoint, echo=FALSE)

Value

A vector for funCER or a matrix for jacCER.

Arguments

z

a numeric vector z containing x then lambda values.

dimx

dimension of x.

dimlam

dimension of lambda.

grobj

gradient of the objective function, see details.

arggrobj

a list of additional arguments of the objective gradient.

constr

constraint function, see details.

argconstr

a list of additional arguments of the constraint function.

grconstr

gradient of the constraint function, see details.

arggrconstr

a list of additional arguments of the constraint gradient.

dimmu

a vector of dimension for \(mu\).

joint

joint function, see details.

argjoint

a list of additional arguments of the joint function.

grjoint

gradient of the joint function, see details.

arggrjoint

a list of additional arguments of the joint gradient.

heobj

Hessian of the objective function, see details.

argheobj

a list of additional arguments of the objective Hessian.

heconstr

Hessian of the constraint function, see details.

argheconstr

a list of additional arguments of the constraint Hessian.

hejoint

Hessian of the joint function, see details.

arghejoint

a list of additional arguments of the joint Hessian.

echo

a logical to show some traces.

Author

Christophe Dutang

Details

Compute the H function or the Jacobian of the H function defined in Dreves et al.(2009).

Arguments of the H function

The arguments which are functions must respect the following features

grobj

The gradient \(Grad Obj\) of an objective function \(Obj\) (to be minimized) must have 3 arguments for \(Grad Obj(z, playnum, ideriv)\): vector z, player number, derivative index , and optionnally additional arguments in arggrobj.

constr

The constraint function \(g\) must have 2 arguments: vector z, player number, such that \(g(z, playnum) <= 0\). Optionnally, \(g\) may have additional arguments in argconstr.

grconstr

The gradient of the constraint function \(g\) must have 3 arguments: vector z, player number, derivative index, and optionnally additional arguments in arggrconstr.

Arguments of the Jacobian of H

The arguments which are functions must respect the following features

heobj

It must have 4 arguments: vector z, player number, two derivative indexes.

heconstr

It must have 4 arguments: vector z, player number, two derivative indexes.

Optionnally, heobj and heconstr can have additional arguments argheobj and argheconstr.

See the example below.

References

Dreves, A., Facchinei, F., Kanzow, C. and Sagratella, S. (2011), On the solutions of the KKT conditions of generalized Nash equilibrium problems, SIAM Journal on Optimization.

F. Facchinei, A. Fischer and V. Piccialli (2009), Generalized Nash equilibrium problems and Newton methods, Math. Program.

See Also

See also GNE.ceq.

Examples

Run this code



#-------------------------------------------------------------------------------
# (1) Example 5 of von Facchinei et al. (2007)
#-------------------------------------------------------------------------------

dimx <- c(1, 1)
#Gr_x_j O_i(x)
grobj <- function(x, i, j)
{
	if(i == 1)
		res <- c(2*(x[1]-1), 0)
	if(i == 2)
		res <- c(0, 2*(x[2]-1/2))
	res[j]	
}
#Gr_x_k Gr_x_j O_i(x)
heobj <- function(x, i, j, k)
	2 * (i == j && j == k)

dimlam <- c(1, 1)
#constraint function g_i(x)
g <- function(x, i)
	sum(x[1:2]) - 1
#Gr_x_j g_i(x)
grg <- function(x, i, j)
	1
#Gr_x_k Gr_x_j g_i(x)
heg <- function(x, i, j, k)
	0


x0 <- rep(0, sum(dimx))
z0 <- c(x0, 2, 2, max(10, 5-g(x0, 1) ), max(10, 5-g(x0, 2) ) )

#true value is (3/4, 1/4, 1/2, 1/2)
funCER(z0, dimx, dimlam, grobj=grobj, 
	constr=g, grconstr=grg)

jacCER(z0, dimx, dimlam, heobj=heobj, 
	constr=g, grconstr=grg, heconstr=heg)



#-------------------------------------------------------------------------------
# (2) Duopoly game of Krawczyk and Stanislav Uryasev (2000)
#-------------------------------------------------------------------------------


#constants
myarg <- list(d= 20, lambda= 4, rho= 1)

dimx <- c(1, 1)
#Gr_x_j O_i(x)
grobj <- function(x, i, j, arg)
{
	res <- -arg$rho * x[i]
	if(i == j)
	res <- res + arg$d - arg$lambda - arg$rho*(x[1]+x[2])
	-res
}
#Gr_x_k Gr_x_j O_i(x)
heobj <- function(x, i, j, k, arg)
	arg$rho * (i == j) + arg$rho * (j == k)	


dimlam <- c(1, 1)
#constraint function g_i(x)
g <- function(x, i)
	-x[i]
#Gr_x_j g_i(x)
grg <- function(x, i, j)
	-1*(i == j)
#Gr_x_k Gr_x_j g_i(x)
heg <- function(x, i, j, k)
	0

#true value is (16/3, 16/3, 0, 0) 

x0 <- rep(0, sum(dimx))
z0 <- c(x0, 2, 2, max(10, 5-g(x0, 1) ), max(10, 5-g(x0, 2) ) )


funCER(z0, dimx, dimlam, grobj=grobj, arggrobj=myarg, 
	constr=g, grconstr=grg)

jacCER(z0, dimx, dimlam, heobj=heobj, 
	argheobj=myarg, constr=g, grconstr=grg, heconstr=heg)





Run the code above in your browser using DataLab