Package org.sat4j.tools

Examples of org.sat4j.tools.GateTranslator


    private int maxvarid;

    private int nbinputs;

    AAGReader(ISolver s) {
        solver = new GateTranslator(s);
    }
View Full Code Here


    private int maxvarid;

    private int nbinputs;

    AIGReader(ISolver s) {
        solver = new GateTranslator(s);
    }
View Full Code Here

     *
     */
    private static final long serialVersionUID = 1L;

    public ExtendedDimacsReader(ISolver solver) {
        super(new GateTranslator(solver));
    }
View Full Code Here

    protected boolean handleConstr(String line, IVecInt literals)
            throws ContradictionException {
        boolean added = true;
        assert literals.size() == 0;
        Scanner scan = new Scanner(line);
        GateTranslator gater = (GateTranslator)solver;
        while (scan.hasNext()) {
            int gateType = scan.nextInt();
            assert gateType > 0;
            int nbparam = scan.nextInt();
            assert nbparam != 0;
            assert nbparam == -1 || gateType >= ATLEAST;
            for (int i = 0; i < nbparam; i++) {
                scan.nextInt();
            }
            // readI/O until reaching ending 0
            int y = scan.nextInt();
            int x;
            while ((x = scan.nextInt()) != 0) {
                literals.push(x);
            }
            switch (gateType) {
            case FALSE:
                assert literals.size()==0;
                gater.gateFalse(y);
                break;
            case TRUE:
                assert literals.size()==0;
                gater.gateTrue(y);
                break;
            case OR:
                gater.or(y, literals);
                break;
            case NOT:
                assert literals.size()==1;
                gater.not(y, literals.get(0));
                break;
            case AND:
                gater.and(y, literals);
                break;
            case XOR:
                gater.xor(y, literals);
                break;
            case IFF:
                gater.iff(y, literals);
                break;
            case IFTHENELSE:
                assert literals.size()==3;
                gater.ite(y, literals.get(0),literals.get(1),literals.get(2));
                break;
            default:
                throw new UnsupportedOperationException("Gate type " + gateType
                        + " not handled yet");
            }
View Full Code Here

TOP

Related Classes of org.sat4j.tools.GateTranslator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.