Skip to content

Commit 3d22562

Browse files
committed
fiw signing mixtures
1 parent 6abe815 commit 3d22562

File tree

5 files changed

+15
-45
lines changed

5 files changed

+15
-45
lines changed

radius_clustering/radius_clustering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def fit(self, X, y=None):
102102
self.effective_radius = 0
103103
self._mds_exec_time = 0
104104
return self
105-
self.edges = np.argwhere(adj_mask).astype(np.int32) #TODO: changer en uint32
105+
self.edges = np.argwhere(adj_mask).astype(np.uint32) #TODO: changer en uint32
106106
self.dist_mat = dist_mat
107107

108108
self._clustering()

radius_clustering/utils/emos.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cdef extern from "mds3-util.h":
1717
int set_size
1818
double exec_time
1919

20-
Result* emos_main(int* edges, int nb_edge, int n)
20+
Result* emos_main(unsigned int* edges, int nb_edge, int n)
2121

2222
void cleanup()
2323

@@ -26,7 +26,7 @@ cdef extern from "mds3-util.h":
2626
import numpy as np
2727
cimport numpy as np
2828

29-
def py_emos_main(np.ndarray[int, ndim=1] edges, int n, int nb_edge):
29+
def py_emos_main(np.ndarray[unsigned int, ndim=1] edges, int n, int nb_edge):
3030
cdef Result* result = emos_main(&edges[0], n, nb_edge)
3131

3232
dominating_set = [result.dominating_set[i] - 1 for i in range(result.set_size)]

radius_clustering/utils/main-emos.c

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ void solve_subproblems(){
13851385
static void print_final_solution(char *inst){
13861386
printf("--------------------------------\n");
13871387
printf("Solution: ");
1388-
for(int i=0;i<USED(VEC_SOLUTION);i++){
1388+
for(size_t i=0;i<USED(VEC_SOLUTION);i++){
13891389
printf("%d ",ITEM(VEC_SOLUTION,i));
13901390
}
13911391
printf("\n");
@@ -1488,7 +1488,7 @@ void check_consistance(){
14881488
assert(!domed(CFG[i]));
14891489
}
14901490
int level=-1;
1491-
for(int idx=0;idx<USED(BRA_STK);idx++){
1491+
for(size_t idx=0;idx<USED(BRA_STK);idx++){
14921492
if(ITEM(BRA_STK,idx)==NONE){
14931493
level++;
14941494
}else if(idx<=BRAIDX[level])
@@ -1596,6 +1596,12 @@ void cleanup(){
15961596
}
15971597
}
15981598

1599+
1600+
void handler(int sig) {
1601+
cleanup();
1602+
exit(sig);
1603+
}
1604+
15991605
#ifdef _WIN32
16001606
static BOOL WINAPI win32_handler(DWORD signal) {
16011607
if (signal == CTRL_C_EVENT) {
@@ -1614,12 +1620,8 @@ static void setup_signal_handler(void (*handler_fn)(int)) {
16141620
}
16151621
#endif
16161622

1617-
void handler(int sig) {
1618-
cleanup();
1619-
exit(sig);
1620-
}
16211623

1622-
struct Result* emos_main(int* edges, int n, int nb_edge) {
1624+
struct Result* emos_main(unsigned int* edges, int n, int nb_edge) {
16231625

16241626
// Set the signal handler
16251627
setup_signal_handler(handler);
@@ -1644,7 +1646,7 @@ struct Result* emos_main(int* edges, int n, int nb_edge) {
16441646

16451647
// Get the results
16461648
int* dominating_set = (int*)malloc(USED(VEC_SOLUTION) * sizeof(int));
1647-
for (int i= 0; i<USED(VEC_SOLUTION); i++) {
1649+
for (size_t i= 0; i<USED(VEC_SOLUTION); i++) {
16481650
dominating_set[i] = ITEM(VEC_SOLUTION, i);
16491651
}
16501652

@@ -1675,22 +1677,4 @@ void free_results(struct Result* result) {
16751677
free(result);
16761678
}
16771679
}
1678-
1679-
/** int main(int argc, char *argv[]) {
1680-
1681-
print_compile_options();
1682-
parse_parmerters(argc,argv);
1683-
if(read_instance(argv[1])) {
1684-
initialize();
1685-
#ifndef NOR
1686-
reduce_graph();
1687-
#endif
1688-
partition_oneproblem();
1689-
solve_subproblems();
1690-
check_final_solution();
1691-
print_final_solution(getInstanceName(argv[1]));
1692-
printf("### %s pruning rate %0.2lf total %llu pruned %llu\n",getInstanceName(argv[1]), (total_branches-pruned_branches)/((double)total_branches),total_branches,total_branches-pruned_branches);
1693-
}
1694-
return 0;
1695-
} */
16961680

radius_clustering/utils/mds3-util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static int _read_graph_from_adjacency_matrix(int** adj_matrix, int num_nodes) {
342342
return TRUE;
343343
}
344344

345-
static int _read_graph_from_edge_list(int* edges, int n, int nb_edges) {
345+
static int _read_graph_from_edge_list(unsigned int* edges, int n, int nb_edges) {
346346
int i, j, l_node, r_node, nb_edge = 0, max_node = n, offset = 0;
347347
int node = 1;
348348

@@ -765,7 +765,7 @@ extern int select_branching_node();
765765
extern void search_domset();
766766
extern int fast_search_initial_solution();
767767
extern void solve_subproblems();
768-
extern struct Result* emos_main(int* edges, int n, int nb_edge);
768+
extern struct Result* emos_main(unsigned int* edges, int n, int nb_edge);
769769
extern int* get_dominating_set(struct Result* result);
770770
extern int get_set_size(struct Result* result);
771771
extern double get_exec_time(struct Result* result);

radius_clustering/utils/mds_core.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
*/
99
#include <vector>
1010
#include <unordered_set>
11-
#include <set> // Add this line
1211
#include <algorithm>
1312
#include <random>
1413
#include <chrono>
1514
#include <cmath>
16-
#include <iostream>
1715
#include <csignal>
1816
#include <limits>
1917
#include "random_manager.h"
@@ -92,20 +90,8 @@ class Instance {
9290
std::unordered_set<int> supportNodes;
9391
std::unordered_set<int> leavesNodes;
9492
std::unordered_set<int> unSelectedNodes;
95-
int optimum;
9693
const bool supportAndLeafNodes = true;
9794

98-
/*
99-
void constructAdjacencyList(const std::vector<std::vector<int>>& adjacency_matrix) {
100-
for (int i = 0; i < numNodes; ++i) {
101-
for (int j = 0; j < numNodes; ++j) {
102-
if (adjacency_matrix[i][j] == 1) {
103-
adjacencyList[i].push_back(j);
104-
}
105-
}
106-
}
107-
}*/
108-
10995
void constructAdjacencyList(const std::vector<int>& edge_list, int nb_edges) {
11096
for (int i = 0; i < 2 * nb_edges; i+=2) {
11197
int u = edge_list[i];

0 commit comments

Comments
 (0)