|
46 | 46 | # //verbose file may be a file or just a screen:cout
|
47 | 47 | # verbose_file=cout s
|
48 | 48 |
|
| 49 | +test_algo_pars<-list( |
| 50 | + # Already provided as A and B matrices |
| 51 | + # *******************ALGORITHMS******************************** |
| 52 | + # used algorithms and what should be used as |
| 53 | + #initial solution in corresponding algorithms |
| 54 | + algo="I QCV PATH", |
| 55 | + algo_init_sol="unif unif unif", |
| 56 | + solution_file="solution_im.txt", |
| 57 | + # coeficient of linear combination between |
| 58 | + # (1-alpha_ldh)*||graph_1-P*graph_2*P^T||^2_F +alpha_ldh*C_matrix |
| 59 | + alpha_ldh=0 , |
| 60 | + cdesc_matrix="A" , |
| 61 | + cscore_matrix="A" , |
| 62 | + C_matrix = "none", |
| 63 | + # **************PARAMETERS SECTION***************************** |
| 64 | + hungarian_max=10000 , |
| 65 | + algo_fw_xeps=0.01 , |
| 66 | + algo_fw_feps=0.01 , |
| 67 | + # 0 - just add a set of isolated nodes to the smallest graph |
| 68 | + # 1 - double size |
| 69 | + dummy_nodes=as.integer(0), |
| 70 | + # fill for dummy nodes (0.5 - these nodes will be connected with all other |
| 71 | + # by edges of weight 0.5(min_weight+max_weight)) |
| 72 | + dummy_nodes_fill=as.integer(0), |
| 73 | + # fill for linear matrix C, usually that's the minimum (dummy_nodes_c_coef=0), |
| 74 | + # but may be the maximum (dummy_nodes_c_coef=1) |
| 75 | + dummy_nodes_c_coef=0.01, |
| 76 | + |
| 77 | + qcvqcc_lambda_M=10, |
| 78 | + qcvqcc_lambda_min=1E-5, |
| 79 | + |
| 80 | + |
| 81 | + # 0 - all matching are possible, 1-only matching with positive local similarity are possible |
| 82 | + blast_match=as.integer(1) , |
| 83 | + blast_match_proj=as.integer(0) , |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + #****************OUTPUT*************************************** |
| 88 | + #output file and its format |
| 89 | + exp_out_file="exp_out_file" , |
| 90 | + exp_out_format="Parameters Compact Permutation", |
| 91 | + #other |
| 92 | + debugprint=as.integer(1) , |
| 93 | + debugprint_file="debug.txt", |
| 94 | + verbose_mode=as.integer(1) , |
| 95 | + # verbose file may be a file or just a screen:cout |
| 96 | + verbose_file="verbose_debug.txt", |
| 97 | + graph_dot_print = as.integer(1) |
| 98 | +) |
| 99 | + |
49 | 100 |
|
50 | 101 | test_graph_match <- function(A,B,algorithm_params) {
|
51 | 102 | writeMat(A,"./src/graphm/Rpkgtest/testA")
|
52 | 103 | writeMat(B,"./src/graphm/Rpkgtest/testB")
|
53 | 104 | write_config("./src/graphm/Rpkgtest/config.txt",A,B,algorithm_params)
|
54 |
| - system("./src/graphm/bin/graphm config.txt") |
| 105 | + system("./src/graphm/bin/graphm.exe ./src/graphm/Rpkgtest/config.txt",show.output.on.console = T) |
55 | 106 | }
|
56 | 107 |
|
57 | 108 | writeMat <- function (A,filepath) {
|
58 | 109 |
|
59 |
| - writeLines(A,filepath) |
| 110 | + write.table(A,file = filepath,row.names= F, col.names=F) |
60 | 111 | }
|
61 | 112 | write_config <- function (filepath,A,B,algo_params){
|
62 |
| - writeLines("graph_1=./src/graphm/Rpkgtest/testA",filepath) |
63 |
| - writeLines("graph_2=./src/graphm/Rpkgtest/testB",filepath) |
64 |
| - for ( par in algo_params) { |
65 |
| - writeLines(names(par),'=', par ," " ,"s" ,filepath) |
| 113 | + new_f = file(filepath,open = 'wt') |
| 114 | + #open(new_f) |
| 115 | + writeLines(text= "graph_1=./src/graphm/Rpkgtest/testA s",new_f) |
| 116 | + writeLines(text= "graph_2=./src/graphm/Rpkgtest/testB s",new_f) |
| 117 | + close(new_f) |
| 118 | + for ( par_name in names(algo_params)) { |
| 119 | + par = algo_params[[par_name]] |
| 120 | + print (par) |
| 121 | + if (is.numeric(par)) { |
| 122 | + if (is.double(par)) { |
| 123 | + type = 'd' |
| 124 | + } |
| 125 | + else if (is.integer(par)) { |
| 126 | + type = 'i' |
| 127 | + } |
| 128 | + } else if (is.character(par)){ |
| 129 | + if (nchar(par)==0) { |
| 130 | + print ("invalid parameter value for " + names(par)) |
| 131 | + } |
| 132 | + if (nchar(par)==1) { |
| 133 | + type = 'c' |
| 134 | + } else { |
| 135 | + type = 's' |
| 136 | + } |
| 137 | + |
| 138 | + } |
| 139 | + write(paste0(par_name,'=', par ," " ,type ,collapse = ""),file = filepath, append = TRUE) |
66 | 140 |
|
67 | 141 | }
|
68 | 142 |
|
|
0 commit comments