How to use Mosek OptServerLight in Matlab CVX?

126 views
Skip to first unread message

li xing

unread,
Oct 28, 2024, 1:27:41 AM10/28/24
to mosek
Dear Mosek Experts,
     Mosek version10.2
     Matlab version 2022a
     Computer system Windows 11 64bit
     I have read the document of Mosek OptServerLight in the following link.
     However, the document does not provide a detailed process on how to use Mosek OptServerLight in Matlab CVX.

     How to use Mosek OptServerLight in Matlab CVX?

 Hope you can reply me. Thank you so much!
    

li xing

unread,
Oct 28, 2024, 1:27:55 AM10/28/24
to mosek
Hello! I have read the document of  Mosek OptServer in the following link.

Michal Adamaszek

unread,
Oct 28, 2024, 2:39:20 AM10/28/24
to mosek
The client setup is not really described in the server-side manual but in the manuals for the APIs.

For third-party interfaces, for which you cannot access Mosek API directly, remote optimization can be requested by setting the parameter

MSK_SPAR_REMOTE_OPTSERVER_HOST


In particular, in CVX this will be done with

cvx_solver_settings('MSK_SPAR_REMOTE_OPTSERVER_HOST', 'http://host:port')


Best,
Michal

li xing

unread,
Oct 28, 2024, 3:08:19 AM10/28/24
to mosek
Thank you! How can I get  'http://host:port'?

Michal Adamaszek

unread,
Oct 28, 2024, 3:12:40 AM10/28/24
to mosek
It is the URL of the optserverlight, ie. the server and port where you started it https://docs.mosek.com/latest/opt-server/install-and-run.html#starting-optserverlight

Optserverlight should print the port in the first line of the log output, so if you did not provide your own, you can find it there, for example:

 Listen to HTTP at [::]:10413

Best,
Michal



li xing

unread,
Oct 28, 2024, 3:26:39 AM10/28/24
to mosek
According to your suggestion,  firstly, I should  start the OptServerLight.
Then, replace 'port' with the number '10413' in cvx_solver_settings('MSK_SPAR_REMOTE_OPTSERVER_HOST', 'http://host:port')
Finally, run the code directly.

My solver setting of CVX is as follows:
cvx_solver mosek
cvx_solver_settings('MSK_SPAR_REMOTE_OPTSERVER_HOST', 'http://host: 10413  ')
cvx_solver_settings('MSK_IPAR_NUM_THREADS', 1)

However,  the code cannot run correctly. 

Michal Adamaszek

unread,
Oct 28, 2024, 3:32:43 AM10/28/24
to mosek
10413 in my message was just an example. When you start the OptseverLight it will print the port number for you.

You also have to replace the "host" part with the actual host name where the Optserver is running. Otherwise how should Mosek know whom to contact? 

This is supposed to be a proper URL that can be resolved. There are no other rules other than how you normally form URLs. Here are some examples of proper URLs:


Are you sure you want to use the optserverlight? If you are starting it on your own machine then why not use Mosek directly in CVX?

Michal

li xing

unread,
Oct 28, 2024, 3:42:07 AM10/28/24
to mosek
The problem I need to solve has a large scale and requires the use of Mosek servers for computation.
How can I obtain the host on my computer?
When I start  optserverlight, I only see '[OPTSERVER]2024/10/28 15:19:24 Listen to HTTP at [ : : ] : my port number' .


Michal Adamaszek

unread,
Oct 28, 2024, 3:59:49 AM10/28/24
to mosek
I guess you log in to that machine somehow so you have to know its hostname. Maybe the hostname command if it is linux, but you have to be sure it is resolvable from the client. Sorry, but this is not a forum about network management.

If you want to solve huge problems then some command-line options mentioned in the installation manual to allow larger problem sizes may be useful. I would start with small tests though.

Best,
Michal

li xing

unread,
Oct 29, 2024, 1:06:49 AM10/29/24
to mosek
Hello! How can I purchase the URL of the optserverlight?

Michal Adamaszek

unread,
Oct 29, 2024, 1:09:11 AM10/29/24
to mosek
I'm not sure what the question was intended to mean.

We don't provide/sell optserverlight running as a service you can buy access to.

Michal

Erling D. Andersen

unread,
Oct 29, 2024, 2:31:51 AM10/29/24
to mosek
Another option is to rent a powerful server at for instance Amazon AWS and install everything that and then does the runs on it
without using optserverlight.

Reply all
Reply to author
Forward
0 new messages