Giter Club home page Giter Club logo

aspcud's Introduction

Aspcud - A solver for package problems in CUDF format using ASP

The aspcud project provides the converter/preprocessor cudf2lp to translate a CUDF specification into a set of facts. These facts together with an encoding can then be passed to an ASP grounder and solver to solve the package problem. The small C program aspcud takes care of this, calling the necessary tools and printing the result in CUDF format.

To run aspcud, use the installed aspcud binary (take a look at the examples folder to get started):

aspcud problem.cudf solution.cudf <criteria>

For this to work, clasp and gringo have to be installed. Solver and grounder are available at:

Check the installation instructions for more details.

The specification of CUDF documents and the supported criteria along with a lot of instances are available at the mancoosi homepage:

Either the encoding misc2012.lp or specification.lp can be used for solving the package problem (can be selected with option -e). The first encoding can typically solve harder problems than the second one. The second encoding is often faster on simpler instance though.

Aspcud is distributed under the MIT Licence.

aspcud's People

Contributors

benkaufmann avatar domoritz avatar lasseblaauwbroek avatar rkaminsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspcud's Issues

Fail to parse CUDF with large integer

Hi,
Since it doesn't accept semver/calver, I converted it padding 0.

But it fails if integer is too large > 999 999 999 9

Thank you, I happy with it anyway.

Add more context to cudf2lp errors

If we could inform the line of parser error, would be helpful.
ie: like when we forgot to add space after request:

ERROR: syntax error::

aspcud-1.9.4 does not build with boost 1.74.0

There are build errors:

cd /tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/build/libcudf && /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ -DBOOST_ALL_NO_LIB -I/tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf -I/tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/build/libcudf/src -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=gnu++14 -o CMakeFiles/libcudf.dir/src/dependency.cpp.o -c /tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/src/dependency.cpp
/tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/src/dependency.cpp:476:81: error: use of undeclared identifier '_1'
            boost::sort(candidates, boost::bind(&ConflictGraph::edgeSort, this, _1, _2));
                                                                                ^
/tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/src/dependency.cpp:476:85: error: use of undeclared identifier '_2'
            boost::sort(candidates, boost::bind(&ConflictGraph::edgeSort, this, _1, _2));
                                                                                    ^
In file included from /tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/src/dependency.cpp:26:
In file included from /tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/cudf/dependency.hh:31:
In file included from /usr/local/include/boost/multi_index/random_access_index.hpp:18:
/usr/local/include/boost/bind/bind.hpp:388:16: error: no matching function for call to object of type 'boost::_mfi::mf2<bool,
      ConflictGraph, Package *, Package *>'
        return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/bind/bind.hpp:1318:16: note: in instantiation of function template specialization
      'boost::_bi::list3<boost::_bi::value<ConflictGraph *>, boost::arg<1>, boost::_bi::value<std::__1::placeholders::__ph<2> >
      >::operator()<bool, boost::_mfi::mf2<bool, ConflictGraph, Package *, Package *>, boost::_bi::rrlist2<Package *&, Package *&>
      >' requested here
        return l_( type<result_type>(), f_, a, 0 );
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:3944:17: note: 
      in instantiation of function template specialization 'boost::_bi::bind_t<bool, boost::_mfi::mf2<bool, ConflictGraph, Package
      *, Package *>, boost::_bi::list3<boost::_bi::value<ConflictGraph *>, boost::arg<1>,
      boost::_bi::value<std::__1::placeholders::__ph<2> > > >::operator()<Package *&, Package *&>' requested here
            if (__comp(*--__last, *__first))
                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:4125:12: note: 
      in instantiation of function template specialization 'std::__1::__sort<boost::_bi::bind_t<bool, boost::_mfi::mf2<bool,
      ConflictGraph, Package *, Package *>, boost::_bi::list3<boost::_bi::value<ConflictGraph *>, boost::arg<1>,
      boost::_bi::value<std::__1::placeholders::__ph<2> > > > &, Package **>' requested here
    _VSTD::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp));
           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:4158:12: note: 
      in instantiation of function template specialization 'std::__1::sort<Package **, boost::_bi::bind_t<bool,
      boost::_mfi::mf2<bool, ConflictGraph, Package *, Package *>, boost::_bi::list3<boost::_bi::value<ConflictGraph *>,
      boost::arg<1>, boost::_bi::value<std::__1::placeholders::__ph<2> > > > &>' requested here
    _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
           ^
/usr/local/include/boost/range/algorithm/sort.hpp:51:10: note: in instantiation of function template specialization
      'std::__1::sort<Package *, boost::_bi::bind_t<bool, boost::_mfi::mf2<bool, ConflictGraph, Package *, Package *>,
      boost::_bi::list3<boost::_bi::value<ConflictGraph *>, boost::arg<1>, boost::_bi::value<std::__1::placeholders::__ph<2> > > >
      >' requested here
    std::sort(boost::begin(rng), boost::end(rng), pred);
         ^
/tmp/aspcud-20201117-58896-1qlgy9k/aspcud-1.9.4/libcudf/src/dependency.cpp:476:20: note: in instantiation of function template
      specialization 'boost::range::sort<std::__1::vector<Package *, std::__1::allocator<Package *> >, boost::_bi::bind_t<bool,
      boost::_mfi::mf2<bool, ConflictGraph, Package *, Package *>, boost::_bi::list3<boost::_bi::value<ConflictGraph *>,
      boost::arg<1>, boost::_bi::value<std::__1::placeholders::__ph<2> > > > >' requested here
            boost::sort(candidates, boost::bind(&ConflictGraph::edgeSort, this, _1, _2));
                   ^
/usr/local/include/boost/bind/mem_fn_template.hpp:278:7: note: candidate function not viable: no known conversion from
      'std::__1::placeholders::__ph<2>' to 'Package *' for 3rd argument
    R operator()(T * p, A1 a1, A2 a2) const
      ^
/usr/local/include/boost/bind/mem_fn_template.hpp:283:25: note: candidate function template not viable: no known conversion from
      'std::__1::placeholders::__ph<2>' to 'Package *' for 3rd argument
    template<class U> R operator()(U & u, A1 a1, A2 a2) const
                        ^
/usr/local/include/boost/bind/mem_fn_template.hpp:291:25: note: candidate function template not viable: no known conversion from
      'std::__1::placeholders::__ph<2>' to 'Package *' for 3rd argument
    template<class U> R operator()(U const & u, A1 a1, A2 a2) const
                        ^
/usr/local/include/boost/bind/mem_fn_template.hpp:299:7: note: candidate function not viable: no known conversion from
      'ConflictGraph *' to 'ConflictGraph &' for 1st argument; dereference the argument with *
    R operator()(T & t, A1 a1, A2 a2) const
      ^

Compilation errors with glibc > 2.34

I'm getting the following build error:

In file included from /usr/include/signal.h:328,
                 from /home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/catch.hpp:8034,
                 from /home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/main.cc:27:
/home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/catch.hpp:10822:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10822 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/catch.hpp:8034,
                 from /home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/main.cc:27:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
In file included from /home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/main.cc:27:
/home/lasse/Documents/Projects/Tactician/benchmark-system/aspcud/libcudf/tests/catch.hpp:10881:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10881 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
make[2]: *** [libcudf/tests/CMakeFiles/test_libcudf.dir/build.make:104: libcudf/tests/CMakeFiles/test_libcudf.dir/main.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:205: libcudf/tests/CMakeFiles/test_libcudf.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I believe this is due to my system having a newer version of glibc. This page suggests that catch2 needs to be upgraded to version 2.13.9: https://www.ubuntuupdates.org/package/core/jammy/universe/proposed/aspcud

Build failure on Apple Silicon

/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/critparser.cc:35:5: error: invalid token in expression
    REQUIRE(p.parse(iss));
    ^
/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/catch.hpp:11486:24: note: expanded from macro 'REQUIRE'
#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
                       ^
/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/catch.hpp:1296:9: note: expanded from macro 'INTERNAL_CATCH_TEST'
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
        ^
/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/catch.hpp:1279:38: note: expanded from macro 'INTERNAL_CATCH_REACT'
    if( handler.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \
                                     ^
/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/catch.hpp:1267:75: note: expanded from macro 'CATCH_BREAK_INTO_DEBUGGER'
    #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
                                                                          ^
/tmp/aspcud-20210111-41893-4psbh5/aspcud-1.9.4/libcudf/tests/catch.hpp:1246:34: note: expanded from macro 'CATCH_TRAP'
    #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
                                 ^
<inline asm>:1:6: note: instantiated into assembly here
        int $3
            ^

I believe catch.hpp should be updated to use this commit from upstream: catchorg/Catch2@a25c1a2#diff-ac110b2b11e08efa102d4b37f6a479fb006cdfb9822af039ee07021b349e95bb

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.