Browse Source
First (partial) connection of sparse adversary generation to Strategy classes and -exportstrat.
First (partial) connection of sparse adversary generation to Strategy classes and -exportstrat.
git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@7119 bbc10eb1-c90d-0410-af57-cb519fbb1720master
8 changed files with 208 additions and 19 deletions
-
4prism/include/PrismSparse.h
-
21prism/src/dv/IntegerVector.java
-
16prism/src/prism/NondetModelChecker.java
-
3prism/src/prism/StateModelChecker.java
-
21prism/src/sparse/PS_NondetUntil.cc
-
7prism/src/sparse/PrismSparse.java
-
101prism/src/strat/MDStrategyIV.java
-
54prism/src/strat/Makefile
@ -0,0 +1,101 @@ |
|||
//============================================================================== |
|||
// |
|||
// Copyright (c) 2002- |
|||
// Authors: |
|||
// * Dave Parker <d.a.parker@cs.bham.ac.uk> (University of Birmingham/Oxford) |
|||
// |
|||
//------------------------------------------------------------------------------ |
|||
// |
|||
// This file is part of PRISM. |
|||
// |
|||
// PRISM 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 2 of the License, or |
|||
// (at your option) any later version. |
|||
// |
|||
// PRISM 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 PRISM; if not, write to the Free Software Foundation, |
|||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|||
// |
|||
//============================================================================== |
|||
|
|||
package strat; |
|||
|
|||
import java.util.List; |
|||
|
|||
import dv.IntegerVector; |
|||
|
|||
import prism.Model; |
|||
|
|||
/** |
|||
* Class to store a memoryless deterministic (MD) strategy, as a IntegerVector (i.e. stored natively as an array). |
|||
*/ |
|||
public class MDStrategyIV extends MDStrategy |
|||
{ |
|||
// Model associated with the strategy |
|||
private Model model; |
|||
|
|||
private IntegerVector iv; |
|||
|
|||
private List<String> actions; |
|||
|
|||
private int numStates; |
|||
private long ptr; |
|||
|
|||
/** |
|||
* Creates... |
|||
*/ |
|||
public MDStrategyIV(Model model) |
|||
{ |
|||
this.model = model; |
|||
numStates = (int) model.getNumStates(); |
|||
actions = model.getSynchs(); |
|||
} |
|||
|
|||
/** |
|||
* Creates... |
|||
*/ |
|||
public MDStrategyIV(Model model, IntegerVector iv) |
|||
{ |
|||
this.model = model; |
|||
numStates = (int) model.getNumStates(); |
|||
actions = model.getSynchs(); |
|||
this.iv = iv; |
|||
} |
|||
|
|||
public void setPointer(long ptr) |
|||
{ |
|||
this.ptr = ptr; |
|||
} |
|||
|
|||
@Override |
|||
public int getNumStates() |
|||
{ |
|||
return numStates; |
|||
} |
|||
|
|||
@Override |
|||
public int getChoice(int s) |
|||
{ |
|||
return 99; |
|||
} |
|||
|
|||
@Override |
|||
public Object getChoiceAction(int s) |
|||
{ |
|||
int c = iv.getElement(s); |
|||
//return ""+c; //c >= 0 ? actions.get(c) : "?"; |
|||
return c >= 0 ? actions.get(c) : c == -1 ? "?" : c == -2 ? "*" : "-"; |
|||
} |
|||
|
|||
public void clear() |
|||
{ |
|||
iv.clear(); |
|||
iv = null; |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
################################################
|
|||
# NB: This Makefile is designed to be called #
|
|||
# from the main PRISM Makefile. It won't #
|
|||
# work on its own because it needs #
|
|||
# various options to be passed in #
|
|||
################################################
|
|||
|
|||
.SUFFIXES: .o .c .cc |
|||
|
|||
# Reminder: $@ = target, $* = target without extension, $< = dependency
|
|||
|
|||
THIS_DIR = strat |
|||
PRISM_DIR_REL = ../.. |
|||
|
|||
INCLUDES = \
|
|||
-I$(PRISM_DIR_REL)/$(CUDD_DIR)/include \ |
|||
-I"$(JAVA_JNI_H_DIR)" \ |
|||
-I"$(JAVA_JNI_MD_H_DIR)" \ |
|||
-I$(PRISM_DIR_REL)/$(INCLUDE_DIR) |
|||
|
|||
LIBRARIES = \
|
|||
-L$(PRISM_DIR_REL)/$(LIB_DIR) \ |
|||
-lodd \ |
|||
-ldd \ |
|||
$(LIBMATH) |
|||
|
|||
JAVA_FILES_ALL = $(wildcard *.java) |
|||
JAVA_FILES = $(subst package-info.java,,$(JAVA_FILES_ALL)) |
|||
CLASS_FILES = $(JAVA_FILES:%.java=$(PRISM_DIR_REL)/$(CLASSES_DIR)/$(THIS_DIR)/%.class) |
|||
|
|||
PRISM_CLASSPATH = "$(THIS_DIR)/$(PRISM_DIR_REL)/$(CLASSES_DIR)$(CLASSPATHSEP)$(THIS_DIR)/$(PRISM_DIR_REL)/lib/*" |
|||
|
|||
default: all |
|||
|
|||
all: checks $(CLASS_FILES) |
|||
|
|||
# Try and prevent accidental makes (i.e. called manually, not from top-level Makefile)
|
|||
checks: |
|||
@if [ "$(SRC_DIR)" = "" ]; then \
|
|||
(echo "Error: This Makefile is designed to be called from the main PRISM Makefile"; exit 1) \
|
|||
fi; |
|||
|
|||
$(PRISM_DIR_REL)/$(CLASSES_DIR)/$(THIS_DIR)/%.class: %.java |
|||
(cd ..; $(JAVAC) -sourcepath $(THIS_DIR)/$(PRISM_DIR_REL)/$(SRC_DIR) -classpath $(PRISM_CLASSPATH) -d $(THIS_DIR)/$(PRISM_DIR_REL)/$(CLASSES_DIR) $(THIS_DIR)/$<) |
|||
|
|||
$(PRISM_DIR_REL)/$(OBJ_DIR)/$(THIS_DIR)/%.o: %.cc |
|||
$(CPP) $(CPPFLAGS) -c $< -o $@ $(INCLUDES) |
|||
|
|||
clean: checks |
|||
@rm -f $(CLASS_FILES) $(O_FILES) |
|||
|
|||
celan: clean |
|||
|
|||
#################################################
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue