Package com.guokr.simbase.engine

Examples of com.guokr.simbase.engine.SimEngineImpl$AsyncSafeRunner


        defaults.put("basis", basis);
        defaults.put("engine", econf);
        settings.put("defaults", defaults);
        SimConfig config = new SimConfig(settings);

        SimEngineImpl engine = new SimEngineImpl(config.getSub("engine"));

        String[] components = new String[1024];
        for (int i = 0; i < components.length; i++) {
            components[i] = "B" + String.valueOf(i);
        }

        try {
            engine.bmk(TestableCallback.noop(), "base", components);
            Thread.sleep(100);
            engine.vmk(TestableCallback.noop(), "base", "article");
            Thread.sleep(100);
            engine.rmk(TestableCallback.noop(), "article", "article", "jensenshannon");
            Thread.sleep(100);

            VectorSetListener listener = new TestMemListener();
            engine.listen("article", listener);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        start = new Date().getTime();
        for (int i = 1; i <= 10000; i++) {

            float total = 0;
            float[] distr = new float[1024];
            for (int j = 0; j < 1024; j++) {
                distr[j] = (float) Math.random();
                total += distr[j];
            }
            for (int j = 0; j < 1024; j++) {
                distr[j] = distr[j] / total;
            }

            engine.iadd(TestableCallback.noop(), "article", i, Basis.sparsify(4096, distr));

        }
    }
View Full Code Here


        defaults.put("basis", basis);
        defaults.put("engine", econf);
        settings.put("defaults", defaults);
        SimConfig config = new SimConfig(settings);

        SimEngineImpl engine = new SimEngineImpl(config.getSub("engine"));

        String[] components = new String[1024];
        for (int i = 0; i < components.length; i++) {
            components[i] = "B" + String.valueOf(i);
        }

        try {
            engine.bmk(TestableCallback.noop(), "base", components);
            Thread.sleep(100);
            engine.vmk(TestableCallback.noop(), "base", "article");
            Thread.sleep(100);
            engine.rmk(TestableCallback.noop(), "article", "article", "cosinesq");
            Thread.sleep(100);

            VectorSetListener listener = new TestMemListener();
            engine.listen("article", listener);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        start = new Date().getTime();
        for (int i = 1; i <= 10000; i++) {

            float total = 0;
            float[] distr = new float[1024];
            for (int j = 0; j < 1024; j++) {
                distr[j] = (float) Math.random();
                total += distr[j];
            }
            for (int j = 0; j < 1024; j++) {
                distr[j] = distr[j] / total;
            }

            engine.iadd(TestableCallback.noop(), "article", i, Basis.sparsify(4096, distr));

        }
    }
View Full Code Here

        defaults.put("basis", basis);
        defaults.put("engine", econf);
        settings.put("defaults", defaults);
        SimConfig config = new SimConfig(settings);

        SimEngineImpl engine = new SimEngineImpl(config.getSub("engine"));

        String[] components = new String[1024];
        for (int i = 0; i < components.length; i++) {
            components[i] = "B" + String.valueOf(i);
        }

        try {
            engine.bmk(TestableCallback.noop(), "base", components);
            Thread.sleep(100);
            engine.vmk(TestableCallback.noop(), "base", "article");
            Thread.sleep(100);
            engine.rmk(TestableCallback.noop(), "article", "article", "cosinesq");
            Thread.sleep(100);

            VectorSetListener listener = new TestMemListener();
            engine.listen("article", listener);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        start = new Date().getTime();
        for (int i = 1; i <= 10000; i++) {

            float total = 0;
            float[] distr = new float[1024];
            for (int j = 0; j < 1024; j++) {
                distr[j] = (float) Math.random();
                total += distr[j];
            }
            for (int j = 0; j < 1024; j++) {
                distr[j] = distr[j] / total;
            }

            engine.vadd(TestableCallback.noop(), "article", i, distr);

        }
    }
View Full Code Here

        defaults.put("basis", basis);
        defaults.put("engine", econf);
        settings.put("defaults", defaults);
        SimConfig config = new SimConfig(settings);

        SimEngineImpl engine = new SimEngineImpl(config.getSub("engine"));

        String[] components = new String[1024];
        for (int i = 0; i < components.length; i++) {
            components[i] = "B" + String.valueOf(i);
        }

        try {
            engine.bmk(TestableCallback.noop(), "base", components);
            Thread.sleep(100);
            engine.vmk(TestableCallback.noop(), "base", "article");
            Thread.sleep(100);
            engine.rmk(TestableCallback.noop(), "article", "article", "jensenshannon");
            Thread.sleep(100);

            VectorSetListener listener = new TestMemListener();
            engine.listen("article", listener);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        start = new Date().getTime();
        for (int i = 1; i <= 10000; i++) {

            float total = 0;
            float[] distr = new float[1024];
            for (int j = 0; j < 1024; j++) {
                distr[j] = (float) Math.random();
                total += distr[j];
            }
            for (int j = 0; j < 1024; j++) {
                distr[j] = distr[j] / total;
            }

            engine.vadd(TestableCallback.noop(), "article", i, distr);

        }
    }
View Full Code Here

public class SimBase {

    private SimServer server;

    public SimBase(SimConfig conf) throws IOException {
        SimEngine engine = new SimEngineImpl(conf.getSub("engine", "engine"));
        SimRegistry registry = new SimRegistry();

        registry.add("ping", new Ping());
        registry.add("info", new Info());
        registry.add("save", new Save());
View Full Code Here

TOP

Related Classes of com.guokr.simbase.engine.SimEngineImpl$AsyncSafeRunner

Copyright © 2018 www.massapicom. 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.