## # Copyright : MOSEK ApS # # File : rmt.py # # Purpose : Template for use with solve.mosek.com ## from mosek.fusion import * import sys with Model() as M: # SETUP THE OPTIMIZATION PROBLEM HERE # A simple test problem x = M.variable('x', 3, Domain.greaterThan(0.0)) M.constraint("lc", Expr.dot([1.0, 1.0, 2.0], x), Domain.equalsTo(1.0)) M.objective("obj", ObjectiveSense.Minimize, Expr.sum(x)) # END PROBLEM SETUP # Attach log handler M.setLogHandler(sys.stdout) # Solve the problem remotely try: M.optserverHost("http://solve.mosek.com:30080") M.solve() print("Problem status: {0}".format(M.getProblemStatus())) # Continue to fetch and use the solution # ... except OptimizeError as e: print("Optimization error: {0}".format(e.toString()))