Giter VIP home page Giter VIP logo

pipelines-1's Introduction

Linux/Mac/Windows build status

Pipelines

Pipeline networks can be viewed as a graph built up of edges (pipeline segments) and nodes (junctions of pipeline segments). Suppose that within this network of pipelines, we want to determine a set of junctions from which we can monitor every pipeline segment. This problem can be modeled as a vertex cover problem in which we want to find a subset of nodes in a graph such that every edge has at least one end point in our subset.

Let's look at a simple example. Below we have a graph representing a simple network of pipelines with seven junctions. Note that each junction is identical in terms of its utility as a monitoring location.

Original Example

Problem: Given the above set of junctions, which ones should you choose such that you minimize the number selected for monitoring, while still monitoring every segment?

Solution: One possible solution is indicated by the red nodes below.

Example Solution

Usage

To run the demo:

python pipelines.py

Code Overview

The program pipelines.py creates a graph using the Python package networkx, and then uses the Ocean software tools to run the minimum_vertex_cover function from within the dwave_networkx package.

A valid vertex cover is a subset of nodes in the graph such that every edge in the graph has at least one end point in the subset. Visual inspection shows that we will need either 1 or 2 in the solution; we will also need 6 or 7; and we will also need 4 or 5. We therefore know that a minimum vertex cover will have at least 3 nodes; it turns out that there must be four.

Gamma, our Lagrange parameter (see Lagrange Multiplier for a discussion of Lagrange multiplier, an analogous concept), weights the constraints in the problem versus the energy term (objective). If the Lagrange parameter is too small relative to the strength of the energy term, the constraints may be violated.

With a Lagrange parameter that is too weak, the solutions are sets which are too small. In the minimum_vertex_cover function from within the dwave_networkx package, the default of the Lagrange parameter is 2. Repeated runs, using the default, produced sets which had size 2 or 3.

Hence, the Lagrange parameter value of 5 was set large enough to (1) balance the energy term and constraints, and to (2) cause the minimum vertex cover conditions to all be satisfied for this problem.

License

Released under the Apache License 2.0. See LICENSE file.

pipelines-1's People

Contributors

vgoliber avatar m3ller avatar joelgdwave avatar hemantdwave avatar randomir avatar

Watchers

James Cloos avatar  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.