25.11.2015 Views

The MOSEK Python optimizer API manual Version 7.0 (Revision 141)

Optimizer API for Python - Documentation - Mosek

Optimizer API for Python - Documentation - Mosek

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.11. SOLUTION ANALYSIS 67<br />

151 # Put new values in the A matrix<br />

152<br />

153 arowsub = array([0, 1, 2, 3 ])<br />

154 arowval = array([1.0, 2.0, 1.0, 1.0])<br />

155<br />

156 task.putarow(task.getnumcon()-1, # row index<br />

157 arowsub,<br />

158 arowval)<br />

5.11 Solution analysis<br />

5.11.1 Retrieving solution quality information with the <strong>API</strong><br />

Information about the solution quality may be retrieved in the <strong>API</strong> with the help of the following<br />

functions:<br />

• Task.getsolutioninfo: Obtains information about objective values and the solution violations<br />

of the constraints.<br />

• Task.analyzesolution: Print additional information about the solution, e.g basis condition<br />

number and optionally a list of violated constraints.<br />

• Task.getpviolcon, Task.getpviolvar, Task.getpviolbarvar,Task.getpviolcones, Task.getdviolcon,<br />

Task.getdviolvar, Task.getdviolbarvar,Task.getdviolcones. Obtains violation of the individual<br />

constraints.<br />

5.12 Efficiency considerations<br />

Although <strong>MOSEK</strong> is implemented to handle memory efficiently, the user may have valuable knowledge<br />

about a problem, which could be used to improve the performance of <strong>MOSEK</strong> This section discusses<br />

some tricks and general advice that hopefully make <strong>MOSEK</strong> process your problem faster.<br />

Avoiding memory fragmentation:<br />

<strong>MOSEK</strong> stores the optimization problem in internal data structures in the memory. Initially<br />

<strong>MOSEK</strong> will allocate structures of a certain size, and as more items are added to the problem<br />

the structures are reallocated. For large problems the same structures may be reallocated many<br />

times causing memory fragmentation. One way to avoid this is to give <strong>MOSEK</strong> an estimated<br />

size of your problem using the functions:<br />

• Task.putmaxnumvar. Estimate for the number of variables.<br />

• Task.putmaxnumcon. Estimate for the number of constraints.<br />

• Task.putmaxnumcone. Estimate for the number of cones.<br />

• Task.putmaxnumbarvar. Estimate for the number of semidefinite matrix variables.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!