コード例 #1
0
ファイル: hsyncnet.cpp プロジェクト: RuhiSharma/pyclustering
void hsyncnet::process(const double order, const solve_type solver, const bool collect_dynamic, hsyncnet_analyser & analyser) {
	unsigned int number_neighbors = 0;
	unsigned int current_number_clusters = std::numeric_limits<unsigned int>::max();

	double radius = 0.0;
	double current_time = 0.0;

	while(current_number_clusters > number_clusters) {
		create_connections(radius, false);

		sync_dynamic current_dynamic;
		simulate_dynamic(order, 0.1, solver, collect_dynamic, current_dynamic);

		sync_dynamic::const_iterator last_state_dynamic = current_dynamic.cend() - 1;
		analyser.push_back(*(last_state_dynamic));

		hsyncnet_cluster_data clusters;
		analyser.allocate_sync_ensembles(0.05, clusters);

		current_number_clusters = clusters.size();

		number_neighbors++;

		if (number_neighbors >= oscillator_locations->size()) {
			radius = radius * 0.1 + radius;
		}
		else {
			radius = average_neighbor_distance(oscillator_locations, number_neighbors);
		}
	}
}
コード例 #2
0
ファイル: hsyncnet.cpp プロジェクト: annoviko/pyclustering
void hsyncnet::process(const double order, const solve_type solver, const bool collect_dynamic, hsyncnet_analyser & analyser) {
    std::size_t number_neighbors = m_initial_neighbors;
    std::size_t current_number_clusters = m_oscillators.size();

    if (current_number_clusters <= m_number_clusters) {
        return;   /* Nothing to process, amount of objects is less than required amount of clusters. */
    }

    double radius = average_neighbor_distance(oscillator_locations, number_neighbors);
    
    std::size_t increase_step = (std::size_t) round(oscillator_locations->size() * m_increase_persent);
    if (increase_step < 1) {
        increase_step = DEFAULT_INCREASE_STEP;
    }

    sync_dynamic current_dynamic;
    do {
        create_connections(radius, false);

        simulate_dynamic(order, 0.1, solver, collect_dynamic, current_dynamic);

        if (collect_dynamic) {
            if (analyser.empty()) {
                store_state(*(current_dynamic.begin()), analyser);
            }

            store_state(*(current_dynamic.end() - 1), analyser);
        }
        else {
            m_time += DEFAULT_TIME_STEP;
        }

        hsyncnet_cluster_data clusters;
        current_dynamic.allocate_sync_ensembles(0.05, clusters);

        current_number_clusters = clusters.size();

        number_neighbors += increase_step;
        radius = calculate_radius(radius, number_neighbors);
    }
    while(current_number_clusters > m_number_clusters);

    if (!collect_dynamic) {
        store_state(*(current_dynamic.end() - 1), analyser);
    }
}
コード例 #3
0
ファイル: syncnet.cpp プロジェクト: annoviko/pyclustering
void syncnet::process(const double order, const solve_type solver, const bool collect_dynamic, syncnet_analyser & analyser) {
    simulate_dynamic(order, 0.1, solver, collect_dynamic, analyser);
}