// // Copyright: MOSEK ApS // // File: rmt.java // // Purpose: Template for use with solve.mosek.com package com.mosek.fusion.examples; import mosek.fusion.*; public class rmt { public static void main(String[] args) throws SolutionError { /* SET UP THE OPTIMIZATION PROBLEM HERE */ // Setup a simple test problem Model M = new Model(); Variable x = M.variable("x", 3, Domain.greaterThan(0.0)); M.constraint("lc", Expr.dot(new double[] {1.0, 1.0, 2.0}, x), Domain.equalsTo(1.0)); M.objective("obj", ObjectiveSense.Minimize, Expr.sum(x)); /* END OF PROBLEM SETUP */ // Attach log handler M.setLogHandler(new java.io.PrintWriter(System.out)); // Solve the problem remotely try { M.optserverHost("http://solve.mosek.com:30080"); M.solve(); System.out.println("Problem status: " + M.getProblemStatus()); // Continue to fetch and use the solution // ... } catch (OptimizeError e) { System.out.println("Optimization failed. Error: " + e.toString()); } M.dispose(); } }