Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/markirch/sat-modulo-symmetries
26 July 2023, 12:55:27 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
Revision a442fd29e85c0ec1078a6522da81f799f003cdbf authored by muak1234 on 26 July 2023, 12:44:04 UTC, committed by muak1234 on 26 July 2023, 12:44:04 UTC
Update: consistent argument naming; multi-graphs; examples; ...
1 parent 10439bd
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • a442fd29e85c0ec1078a6522da81f799f003cdbf
    No releases to show
  • c50f1ce
  • /
  • encodings
  • /
  • kochen_specker.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:a442fd29e85c0ec1078a6522da81f799f003cdbf
origin badgedirectory badge
swh:1:dir:174971e9a3b2e989188a19c2a0c84637de23a8e1
origin badgecontent badge
swh:1:cnt:66ff3fcaf4351665c1271bcf849042a0b6e3ffa3
origin badgesnapshot badge
swh:1:snp:7f555a9fb592d3551cf76cdda447954088413765

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: a442fd29e85c0ec1078a6522da81f799f003cdbf authored by muak1234 on 26 July 2023, 12:44:04 UTC
Update: consistent argument naming; multi-graphs; examples; ...
Tip revision: a442fd2
kochen_specker.py
from pysms.graph_builder import *
from itertools import *


class KSGraphEncodingBuilder(GraphEncodingBuilder):
    def __init__(self, n, staticInitialPartition=False):
        super().__init__(n, staticInitialPartition=staticInitialPartition)

        # Create triangle variables needed for encoding
        self.triangleVariables = {(i, j, k): self.id() for i, j, k in combinations(self.V, 3)}
        for i, j, k in combinations(self.V, 3):
            self.CNF_AND_APPEND([self.var_edge(i, j), self.var_edge(j, k), self.var_edge(i, k)], self.triangleVariables[(i, j, k)])  # ensure that true iff it is a triangle

        self.paramsSMS["triangle-vars"] = self.triangleVariables[(0, 1, 2)]
        self.paramsSMS["non010"] = ""
        self.paramsSMS["frequency"] = 30
        # self.paramsSMS["forbiddenSubgraphs"] = "./unembeddableSmall.txt"

        # ensure properties of KS graph
        self.maxChromaticNumber(4)  # at most chromatic number 4
        self.minDegree(3)  # minimum degree 3
        self.ckFree(4)  # no 4 cycle
        self.eachVertexInTriangle()

    def eachVertexInTriangle(self):
        g = self
        for v in g.V:
            g.append([g.triangleVariables[(i, j, k)] for i, j, k in combinations(g.V, 3) if v in [i, j, k]])  # check that at least one triangle is present

    def eachEdgeInTriangle(self):
        g = self
        for u,v in combinations(g.V,2):
            g.append([-g.var_edge(u,v)] + [g.triangleVariables[(i, j, k)] for i, j, k in combinations(g.V, 3) if v in [i, j, k] and u in [i, j, k]])  # check that at least one triangle is present

    def add_constraints_by_arguments(self, args):
        super().add_constraints_by_arguments(args)
        if args.edge_in_triangle:
            self.eachEdgeInTriangle()


if __name__ == "__main__":
    parser = getDefaultParser()
    parser.add_argument("--edge_in_triangle", action="store_true", help="Ensure that each edge is in a triangle")
    args = parser.parse_args()
    g = KSGraphEncodingBuilder(args.vertices, staticInitialPartition=args.static_partition)
    g.add_constraints_by_arguments(args)
    g.solveArgs(args)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API