1: package com.aimms.aimmssdk.examples.basic; 2: 3: import com.aimms.aimmssdk.AIMMS; 4: import com.aimms.aimmssdk.AimmsException; 5: import com.aimms.aimmssdk.ISession; 6: import org.slf4j.Logger; 7: import org.slf4j.LoggerFactory; 8: 9: public class Main { 10: 11: static private Logger logger = LoggerFactory.getLogger(Main.class); 12: 13: /** 14: * @param args the command line arguments 15: */ 16: public static void main(String[] args) { 17: if (args.length != 2) { 18: logger.error("Invalid number of arguments. usage: <location of AIMMS> <location of project>"); 19: return; 20: } 21: 22: ISession session = null; 23: 24: try { 25: session = AIMMS.openSession(args[0], args[1]); 26: if (session == null) { 27: return; 28: } 29: 30: Basic.setParameters(session); 31: 32: Basic.runMainExecution(session); 33: 34: Basic.retrieveVariables(session); 35: 36: } catch (AimmsException ae) { 37: logger.error("main: AIMMS exception:", ae); 38: } catch (Exception e) { 39: logger.error("main: exception:", e); 40: } finally { 41: if (session != null) { 42: logger.info("closing project"); 43: session.clearBuffers(); // discards all buffered modifications, without this call close is slower and may throw. 44: session.close(); 45: } 46: } 47: } 48: }