Package hu.u_szeged.nbo.server.plugins

Source Code of hu.u_szeged.nbo.server.plugins.SimpleMPSSolver

package hu.u_szeged.nbo.server.plugins;

import hu.u_szeged.nbo.server.NBOServer;
import hu.u_szeged.nbo.server.User;
import hu.u_szeged.nbo.server.jni.JLPClass;

import java.util.HashMap;

public class SimpleMPSSolver extends NBOPlugin {
  private static final String subDirectoryName = "lp";
 
  public SimpleMPSSolver(User user, String problemName, HashMap<String, String> inputFiles) {
    super(user, problemName,inputFiles, subDirectoryName);
  }
 
  public void run() {

    this.pluginLogger.info("The server began to compute the "+
        user.getUserName()+"'s "+ task+" with SimpleMPSSolver ...");
    NBOServer.log("The server began to compute the "+
        user.getUserName()+"'s "+ task+" with SimpleMPSSolver ...", 1);
   
    String result = "";
    String log = "";
    JLPClass lp = new JLPClass();
    lp.initCppSide();

    lp.setLogLevel(4);
    lp.setInputSource(1);
    lp.setInputMPSFileName(task);

    lp.solve();

      log += lp.getMessages();
     
      for (int i = 0; i < lp.getNumberColumns(); i++) {
        result += i + ". variable: " + lp.getSolution(i) + "\n";
      }
    System.out.println("Result: "+result);
      lp.cleanUpCppSide();
  /*  try {
      user.getNewResults().put(this.problemName+".mps", result);
      user.getLogs().put(this.problemName+".mps", log);
     
      PrintWriter pw = new PrintWriter(new FileWriter(this.pathOfTask+"/"+problemName+".out"));

      pw.print(result);
      pw.close();
     
      this.pluginLogger.info(log);
     
      this.pluginLogger.info("The server finished computing "+
          user.getUserName()+"'s "+ task+" with SimpleMPSSolver ...");
      NBOServer.log("The server finished computing "+
          user.getUserName()+"'s "+ task+" with SimpleMPSSolver ...", 1);
     
    } catch(Exception e) {
      this.pluginLogger.warning(e.toString());
      NBOServer.log(e.toString(), 2);
    } finally {
      this.fileHandler.close();
    }*/
  }
TOP

Related Classes of hu.u_szeged.nbo.server.plugins.SimpleMPSSolver

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.