Examples of LSolver

MacOS X - specific instructions

It may be advisable to build gcc first (gmp web page suggests it will not work when built with XCode so using a recent gcc may be advisable), It is worth noting that the full path of the interface is encoded in the shared libraries hence moving this interface is only possible if libraries are rebuilt. For this reason, LSolver is stuck in the rpnicore rather than in learner/linear. Instructions for building OpenBLAS on Linux, Uncompress the .zip, then from the main directory run
 make PREFIX=/usr/local/soft/OpenBLAS-be853da DYNAMIC_ARCH=1 UTEST_CHECK=1 NO_LAPACK=1	NO_AFFINITY=1 
The first parameter is responsible for building in support for all CPU architectures, otherwise only the current one will This will attempt to download CUnit and then fail.
 cd utest;make 
should build and install CUnit into utest. Subsequently doing the following command from the main directory (the one just above utest)
  ln -s utest/CUnit-2.1-2/include/CUnit . 
would fix unit tests that ship with OpenBLAS and they will run when the above make command is run. After doing
  make PREFIX=/usr/local/soft/OpenBLAS-be853da DYNAMIC_ARCH=1 UTEST_CHECK=1 NO_LAPACK=1 install 
OpenBLAS is available. SuiteSparse_config.mk should have
 CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar RANLIB = x86_64-w64-mingw32-ranlib F77 = x86_64-w64-mingw32-gfortran BLAS = /usr/local/soft/OpenBLAS-be853da/lib/libopenblas.lib INSTALL_LIB=/usr/local/soft/umfpack-5.6.1-openblas/lib INSTALL_INCLUDE=/usr/local/soft/umfpack-5.6.1-openblas/include 
OpenBLAS on Windows7-x86_64 First, build OpenBLAS with both options for Unix (above) and those mentioned in quickbuild.64bit.

When building UMFPACK, most options are the same as for Unix but there are a few changes,

Finally, Makefile in the UMFPACK/Demo directory has the "run" target, where it runs demos and records the results. Every time it runs a demo, the output has to be piped through d2u to correct line endings on Windows and through sed 's/e\([+-]\)0\([0-9]\+\)/e\1\2/g' to convert the differences in which exponents are output on Windows. Hence the extra content is like
 ... _demo | d2u |  sed  's/e\([+-]\)0\([0-9]\+\)/e\1\2/g' > my_ ... .out 

Examples of statechum.analysis.learning.rpnicore.LSolver

   */
  public double [] computeStateCompatibility(int ThreadNumber,final Class<? extends DetermineDiagonalAndRightHandSideInterface> ddrh)
  {
    final int [] incompatiblePairs = new int[getPairNumber()];for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;
    final int pairsNumber = findIncompatiblePairs(incompatiblePairs,ThreadNumber);
    LSolver solver = buildMatrix_internal(incompatiblePairs, pairsNumber, ThreadNumber,ddrh);
    solver.solve(ThreadNumber);
    solver.freeAllButResult();// deallocate memory before creating a large array.
    double statePairScores[] = new double[incompatiblePairs.length];
    // now fill in the scores in the array.
    for(int i=0;i<incompatiblePairs.length;++i)
      if (incompatiblePairs[i] >=0) statePairScores[i]=solver.j_x[incompatiblePairs[i]];
      else statePairScores[i]=incompatiblePairs[i];// PAIR_INCOMPATIBLE
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

    GDLearnerGraph ndGraph = new GDLearnerGraph(buildLearnerGraph("A-a->B-a->B-b->A / B-c->C / E-a->F-a->F-d->F-b->E-c->F""dumpEquations",config,null),LearnerGraphND.ignoreRejectStates, false);
    final int [] incompatiblePairs = new int[ndGraph.getPairNumber()];
    final int pairsNumber = incompatiblePairs.length;
    for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=i;// emulate the behaviour or non-public part for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;final int pairsNumber = ndGraph.findIncompatiblePairs(incompatiblePairs,1);

    LSolver solver = ndGraph.buildMatrix_internal(incompatiblePairs, pairsNumber, 1,null);

    System.out.println(ndGraph.dumpEquations(solver, incompatiblePairs, null).toString())}
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

   * Since it messes up the configuration of the graph, it has to be run at the end of every test method rather than multiple times.
   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(threadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.

    // Now check consistency.
    gr.config.setAttenuationK_testOnly(1);DoubleMatrix2D Ax1 = ndGraph.buildMatrix(threadNumber).toDoubleMatrix2D();
    gr.config.setAttenuationK(0);DoubleMatrix2D Ax0 = ndGraph.buildMatrix(threadNumber).toDoubleMatrix2D();
    DoubleMatrix1D one = DoubleFactory1D.dense.make(Ax1.rows(), 1), a=DoubleFactory1D.dense.make(Ax.rows(), 0);
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

  public final void testDumpEquations1()
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(buildLearnerGraph("A-a->B-a->B-b->A""testBuildMatrix1",config,converter),LearnerGraphND.ignoreRejectStates, false);
    final int [] incompatiblePairs = new int[ndGraph.getPairNumber()];for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;
    final int pairsNumber = ndGraph.findIncompatiblePairs(incompatiblePairs,threadNumber);
    LSolver solver = ndGraph.buildMatrix_internal(incompatiblePairs, pairsNumber, threadNumber,null);

    String outcome = ndGraph.dumpEquations(solver, incompatiblePairs, null).toString();
    Assert.assertEquals("2.0([A,A]:[A,A]) + -"+k+"([A,A]:[B,B]) = 1.0\n"+
        "4.0([B,A]:[B,A]) + -"+k+"([B,A]:[B,B]) = 1.0\n"+
        "-"+k+"([B,B]:[A,A]) + "+(4-k)+"([B,B]:[B,B]) = 2.0\n",outcome);
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

  {
    LearnerGraph graph = buildLearnerGraph("A-a->B-a->B-b->A""testBuildMatrix1",config,converter);
    GDLearnerGraph ndGraph = new GDLearnerGraph(graph,LearnerGraphND.ignoreRejectStates, false);
    final int [] incompatiblePairs = new int[ndGraph.getPairNumber()];for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;
    final int pairsNumber = ndGraph.findIncompatiblePairs(incompatiblePairs,threadNumber);
    LSolver solver = ndGraph.buildMatrix_internal(incompatiblePairs, pairsNumber, threadNumber,null);
    Map<CmpVertex,CmpVertex> newToOrig = new TreeMap<CmpVertex,CmpVertex>();
    String P67="P67",P99="B";
    newToOrig.put(graph.findVertex("A"),AbstractLearnerGraph.generateNewCmpVertex(VertexID.parseID(P67), graph.config));
    String outcome = ndGraph.dumpEquations(solver, incompatiblePairs, newToOrig).toString();
    Assert.assertEquals("2.0(["+P67+","+P67+"]:["+P67+","+P67+"]) + -"+k+"(["+P67+","+P67+"]:["+P99+","+P99+"]) = 1.0\n"+
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

  {
    LearnerGraph graph = buildLearnerGraph("A-a->B-a->B-b->A""testBuildMatrix1",config,converter);
    GDLearnerGraph ndGraph = new GDLearnerGraph(graph,LearnerGraphND.ignoreRejectStates, false);
    final int [] incompatiblePairs = new int[ndGraph.getPairNumber()];for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;
    final int pairsNumber = ndGraph.findIncompatiblePairs(incompatiblePairs,threadNumber);
    LSolver solver = ndGraph.buildMatrix_internal(incompatiblePairs, pairsNumber, threadNumber,null);
    Map<CmpVertex,CmpVertex> newToOrig = new TreeMap<CmpVertex,CmpVertex>();
    String P67="P67",P99="P99";
    newToOrig.put(graph.findVertex("A"),AbstractLearnerGraph.generateNewCmpVertex(VertexID.parseID(P67), graph.config));
    newToOrig.put(graph.findVertex("B"),AbstractLearnerGraph.generateNewCmpVertex(VertexID.parseID(P99), graph.config));
    String outcome = ndGraph.dumpEquations(solver, incompatiblePairs, newToOrig).toString();
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

        "\nB-b-#G\n","TestComputeStateCompatibility_checking_filtering2",config,converter);
    StatesToConsider filter = TestLearnerGraphND.createInstanceOfFilter(filterClass, gr);
    double score_CC=1./2,score_BB=(2+score_CC*k)/4, score_AA=(1+k*score_BB)/2;
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreNone, false);
      LSolver solver = ndGraph.buildMatrix(threadNumber);
      DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
      Assert.assertEquals(6,Ax.columns());
    }
    Set<PairScore> pairsSet = addAllPermutations(gr.pairscores.chooseStatePairs(PAIR_INCOMPATIBLE*2,10,threadNumber,null,filter, new NonRandomRandom()));
    Set<PairScore> exp = addAllPermutations(Arrays.asList(new PairScore[]{
        new PairScore(gr.findVertex("A"),gr.findVertex("A"),(int)(10*score_AA),1),
 
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

      // Now the system of equations will be built and solved. The only exception is where
      // argConfig.getGdScoreComputation() == GDScoreComputationEnum.GD_DIRECT in which case
      // the solver returned will be a dummy with b[] part copied to the x one.
      {
        LSolver solverForward = forward.buildMatrix_internal(pairScores, numberOfPairs, ThreadNumber,ddrh);
        JConsole_Diagnostics.getDiagnostics().setStatus("finished building matrix forward "+DateFormat.getTimeInstance().format(new Date()));
        forward.stateToCorrespondingGraph = null;// deallocate memory
        //System.out.println(forward.dumpEquations(solverForward, pairScores, newBToOrig));
        solverForward.solve(threads);
        solverForward.freeAllButResult();// deallocate memory before creating a large array.
        scoresForward = solverForward.j_x;
      }

      JConsole_Diagnostics.getDiagnostics().setStatus("started building matrix inverse "+DateFormat.getTimeInstance().format(new Date()));
      {
        LSolver solverInverse = inverse.buildMatrix_internal(pairScores, numberOfPairs, ThreadNumber,ddrh);
        //System.out.println(inverse.dumpEquations(solverInverse, pairScores, newBToOrig));
        JConsole_Diagnostics.getDiagnostics().setStatus("finished building matrix inverse "+DateFormat.getTimeInstance().format(new Date()));
        inverse.stateToCorrespondingGraph = null;// deallocate memory
        solverInverse.solve(threads);
        solverInverse.freeAllButResult();// deallocate memory before creating a large array.
        scoresInverse = solverInverse.j_x;
      }
      JConsole_Diagnostics.getDiagnostics().setStatus("finished with the inverse solver"+DateFormat.getTimeInstance().format(new Date()));
    }
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

    GDLearnerGraph ndGraph = new GDLearnerGraph(buildLearnerGraph("A-a->B-a->B-b->A / B-c->C / E-a->F-a->F-d->F-b->E-c->F""dumpEquations",config),LearnerGraphND.ignoreRejectStates, false);
    final int [] incompatiblePairs = new int[ndGraph.getPairNumber()];
    final int pairsNumber = incompatiblePairs.length;
    for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=i;// emulate the behaviour or non-public part for(int i=0;i<incompatiblePairs.length;++i) incompatiblePairs[i]=PAIR_OK;final int pairsNumber = ndGraph.findIncompatiblePairs(incompatiblePairs,1);

    LSolver solver = ndGraph.buildMatrix_internal(incompatiblePairs, pairsNumber, 1,null);

    System.out.println(ndGraph.dumpEquations(solver, incompatiblePairs, null).toString())}
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver

   * Since it messes up the configuration of the graph, it has to be run at the end of every test method rather than multiple times.
   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(threadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.

    // Now check consistency.
    gr.config.setAttenuationK_testOnly(1);DoubleMatrix2D Ax1 = ndGraph.buildMatrix(threadNumber).toDoubleMatrix2D();
    gr.config.setAttenuationK(0);DoubleMatrix2D Ax0 = ndGraph.buildMatrix(threadNumber).toDoubleMatrix2D();
    DoubleMatrix1D one = DoubleFactory1D.dense.make(Ax1.rows(), 1), a=DoubleFactory1D.dense.make(Ax.rows(), 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.