Max-p

The max-p-region problem is a special case of constrained clustering where a finite number of geographical areas are aggregated into the maximum number of regions (max-p-regions), such that each region is geographically connected and the clusters could maximize internal homogeneity.

maxpGreedy()

A simulated annealing algorithm to solve the max-p-region problem

function maxpGreedy(
    WeightResult w,
    Array vals,
    Number iterations,
    Array min_bound_values, 
    Array min_bounds,
    Array max_bound_values, 
    Array max_bounds,
    String scale_method,
    String distance_type,
    Number seed)

Arguments

Return

Examples

const jsgeoda = require('jsgeoda');
const fs = require('fs');

// load data
const data = fs.readFileSync('./data/natregimes.geojson').buffer;

// create jsgeoda instance
const geoda = await jsgeoda.New();

// load geojson in jsgeoda
const nat = geoda.readGeoJSON(data);

// create a queen contiguity weights
const w = geoda.getQueenWeights(nat);

// get values
const hr60 = geoda.getColumn(nat, "HR60");
const ue60 = geoda.getColumn(nat, "UE60");

// set minimum bound
const po60 = geoda.getColumn(nat, "PO60");

// apply azp_greedy
const min_bound_vals = [po60];
const min_bounds = [17845200];
const azp = geoda.maxp_greedy(w, [hr60, ue60], 49, min_bound_vals,min_bounds);

Try it yourself in the playground (jsgeoda + deck.gl):

maxpSA()

A simulated annealing algorithm to solve the max-p-region problem

function maxpSA(
    WeightResult w,
    Array vals,
    Number cooling_rate,
    Number sa_maxit,
    Number iteration,
    Array min_bound_values, 
    Array min_bounds,
    Array max_bound_values, 
    Array max_bounds,
    String scale_method,
    String distance_type,
    Number seed)

Arguments

Return

maxpTabu()

A simulated annealing algorithm to solve the max-p-region problem

function maxpTabu (
    WeightResult w,
    Array vals,
    Number tabu_length,
    Number conv_tabu,
    Number iterations,
    Array min_bound_values, 
    Array min_bounds,
    Array max_bound_values, 
    Array max_bounds,
    String scale_method,
    String distance_type,
    Number seed)

Arguments

Return

Last updated