Description Usage Arguments Value Examples
View source: R/OptimizationFunctions.R
Finds a feasible solution (provided it exists) to programs such as (24). It uses the generalized linear programming approach described in Algorithm 2. We slightly generalize this algorithm so that inequalities in (24) can be replaced by lower inequalities or equalities if desired.
1 2 |
constFun |
List containing the functions G_j |
constRHS |
Vector containing the bounds gamma_j |
constDir |
Vector containing the direction of the constraints (e.g. '=', '<=', ">=" ) |
constLambda |
Vector containing the the values of the parameters λ_{j,M} (use default vector of 0's to solve classic generalized linear programs) |
x |
Non-negative scalar representing the first point support to enter the procedure (default 0) |
C |
Upper bound of the support of feasible distribution functions (default 1e4) |
IterMax |
Maximum number of iterations for the procedure (default = 100) |
A list containing
p |
Vector of point masses |
x |
Vector of point supports |
s |
Scalar |
r |
Optimal value of the variable r when the program is feasible and an optimal solution exists |
feasible |
Boolean indicating wether (p, x, s) is a feasible solution to (24) |
status |
Integer describing the final status of the procedure (0 => Reached a solution, 1 => the algorithm terminated by reaching the maximum number of iterations, 2 => the algorithm entered a cycle) |
nIter |
Number of iterations reached when the procedure terminated |
eps |
Opposite value of the inner optimization program when the procedure terminated |
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 | ####
#### Finding a basic feasible solution (p, x, s) such that
####
#### sum(p) = 1
#### sum(px) = 1
#### sum(px^2) = 2 + s
####
####
# Function for the integrals of the constraints inequality
constFun = rep(list(
function(x) 1,
function(x) x,
function(x) x^2 + s
),2)
# Direction of the inequality constraints
constDir <- rep(c("<=", ">="), each = 3)
# Values on the RHS of each inequality
mu0 <- 1
mu1 <- 1
mu2 <- 2
constRHS <- rep(c(mu0,mu1,mu2), 2)
# Lambdas for the objective function and the constraints functions
constLambda <- rep(c(0,0,1),2)
# Get a basic feasible solution
initBFS <- phase1(constFun, constRHS,constDir, constLambda)
# Check feasibility
with(initBFS, c(sum(p), sum(p*x), sum(p*x^2) + s))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.