Changeset 893


Ignore:
Timestamp:
09/06/19 11:40:57 (5 years ago)
Author:
oriona
Message:

Similarity modified and expanded to include both old (greedy) and new (hungarian) measures.

Location:
cpp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/simil_test.cpp

    r732 r893  
    2828        int nResult = 0; // a temporary result
    2929
    30         if (argc < 7)
     30        if (argc < 8)
    3131        {
    3232                printf("Too few parameters!\n");
    33                 printf("Command line: [-names] <genotypesFile> <w_dP> <w_dDEG> <w_dNEU> <w_dGEO> <fixZaxis?>\n\n");
     33                printf("Command line: [-names] <genotypesFile> <measure> <w_dP> <w_dDEG> <w_dNEU> <w_dGEO> <fixZaxis?>\n\n");
    3434
    3535                printf("Parameters:\n");
    3636                printf("  <genotypesFile> name of a file with genotypes\n");
     37                printf("  <measure> similarity measure\n");
    3738                printf("  <w_dP> weight of the difference in the number of parts\n");
    3839                printf("  <w_dDEG> weight of the difference in degrees of matched parts\n");
     
    7778                M.m_adFactors[i] = -1.0;
    7879        }
     80       
     81        iCurrParam++;
     82        szCurrParam = argv[iCurrParam];
     83        int measure_type = -1;
     84        nResult = sscanf(szCurrParam, " %d ", &measure_type);
     85        if (nResult != 1)
     86        {
     87                printf("Measure type should be a number!\n");
     88                return -1;
     89        }
     90       
     91        if (measure_type != 0 && measure_type != 1)
     92        {
     93                printf("Measure type should be 0 (flexible criteria order and optimal matching) or 1 (vertex degree order and greedy matching)!\n");
     94                return -1;             
     95        }
     96       
     97        M.matching_method = measure_type;
    7998
    8099        const char *params[] = { "<w_dP>", "<w_dDEG>", "<w_dNEU>", "<w_dGEO>" };
  • cpp/tests/similarity-tests.txt

    r811 r893  
    33TESTNAME:parts weight
    44arg:similarity.gen
     5arg:0
    56arg:1
    67arg:0
     
    1314TESTNAME:degrees weight
    1415arg:similarity.gen
     16arg:0
    1517arg:0
    1618arg:1
     
    2527arg:0
    2628arg:0
     29arg:0
    2730arg:1
    2831arg:0
     
    3134RUNTEST
    3235
    33 TESTNAME:distances weight
     36TESTNAME:distances weight greedy
    3437arg:similarity.gen
     38arg:1
    3539arg:0
    3640arg:0
     
    3842arg:1
    3943arg:0
    40 out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/distances_weight
     44out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/distances_weight_greedy
    4145RUNTEST
    4246
    43 TESTNAME:all weights
    44 arg:similarity.gen
    45 arg:1
    46 arg:1
    47 arg:1
    48 arg:1
    49 arg:0
    50 out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights
    51 RUNTEST
    52 
    53 TESTNAME:all weights fixed z
     47TESTNAME:all weights greedy
    5448arg:similarity.gen
    5549arg:1
     
    5852arg:1
    5953arg:1
    60 out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights_fixed_z
     54arg:0
     55out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights_greedy
    6156RUNTEST
    6257
     58TESTNAME:all weights fixed z greedy
     59arg:similarity.gen
     60arg:1
     61arg:1
     62arg:1
     63arg:1
     64arg:1
     65arg:1
     66out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights_fixed_z_greedy
     67RUNTEST
     68
     69TESTNAME:distances weight hungarian
     70arg:similarity.gen
     71arg:0
     72arg:0
     73arg:0
     74arg:0
     75arg:1
     76arg:0
     77out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/distances_weight_hungarian
     78RUNTEST
     79
     80TESTNAME:all weights hungarian
     81arg:similarity.gen
     82arg:0
     83arg:1
     84arg:1
     85arg:1
     86arg:1
     87arg:0
     88out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights_hungarian
     89RUNTEST
     90
     91TESTNAME:all weights fixed z hungarian
     92arg:similarity.gen
     93arg:0
     94arg:1
     95arg:1
     96arg:1
     97arg:1
     98arg:1
     99out:*INSERTPLATFORMDEPENDENTFILE*:similarity_goals/all_weights_fixed_z_hungarian
     100RUNTEST
     101
Note: See TracChangeset for help on using the changeset viewer.