print.copValidation: Print Validation of a Solution

Description Usage Arguments Details Value See Also Examples

Description

Print the validation results for the solution of an optimization problem.

Usage

1
2
## S3 method for class 'copValidation'
print(x, ...)

Arguments

x

The result of function validate.

...

Unused additional arguments.

Details

Print the validation results for the solution of an optimization problem.

Value

A list of class copValidation (invisible) with components:

summary

Data frame containing one row for each constraint with the value of the constraint in column Val, the bound for the constraint in column Bound, and column OK states if the constraint is fulfilled. The value of the objective function is shown in the first row. Additional rows contain the values of disabled constraints.

info

Data frame with component valid indicating if all constraints are fulfilled, component solver containing the name of the solver used for optimization, and component status describing the solution as reported by the solver.

var

Data frame with the values of the objective function and constraints at the optimum.

obj.fun

Named numeric value with value and name of the objective function at the optimum.

See Also

The main function for solving constrained programming problems is solvecop.

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
### Quadratic programming with linear constraints      ###
### Example from animal breeding                       ###
### where the mean kinship in the offspring is minized ###

data(phenotype)
data(myQ)

A   <- t(model.matrix(~Sex+BV-1, data=phenotype))
rownames(A) <- c("male.cont","female.cont", "Breeding.Value")
val <- c(0.5, 0.5, 0.40)
dir <- c("==","==",">=")

mycop <- cop(f  = quadfun(Q=myQ, d=0.001, name="Kinship", id=rownames(myQ)), 
             lb = lbcon(0,  id=phenotype$Indiv), 
             ub = ubcon(NA, id=phenotype$Indiv),
             lc = lincon(A=A, dir=dir, val=val, id=phenotype$Indiv))

res <- solvecop(mycop, solver="cccp", quiet=FALSE, trace=FALSE)

head(res$x)

Evaluation <- validate(mycop, res, quiet=TRUE)

print(Evaluation)

#            valid solver  status
#             TRUE   cccp optimal
#
#   Variable       Value      Bound    OK?
#   ---------------------------------------
#   Kinship        0.0322 min        :      
#   ---------------------------------------
#   lower bounds   all x  >=  lb     : TRUE 
#   male.cont      0.5    ==  0.5    : TRUE 
#   female.cont    0.5    ==  0.5    : TRUE 
#   Breeding.Value 0.4    >=  0.4    : TRUE 
#   ---------------------------------------

optiSolve documentation built on Oct. 13, 2021, 5:08 p.m.