rpsg_getsolution: Convert character PSG solution report into list witn numeric...

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/rpsg_getsolution.R

Description

Standard output of rpsg_solver contains information in character string problem.res$output. rpsg_getsolution function exctracts the main information from character string and creates list with numeric data.

Usage

1
rpsg_getsolution(problem.res)

Arguments

problem.res

list with solution results of the optimization problem obtained by rpsg_solver

problem.res$problem_name

name (problem_<name>) of the optimization problem. By default: problem_1;

problem.res$solution_status

status of the solution of the optimization problem: optimal | feasible | infeasible | unbounded | calculated (for calculation problems);

problem.res$problem_statement

Problem Statement of the solved problem;

problem.res$output

solution report = character with main information about optimization results;

problem.res$point_constraints_problem_<name>

optimal values of left hand sides of constraints in the optimization problem;

problem.res$point_slack_constraints_problem_<name>

slacks value for constraints of the optimization problem;

problem.res$point_dual_constraints_problem_<name>

dual constraints values;

problem.res$point_problem_<name>

optimal point for solved optimization problem;

problem.res$log

information about solving process.

Value

output.list = list with solution results. List members:

output.list$status

status of the solution of the optimization problem: optimal | feasible | infeasible | unbounded | calculated (for calculation problems);

output.list$loading.time

data loading time;

output.list$preprocessing.time

preprocessing time;

output.list$solving.time

solving time;

output.list$objective

optimal value of objective function;

output.list$gap

difference between objective value in obtained point and Lower estimate of optimal value;

output.list$function.value

optimal values of PSG functions defined in the problem;

output.list$point_constraints_problem_<name>

optimal values of left hand sides of constraints in the optimization problem;

output.list$point_slack_constraints_problem_<name>

slacks value for constraints of the optimization problem;

output.list$point_dual_constraints_problem_<name>

dual constraints values;

output.list$point_problem_<name>

optimal point for solved optimization problem;

Note

Author(s)

Stan Uryasev [aut, cre, cph], Grigoriy Zrazhevsky [aut], Viktor Kuzmenko [aut], Alex Zrazhevsky [aut]

Maintainer: Stan Uryasev <stan.uryasev@aorda.com>

References

American Optimal Decisions
Portfolio Safeguard Help

See Also

rpsg_solver

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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

matrix_scenarios <- matrix(c(1,4,8,3, 7,5,4,6, 2,8,1,0,0,3,4,9),nrow=4, byrow=TRUE)
colnames(matrix_scenarios) <- colnames(matrix_scenarios,do.NULL = FALSE, prefix = "x")
scenario_benchmark <- c(0.2, 0.11, 0.6, 0.1)
matrix_scenarios <- cbind(matrix_scenarios,scenario_benchmark)
matrix_budget <- matrix(c(1, 1, 1, 1),nrow=1)
colnames(matrix_budget) <- colnames(matrix_budget,do.NULL = FALSE, prefix = "x")
point_lowerbounds <- c(0, 0, 0, 0)
names(point_lowerbounds) <- rownames(point_lowerbounds,do.NULL = FALSE, prefix = "x")

problem_list <- list()

#Problem Statement
problem_list$problem_statement <- sprintf(
 "minimize
 cvar_risk(0.95,matrix_scenarios)
Constraint: >= 4.5
 avg_g(matrix_scenarios)
Constraint: == 1
 linear(matrix_budget)
Box: >= point_lowerbounds
Solver: CAR")

# PSG Matrix:
problem_list$matrix_scenarios <- matrix_scenarios

# PSG Matrix:
problem_list$matrix_budget <- matrix_budget

# PSG Point:
problem_list$point_lowerbounds <- point_lowerbounds

# Solve optimization problem
output1 <- rpsg_solver(problem_list)

output2 <- rpsg_getsolution(output1)

print(output2)

PSGExpress documentation built on July 26, 2019, 5:02 p.m.