All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.automatalib.modelchecker.ltsmin.ltl.AbstractLTSminLTL Maven / Gradle / Ivy

/* Copyright (C) 2013-2023 TU Dortmund
 * This file is part of AutomataLib, http://www.automatalib.net/.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.automatalib.modelchecker.ltsmin.ltl;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;

import net.automatalib.modelchecker.ltsmin.AbstractLTSmin;
import net.automatalib.modelchecker.ltsmin.LTSminVersion;
import net.automatalib.modelchecking.AbstractUnfoldingModelChecker;
import net.automatalib.modelchecking.Lasso;
import net.automatalib.modelchecking.ModelCheckerLasso;
import org.checkerframework.checker.initialization.qual.UnknownInitialization;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
 * An LTSmin model checker for full LTL.
 *
 * @see man etf2lts-mc
 * @see AbstractLTSmin
 */
public abstract class AbstractLTSminLTL> extends AbstractLTSmin
        implements ModelCheckerLasso {

    public static final LTSminVersion REQUIRED_VERSION = LTSminVersion.of(3, 0, 0);

    private final AbstractUnfoldingModelChecker unfolder;

    /**
     * Constructs a new AbstractLTSminLTL.
     *
     * @param multiplier
     *         the multiplier.
     * @param minimumUnfolds
     *         the minimum number of unfolds.
     *
     * @see AbstractLTSmin#AbstractLTSmin(boolean, Function)
     */
    protected AbstractLTSminLTL(boolean keepFiles,
                                Function string2Input,
                                int minimumUnfolds,
                                double multiplier) {
        super(keepFiles, string2Input);
        unfolder = new AbstractUnfoldingModelChecker(minimumUnfolds, multiplier) {

            @Override
            public @Nullable L findCounterExample(A automaton, Collection inputs, String property) {
                return null;
            }
        };
    }

    @Override
    protected LTSminVersion getMinimumRequiredVersion(@UnknownInitialization(AbstractLTSmin.class) AbstractLTSminLTL this) {
        return REQUIRED_VERSION;
    }

    @Override
    protected List getExtraCommandLineOptions() {
        return Arrays.asList(// use Buchi automata created by spot
                             "--buchi-type=spotba",
                             // use the Union-Find strategy
                             "--strategy=ufscc");
    }

    @Override
    public double getMultiplier() {
        return unfolder.getMultiplier();
    }

    @Override
    public void setMultiplier(double multiplier) {
        unfolder.setMultiplier(multiplier);
    }

    @Override
    public int getMinimumUnfolds() {
        return unfolder.getMinimumUnfolds();
    }

    @Override
    public void setMinimumUnfolds(int minimumUnfolds) {
        unfolder.setMinimumUnfolds(minimumUnfolds);
    }

    static final class BuilderDefaults {

        private BuilderDefaults() {
            // prevent instantiation
        }

        static boolean keepFiles() {
            return false;
        }

        static int minimumUnfolds() {
            return 3; // super arbitrary number
        }

        static double multiplier() {
            return 1.0; // quite arbitrary too
        }

        static  Collection skipOutputs() {
            return Collections.emptyList();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy