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/crillab/d4v2
27 March 2023, 21:09:18 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
Revision 173d6998b1c7f83bf2a5d595561d49b1d19c70dd authored by JM on 30 September 2022, 13:36:42 UTC, committed by JM on 30 September 2022, 13:36:42 UTC
update header
1 parent c4239d5
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 173d6998b1c7f83bf2a5d595561d49b1d19c70dd
    No releases to show
  • 253d435
  • /
  • demo
  • /
  • src
  • /
  • Main.cpp
Raw File Download
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:173d6998b1c7f83bf2a5d595561d49b1d19c70dd
origin badgedirectory badge
swh:1:dir:962a86338bcd56a2975e7e0f0286e5892ba7790a
origin badgecontent badge
swh:1:cnt:34e798beb7bd9d0a70c131e7961a05f411409e62
origin badgesnapshot badge
swh:1:snp:0020192acd512b1a686e83d94dc283eedf58e892

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: 173d6998b1c7f83bf2a5d595561d49b1d19c70dd authored by JM on 30 September 2022, 13:36:42 UTC
update header
Tip revision: 173d699
Main.cpp
/*
 * d4
 * Copyright (C) 2020  Univ. Artois & CNRS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include "../../src/methods/Counter.hpp"
#include <boost/program_options.hpp>
#include <iostream>

/**
   The main function!
*/
int main(int argc, char **argv) {
  // to create the vm option.
  namespace po = boost::program_options;
  po::options_description desc{"Options"};
  desc.add_options()
#include "option.dsc"
      ;
  po::variables_map vm;
  char **fake = NULL;
  po::store(parse_command_line(0, fake, desc), vm);

  // to create the CNF instance.
  unsigned nbVar = 3;
  d4::ProblemManagerCnf problem;
  problem.setNbVar(nbVar);

  std::vector<double> &weightLit = problem.getWeightLit();
  std::vector<double> &weightVar = problem.getWeightVar();

  weightLit.resize((nbVar + 1) << 1, 1);
  weightVar.resize(nbVar + 1, 2);

  std::vector<std::vector<d4::Lit>> &clauses = problem.getClauses();
  clauses.push_back({d4::Lit::makeLitFalse(1), d4::Lit::makeLitTrue(2)});
  clauses.push_back({d4::Lit::makeLitTrue(1), d4::Lit::makeLitTrue(3)});

  problem.display(std::cout);

  d4::LastBreathPreproc lastBreath;
  d4::PreprocManager *preproc =
      d4::PreprocManager::makePreprocManager(vm, std::cerr);
  d4::ProblemManager *preprocProblem = preproc->run(problem, lastBreath);

  namespace mpz = boost::multiprecision;
  mpz::mpf_float::default_precision(50);
  d4::Counter<mpz::mpf_float> *method =
      d4::Counter<mpz::mpf_float>::makeCounter(vm, preprocProblem, "counting",
                                               true, 50, std::cerr, lastBreath);

  std::vector<d4::Var> setOfVar;
  for (unsigned i = 1; i <= nbVar; i++)
    setOfVar.push_back(i);

  mpz::mpf_float v = method->count(setOfVar, std::cerr);
  std::cout << "s " << v << "\n";
  delete method;
  return 0;
} // main
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–2025, 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