bisec_optim() found parameters which minimize target function in a given space

bisec_optim(fun, space, partition, times, trim, enlarge)

Arguments

fun

function. the function to be optimized, i.e. find minimal value. fun(c(para1, para2, ..., paran)) should return a numeric scalar where para is a numeric vector, such as

space

numeric matrix. \(n*2\) matrix, where \(n\) is the number of parameters to fit. space[i, ] should give a the range of ith parameter, i.e. c(para1.min, para2.max). space specifies a n-dimension space, this space is uniformly partitioned into subspaces, and those subspaces which have the highest score is reserved for further partitioning. Finally we get the best space, and the centre point of this space contains the parameters we want.

partition

integer scalar. how partitions are the original range divided per parameter.

times

integer scalar. how many times should the initial range be partitioned.

trim

numeric scalar. must be positive, determine what proportion of total subranges will be reserved for the next round of partition. Let n be the number of subspaces per space, if trim >= 1, as.integer(trim); otherwise, ceiling(n^trim).

enlarge

integer scalar. how many times is the selected subrange enlarged before the next round of partition.

Value

list.

  1. value, numeric saclar. smallest function value found

  2. para, numeric vector. best parameters.

  3. space, numeric matrix. best solution space.

Details

see paras.

to do

1. partition can be a integer vector, i.e. different parameter can be partitioned for different times

See also

biosec_optim_impl

Examples

bisec_optim(sum, matrix(c(0,1,0,1,0,1), 3, byrow = T), 3, 10, 4, 1)
#> $value #> [1] 2.540263e-05 #> #> $para #> [1] 8.467544e-06 8.467544e-06 8.467544e-06 #> #> $space #> [,1] [,2] #> [1,] 0 1.693509e-05 #> [2,] 0 1.693509e-05 #> [3,] 0 1.693509e-05 #>
bisec_optim(sum, matrix(c(0,1,0,1,0,1), 3, byrow = T), 3, 10, 1/3, 1)
#> $value #> [1] 2.540263e-05 #> #> $para #> [1] 8.467544e-06 8.467544e-06 8.467544e-06 #> #> $space #> [,1] [,2] #> [1,] 0 1.693509e-05 #> [2,] 0 1.693509e-05 #> [3,] 0 1.693509e-05 #>