Search in sources :

Example 1 with AlgorithmModels

use of edu.cmu.tetradapp.ui.model.AlgorithmModels in project tetrad by cmu-phil.

the class GeneralAlgorithmEditor method refreshAlgorithmList.

private void refreshAlgorithmList() {
    algoModels.clear();
    ButtonModel selectedAlgoType = algoFilterBtnGrp.getSelection();
    if (selectedAlgoType != null) {
        AlgorithmModels algorithmModels = AlgorithmModels.getInstance();
        String algoType = selectedAlgoType.getActionCommand();
        if ("all".equals(algoType)) {
            if (knowledgeChkBox.isSelected()) {
                algorithmModels.getModels().stream().filter(e -> HasKnowledge.class.isAssignableFrom(e.getAlgorithm().getClazz())).forEach(e -> algoModels.addElement(e));
            } else {
                algorithmModels.getModels().stream().forEach(e -> algoModels.addElement(e));
            }
        } else {
            if (knowledgeChkBox.isSelected()) {
                algorithmModels.getModels(AlgType.valueOf(algoType)).stream().filter(e -> HasKnowledge.class.isAssignableFrom(e.getAlgorithm().getClazz())).forEach(e -> algoModels.addElement(e));
            } else {
                algorithmModels.getModels(AlgType.valueOf(algoType)).stream().forEach(e -> algoModels.addElement(e));
            }
        }
        if (algoModels.isEmpty()) {
            paramSetFwdBtn.setEnabled(false);
        } else {
            algorithmList.setSelectedIndex(0);
            paramSetFwdBtn.setEnabled(true);
        }
    }
    scoreComboBox.setEnabled(scoreComboBox.getItemCount() > 0);
}
Also used : Enumeration(java.util.Enumeration) JDialog(javax.swing.JDialog) TetradDesktop(edu.cmu.tetradapp.app.TetradDesktop) LoggerFactory(org.slf4j.LoggerFactory) Parameters(edu.cmu.tetrad.util.Parameters) Node(edu.cmu.tetrad.graph.Node) PaddingPanel(edu.cmu.tetradapp.ui.PaddingPanel) StringUtils(org.apache.commons.lang3.StringUtils) Linear(edu.cmu.tetrad.annotation.Linear) AlgorithmModel(edu.cmu.tetradapp.ui.model.AlgorithmModel) Map(java.util.Map) ScoreModel(edu.cmu.tetradapp.ui.model.ScoreModel) ICovarianceMatrix(edu.cmu.tetrad.data.ICovarianceMatrix) HpcJobActivityAction(edu.cmu.tetradapp.app.hpc.action.HpcJobActivityAction) BorderLayout(java.awt.BorderLayout) ButtonModel(javax.swing.ButtonModel) JComboBox(javax.swing.JComboBox) GraphSelectionWrapper(edu.cmu.tetradapp.model.GraphSelectionWrapper) Method(java.lang.reflect.Method) Path(java.nio.file.Path) GeneralAlgorithmRunner(edu.cmu.tetradapp.model.GeneralAlgorithmRunner) BdeuScore(edu.cmu.tetrad.algcomparison.score.BdeuScore) HpcJobManager(edu.cmu.tetradapp.app.hpc.manager.HpcJobManager) Frame(java.awt.Frame) HpcAccountManager(edu.cmu.tetradapp.app.hpc.manager.HpcAccountManager) WatchedProcess(edu.cmu.tetradapp.util.WatchedProcess) EnumMap(java.util.EnumMap) AlgType(edu.cmu.tetrad.annotation.AlgType) HpcParameter(edu.pitt.dbmi.tetrad.db.entity.HpcParameter) Set(java.util.Set) BorderFactory(javax.swing.BorderFactory) ComboBoxModel(javax.swing.ComboBoxModel) Gaussian(edu.cmu.tetrad.annotation.Gaussian) Nonexecutable(edu.cmu.tetrad.annotation.Nonexecutable) JsonWebToken(edu.pitt.dbmi.ccd.rest.client.dto.user.JsonWebToken) HpcJobInfo(edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo) JRadioButton(javax.swing.JRadioButton) DataModel(edu.cmu.tetrad.data.DataModel) InvocationTargetException(java.lang.reflect.InvocationTargetException) Box(javax.swing.Box) Dimension(java.awt.Dimension) List(java.util.List) DataSet(edu.cmu.tetrad.data.DataSet) JCheckBox(javax.swing.JCheckBox) Optional(java.util.Optional) MessageDigestHash(edu.pitt.dbmi.ccd.commons.file.MessageDigestHash) JPanel(javax.swing.JPanel) Toolkit(java.awt.Toolkit) CardLayout(java.awt.CardLayout) JOptionUtils(edu.cmu.tetrad.util.JOptionUtils) HashMap(java.util.HashMap) AlgorithmModels(edu.cmu.tetradapp.ui.model.AlgorithmModels) FinalizingEditor(edu.cmu.tetradapp.util.FinalizingEditor) AlgorithmParamRequest(edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest) SwingConstants(javax.swing.SwingConstants) ArrayList(java.util.ArrayList) SingleGraphAlg(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.SingleGraphAlg) HashSet(java.util.HashSet) HasKnowledge(edu.cmu.tetrad.algcomparison.utils.HasKnowledge) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore) DataType(edu.cmu.tetrad.data.DataType) JsonUtils(edu.cmu.tetrad.util.JsonUtils) IndependenceTestModel(edu.cmu.tetradapp.ui.model.IndependenceTestModel) IndependenceTestModels(edu.cmu.tetradapp.ui.model.IndependenceTestModels) TsImages(edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsImages) LinkedList(java.util.LinkedList) AlgorithmFactory(edu.cmu.tetrad.algcomparison.algorithm.AlgorithmFactory) Algorithm(edu.cmu.tetrad.algcomparison.algorithm.Algorithm) JButton(javax.swing.JButton) Logger(org.slf4j.Logger) AlgorithmParameter(edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter) Files(java.nio.file.Files) ButtonGroup(javax.swing.ButtonGroup) TakesInitialGraph(edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph) Window(java.awt.Window) JList(javax.swing.JList) DesktopController(edu.cmu.tetradapp.util.DesktopController) Graph(edu.cmu.tetrad.graph.Graph) HpcAccountUtils(edu.cmu.tetradapp.app.hpc.util.HpcAccountUtils) JvmOptions(edu.pitt.dbmi.tetrad.db.entity.JvmOptions) IOException(java.io.IOException) JOptionPane(javax.swing.JOptionPane) ActionEvent(java.awt.event.ActionEvent) JScrollPane(javax.swing.JScrollPane) LayoutStyle(javax.swing.LayoutStyle) DataModelList(edu.cmu.tetrad.data.DataModelList) ScoreModels(edu.cmu.tetradapp.ui.model.ScoreModels) DefaultListModel(javax.swing.DefaultListModel) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) HpcAccount(edu.pitt.dbmi.tetrad.db.entity.HpcAccount) JTextArea(javax.swing.JTextArea) Knowledge2(edu.cmu.tetrad.data.Knowledge2) AlgorithmModels(edu.cmu.tetradapp.ui.model.AlgorithmModels) ButtonModel(javax.swing.ButtonModel)

Aggregations

Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)1 AlgorithmFactory (edu.cmu.tetrad.algcomparison.algorithm.AlgorithmFactory)1 TsImages (edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsImages)1 SingleGraphAlg (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.SingleGraphAlg)1 BdeuScore (edu.cmu.tetrad.algcomparison.score.BdeuScore)1 SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)1 HasKnowledge (edu.cmu.tetrad.algcomparison.utils.HasKnowledge)1 TakesInitialGraph (edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph)1 AlgType (edu.cmu.tetrad.annotation.AlgType)1 Gaussian (edu.cmu.tetrad.annotation.Gaussian)1 Linear (edu.cmu.tetrad.annotation.Linear)1 Nonexecutable (edu.cmu.tetrad.annotation.Nonexecutable)1 DataModel (edu.cmu.tetrad.data.DataModel)1 DataModelList (edu.cmu.tetrad.data.DataModelList)1 DataSet (edu.cmu.tetrad.data.DataSet)1 DataType (edu.cmu.tetrad.data.DataType)1 ICovarianceMatrix (edu.cmu.tetrad.data.ICovarianceMatrix)1 Knowledge2 (edu.cmu.tetrad.data.Knowledge2)1 Graph (edu.cmu.tetrad.graph.Graph)1 Node (edu.cmu.tetrad.graph.Node)1