Package org.xilaew.jampl

Examples of org.xilaew.jampl.CLI


    }
    return null;
  }

  private boolean isAMPLinstalled() {
    CLI cli = AmplFactory.createCLI();
    if (cli != null)
      return true;
    return false;
  }
View Full Code Here


import org.xilaew.jampl.CLI;

public class AmplCliTest {

  public static void main(String[] args) {
    CLI cli = AmplFactory.createCLI();
    // Thread errorThread = new Thread() {
    // byte[] buff = new byte[100];
    //
    // public void run() {
    // while (true) {
    // try {
    // cli.getErrorStream().read(buff);
    // } catch (IOException e) {
    // // TODO Auto-generated catch block
    // e.printStackTrace();
    // }
    // System.err.println(buff);
    // }
    // };
    // };
    // errorThread.start();
    cli.sendCommand("option solver ilogcp;");
    cli.sendCommand("model output/assignment.mod;");
    cli.sendCommand("data output/assignment0.dat;");
    cli.sendCommand("solve;");
    cli.sendCommand("show;");
    cli.sendCommand("display a, return, x;");
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
    try {
      while (cli.getErrorStream().available() > 0) {
        System.err.print((char) cli.getErrorStream().read());
      }
      String s;
      while ((s = cli.readLine()) != null) {
        System.out.println(s);
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.xilaew.jampl.CLI

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.