Skip to content

Commit

Permalink
Changed variable glpk requirements to be in the .jar instead of the t…
Browse files Browse the repository at this point in the history
…racked class

Removed sed
  • Loading branch information
nicodelpiano committed Aug 19, 2016
1 parent 7bb4d89 commit 8896675
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
1 change: 0 additions & 1 deletion prism/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ exact_lp_requirements: checks
else echo "Warning: LIBTOOL not found. Required for GLPK java bindings."; fi
@if [ "$(DETECT_ACLOCAL)" != "" ]; then echo "Found ACLOCAL in $(DETECT_ACLOCAL)"; \
else echo "Warning: ACLOCAL not found. Required for both GLPK and GLPK java bindings."; fi
@sed -i '/EXACT_LP_REQUIREMENTS_INSTALLED/c\ public final int EXACT_LP_REQUIREMENTS_INSTALLED = $(EXACT_LP_REQUIREMENTS_INSTALLED);' src/prism/PrismSettings.java;

cuddpackage: checks
@if [ "$(CUDD_DIR)" = "" ]; then echo "Error: Cannot find CUDD"; exit 1; fi
Expand Down
Binary file modified prism/ext/glpk_java/jar/glpk-java.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions prism/ext/glpk_java/libglpk_java_exact.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ index bf7d91f..e5ba65f 100644

// Add handling for String arrays in glp_main
%include "various.i"
diff --git a/swig/glpk_java.h b/swig/glpk_java.h
index afb5b30..c6bf6b1 100644
--- a/swig/glpk_java.h
+++ b/swig/glpk_java.h
@@ -8,6 +8,7 @@

#define GLP_JAVA_MSG_LVL_OFF 0
#define GLP_JAVA_MSG_LVL_ALL 1
+#define EXACT_LP_REQUIREMENTS 1
void glp_java_error(char *message);
void glp_java_set_msg_lvl(int msg_lvl);
void glp_java_set_numeric_locale(const char *locale);
diff --git a/swig/glpk_java_arrays.i b/swig/glpk_java_arrays.i
index 214cec7..e4ecaaa 100644
--- a/swig/glpk_java_arrays.i
Expand Down
2 changes: 1 addition & 1 deletion prism/src/explicit/DTMCModelChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public ModelCheckerResult computeReachProbs(DTMC dtmc, BitSet remain, BitSet tar

// Switch to a supported method, if necessary
if (!(linEqMethod == LinEqMethod.POWER || linEqMethod == LinEqMethod.GAUSS_SEIDEL
|| linEqMethod == LinEqMethod.EXACT_LINEAR_PROGRAMMING || settings.EXACT_LP_REQUIREMENTS_INSTALLED == 0)) {
|| linEqMethod == LinEqMethod.EXACT_LINEAR_PROGRAMMING || GLPK.EXACT_LP_REQUIREMENTS == 0)) {
linEqMethod = LinEqMethod.GAUSS_SEIDEL;
mainLog.printWarning("Switching to linear equation solution method \"" + linEqMethod.fullName() + "\"");
}
Expand Down
3 changes: 2 additions & 1 deletion prism/src/explicit/MDPModelChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public ModelCheckerResult computeReachProbs(MDP mdp, BitSet remain, BitSet targe
MDPSolnMethod mdpSolnMethod = this.mdpSolnMethod;

// Switch to a supported method, if necessary
if (settings.EXACT_LP_REQUIREMENTS_INSTALLED == 0) {
if (GLPK.EXACT_LP_REQUIREMENTS == 0) {
mdpSolnMethod = MDPSolnMethod.GAUSS_SEIDEL;
mainLog.printWarning("Cannot compute exact linear programming. GLPK libraries are not properly installed");
mainLog.printWarning("Switching to MDP solution method \"" + mdpSolnMethod.fullName() + "\"");
Expand Down Expand Up @@ -1282,6 +1282,7 @@ protected ModelCheckerResult computeReachProbsExactLinearProg(MDP mdp, BitSet no
sol = GLPK.glp_get_obj_val(lp);
String currentResult;
int exp;

mainLog.println("\n" + this.getPrecision() + "-bit results (non-zero only) for each state of the MDP:");
for (int mdpState = 0; mdpState < nStates; mdpState++) {
if (maybe.get(mdpState)) {
Expand Down
1 change: 0 additions & 1 deletion prism/src/prism/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ $(PRISM_DIR_REL)/$(OBJ_DIR)/$(THIS_DIR)/ngprism$(EXE): ngprism.c

clean: checks
@rm -f $(CLASS_FILES) $(PRISM_DIR_REL)/$(LIB_DIR)/$(LIBPREFIX)prism$(LIBSUFFIX) $(O_FILES) $(PRISM_DIR_REL)/$(OBJ_DIR)/$(THIS_DIR)/ngprism$(EXE)
@sed -i '/EXACT_LP_REQUIREMENTS_INSTALLED/c\ public final int EXACT_LP_REQUIREMENTS_INSTALLED = 1;' PrismSettings.java

celan: clean

Expand Down
3 changes: 0 additions & 3 deletions prism/src/prism/PrismSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,6 @@ public class PrismSettings implements Observer

public static final String[] oldPropertyNames = {"simulator.apmcStrategy", "simulator.engine", "simulator.newPathAskDefault"};

//Exact LP requirements
public final int EXACT_LP_REQUIREMENTS_INSTALLED = 1;

public DefaultSettingOwner[] optionOwners;
private Hashtable<String,Setting> data;
private boolean modified;
Expand Down

0 comments on commit 8896675

Please sign in to comment.