Code Monkey home page Code Monkey logo

mcmopop's Introduction

The Ripple-Spreading Algorithm for the one-to-all Multi-Category Multi-Objective Path Optimization Problem

The multi-category multi-objective path optimization problems aims to determine all Pareto-optimal paths from one node to all other nodes on a graph with multiple additive and multiplicative weights.

Variables Meaning
network Dictionary, {node 1: {node 2: [[additive weights], [multiplicative weights]], ...}, ...}
s_network The network described by a crisp weight on which we conduct the ripple relay race
source The source node
nn The number of nodes
na The number of additive weights
nm The number of multiplicative weights
neighbor Dictionary, {node1: [the neighbor nodes of node1], ...}
v The ripple-spreading speed (i.e., the minimum length of arcs)
t The simulated time index
nr The number of ripples - 1
epicenter_set List, the epicenter node of the i-th ripple is epicenter_set[i]
path_set List, the path of the i-th ripple from the source node to node i is path_set[i]
radius_set List, the radius of the i-th ripple is radius_set[i]
active_set List, active_set contains all active ripples
objective_set List, the objective value of the traveling path of the i-th ripple is objective_set[i]
Omega Dictionary, Omega[n] = i denotes that ripple i is generated at node n

Example

The red number associated with each arc is the additive weight, and the green number is the multiplicative weight.

if __name__ == '__main__':
    test_network = {
        0: {1: [[62], [0.9]], 2: [[44], [0.7]], 3: [[67], [0.6]]},
        1: {0: [[62], [0.9]], 2: [[33], [0.8]], 4: [[52], [0.5]]},
        2: {0: [[44], [0.7]], 1: [[33], [0.8]], 3: [[32], [0.8]], 4: [[52], [0.5]]},
        3: {0: [[67], [0.6]], 2: [[32], [0.8]], 4: [[54], [0.8]]},
        4: {1: [[52], [0.5]], 2: [[52], [0.5]], 3: [[54], [0.8]]},
    }
    source_node = 0
    destination_node = 4
    print(main(test_network, source_node, destination_node))
Output:
{
    0: [{'path': [0], 'objective': [0, 1]}], 
    1: [{'path': [0, 1], 'objective': [62, 0.9]}], 
    2: [
        {'path': [0, 2], 'objective': [44, 0.7]}, 
        {'path': [0, 1, 2], 'objective': [95, 0.72]},
    ], 
    3: [{'path': [0, 3], 'objective': [67, 0.6]}], 
    4: [
        {'path': [0, 2, 4], 'objective': [96, 0.35]}, 
        {'path': [0, 1, 4], 'objective': [114, 0.45]}, 
        {'path': [0, 3, 4], 'objective': [121, 0.48]},
    ]
}

mcmopop's People

Contributors

xavier-mayiming avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.