Browse Source
First bits of code for improved strategy generation.
First bits of code for improved strategy generation.
git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@6994 bbc10eb1-c90d-0410-af57-cb519fbb1720master
10 changed files with 216 additions and 1 deletions
-
6prism/src/explicit/MDPModelChecker.java
-
10prism/src/explicit/ModelCheckerResult.java
-
3prism/src/explicit/ProbModelChecker.java
-
18prism/src/prism/Prism.java
-
8prism/src/prism/PrismCL.java
-
23prism/src/prism/Result.java
-
47prism/src/strat/MDStrategy.java
-
57prism/src/strat/MDStrategyArray.java
-
41prism/src/strat/Strategy.java
-
4prism/src/strat/package-info.java
@ -0,0 +1,47 @@ |
|||||
|
//============================================================================== |
||||
|
// |
||||
|
// Copyright (c) 2002- |
||||
|
// Authors: |
||||
|
// * Dave Parker <d.a.parker@cs.bham.ac.uk> (University of Birmingham/Oxford) |
||||
|
// * Aistis Simaitis <aistis.aimaitis@cs.ox.ac.uk> (University of 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 prism.PrismLog; |
||||
|
|
||||
|
/** |
||||
|
* Classes to store memoryless deterministic (MD) strategies. |
||||
|
*/ |
||||
|
public abstract class MDStrategy implements Strategy |
||||
|
{ |
||||
|
public abstract int getNumStates(); |
||||
|
public abstract int getChoice(int i); |
||||
|
|
||||
|
public void export(PrismLog out) |
||||
|
{ |
||||
|
int n = getNumStates(); |
||||
|
for (int i = 0; i < n; i++) { |
||||
|
out.println(i + ":" + getChoice(i)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
//============================================================================== |
||||
|
// |
||||
|
// Copyright (c) 2002- |
||||
|
// Authors: |
||||
|
// * Dave Parker <d.a.parker@cs.bham.ac.uk> (University of Birmingham/Oxford) |
||||
|
// * Aistis Simaitis <aistis.aimaitis@cs.ox.ac.uk> (University of 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; |
||||
|
|
||||
|
/** |
||||
|
* Class to store a memoryless deterministic (MD) strategy, as a (Java) array of choice indices. |
||||
|
*/ |
||||
|
public class MDStrategyArray extends MDStrategy |
||||
|
{ |
||||
|
private int choices[]; |
||||
|
|
||||
|
/** |
||||
|
* Creates an MDStrategyArray from an integer array of choices. |
||||
|
* The array may later be modified/delete - take a copy if you want to keep it. |
||||
|
*/ |
||||
|
public MDStrategyArray(int choices[]) |
||||
|
{ |
||||
|
this.choices = choices; |
||||
|
} |
||||
|
|
||||
|
public int getNumStates() |
||||
|
{ |
||||
|
// Need? |
||||
|
return choices.length; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int getChoice(int i) |
||||
|
{ |
||||
|
return choices[i]; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
//============================================================================== |
||||
|
// |
||||
|
// Copyright (c) 2002- |
||||
|
// Authors: |
||||
|
// * Dave Parker <d.a.parker@cs.bham.ac.uk> (University of Birmingham/Oxford) |
||||
|
// * Aistis Simaitis <aistis.aimaitis@cs.ox.ac.uk> (University of 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 prism.PrismLog; |
||||
|
|
||||
|
/** |
||||
|
* Interface for classes to store strategies (for MDPs, games, etc.) |
||||
|
*/ |
||||
|
public interface Strategy |
||||
|
{ |
||||
|
/** |
||||
|
* Export the strategy to a PrismLog. |
||||
|
*/ |
||||
|
public void export(PrismLog out); |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
/** |
||||
|
* Classes to represent/manipulate strategies (of MDPs, games, etc.) |
||||
|
*/ |
||||
|
package strat; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue