Finds a minimum for the problem $$min_x [risk1(x) + d\cdot x]$$ subject to $$risk2 \leq r$$ $$A \cdot x= b$$ $$Aeq \cdot x= beq$$ $$lb \leq x \leq ub$$ where A, Aeq are matrices; d, x are vectors; b, beq, lb, ub are vectors or scalars; risk1(x), risk2(x) functions are linear combinations of PSG risk functions, PSG deterministic functions, or PSG utility functions. List of PSG functions for riskprog
rpsg_riskconstrprog(model, stroptions = NULL)
list with data for the optimization problem. Some components are optional. Names of list members:
model$risk1
character with description of the PSG function (objective includes only one PSG function) or character vector with coefficients and PSG functions in one of the following forms: coefficient 1, function 1, ... , coefficient K, function K; "na" denotes the absent parameter. List of PSG functions for riskconstrprog
model$risk2
character with description of the PSG function (constraint includes only one PSG function) or character vector with coefficients and PSG functions in one of the following forms: coefficient 1, function 1, ... , coefficient K, function K; "na" denotes the absent parameter. List of PSG functions for riskconstrprog
model$w1
parameter (numeric) of the PSG function (for one PSG function in objective) or vector of parameters (for linear combination of PSG functions; order of parameters are the same as the order of functions in model$risk1, "na" denotes the absent parameter);
model$w2
parameter (numeric) of the PSG function (for one PSG function in constraint) or vector of parameters (for linear combination of PSG functions; order of parameters are the same as the order of functions in model$risk2, "na" denotes the absent parameter);
model$H1
matrix for one PSG function in objective or vector of matrices for linear combination of PSG functions model$risk1 (order of matrix are the same as the order of functions in model$risk1);
model$H2
matrix for one PSG function in constraint or vector of matrices for linear combination of PSG functions model$risk2 (order of matrix are the same as the order of functions in model$risk2);
model$c1
vector of benchmark for one PSG function in objective or vector of vectors of benchmarks for linear combination of PSG functions (order of vectors are the same as the order of functions in model$risk1);
model$c2
vector of benchmark for one PSG function in constraint or vector of vectors of benchmarks for linear combination of PSG functions (order of vectors are the same as the order of functions in model$risk2);
model$p1
vector of probabilities for one PSG function in objective or vector of vectors of probabilities for linear combination of PSG functions (order of vectors are the same as the order of functions in model$risk1);
model$p2
vector of probabilities for one PSG function in constraint or vector of vectors of probabilities for linear combination of PSG functions (order of vectors are the same as the order of functions in model$risk2);
model$d
vector for linear component of objective;
model$rineq
value of upper bound for risk constraint;
model$Aineq
matrix for linear inequality constraint;
model$bineq
vector or scalars for linear inequality constraint;
model$Aeq
matrix for linear equality constraint;
model$beq
vector for linear equality constraint;
model$lb
vector of lower bounds for x;
model$ub
vector of upper bounds for x;
model$x0
initial point for x.
list with additional optimization options:
stroptions$solver
character with name of optimization solver: VAN (default), CAR, BULDOZER, TANK;
stroptions$precision
number of digits that solver tries to obtain in objective and constraints (default = 7);
stroptions$time.limit
time in seconds restricting the duration of the optimization process;
stroptions$linearization1
number 0 or 1, controls internal representation of risk function in objective (model$risk1), which can speed up the optimization process (used with CAR and TANK solvers);
stroptions$linearization2
number 0 or 1, controls internal representation of risk function in constraint (model$risk2), which can speed up the optimization process (used with CAR and TANK solvers);
stroptions$stages
number of stages of the optimization process. This parameter should be specified for VaR, Probability, and Cardinality groups of functions, default = 9;
stroptions$types
number that specifies the variable types of a problem. If Types is defined as column-vector, it should include as many components as number of variables Problem includes. The components of column-vector can possess the values 0 - for variables of type real, or 1- for variables of type boolean, or 2 - for variables of type integer. If Types is defined as one number (0, or 1, or 2) than all variable types are real, or boolean, or integer respectively;
stroptions$mip1
number that specifies the linearization of functions in objective (model$risk1) using MIP capabilities of Gurobi. Active only in VANGRB, CARGRB or HELI solvers (which are based on Gurobi optimization solvers and are available only if Gurobi is installed).
stroptions$mip2
number that specifies the linearization of functions in constraint (model$risk2) using MIP capabilities of Gurobi. Active only in VANGRB, CARGRB or HELI solvers (which are based on Gurobi optimization solvers and are available only if Gurobi is installed).
stroptions$save.to.text
character with path to the folder for storing problem in General (Text) Format of PSG.
list results
with solution results:
results$status
status of solved problem;
results$objective
optimal value of objective function;
results$gap
difference between objective value in obtained point and Lower estimate of optimal value;
results$optimal.point
optimal point;
results$risk.constraint.value
optimal values of left hand sides of risk constraint;
results$risk.constraint.residual
residual of risk constraint;
results$ineq.constraint.value
optimal values of left hand sides of linear inequality constraint;
results$ineq.constraint.residual
residual of linear inequality constraint;
results$eq.constraint.value
optimal values of left hand sides of linear equality constraint;
results$eq.constraint.residual
residual of linear equality constraint;
results$function.value
optimal values of PSG functions defined in problem;
results$loading.time
data loading time;
results$preprocessing.time
preprocessing time;
results$solving.time
solving time.
# NOT RUN {
#Problem of CVaR minimization with constraint on the mean profit:
#Find x = (x1,x2,x3,x4) minimizing
#risk(x) = CVaR(0.95,x)
#subject to
#Average Gain(x)>4.5
#x1+x2+x3+x4 = 1
#x1>=0, x2>=0, x3>=0, x4>=0
input.model <- list()
input.model$risk1 <- "cvar_risk"
input.model$w1 <- 0.95
input.model$H1<-matrix(c(1,4,8,3, 7,5,4,6, 2,8,1,0,0,3,4,9),nrow=4, byrow=TRUE)
input.model$c1 <- c(0.2, 0.11, 0.6, 0.1)
input.model$risk2 <- "avg"
input.model$H2<-matrix(c(1,4,8,3, 7,5,4,6, 2,8,1,0,0,3,4,9),nrow=4, byrow=TRUE)
input.model$c2 <- c(0.2, 0.11, 0.6, 0.1)
input.model$rineq <- -4.5
input.model$Aeq <- matrix(c(1, 1, 1, 1),nrow=1)
input.model$beq <- 1
input.model$lb<-c(0, 0, 0, 0)
options<-list()
options$solver <- "van"
options$precision <- 7
options$stages <- 30
results <- rpsg_riskconstrprog(input.model,options)
print(results)
# }
Run the code above in your browser using DataLab