This chapter lists all functionality in the MOSEK Java API.
Functions in the interface grouped by functionality.
Analyzing the problem and associated data.
mosek.Task.analyzeproblem
Analyze the data of a task.
mosek.Task.analyzesolution
Print information related to the quality of the solution.
Reading and writing data files.
mosek.Task.readbranchpriorities
Reads branching priority data from a file.
mosek.Task.readdata
Reads problem data from a file.
mosek.Task.readparamfile
Reads a parameter file.
mosek.Task.readsolution
Reads a solution from a file.
mosek.Task.writebranchpriorities
Writes branching priority data to a file.
mosek.Task.writedata
Writes problem data to a file.
mosek.Task.writeparamfile
Writes all the parameters to a parameter file.
mosek.Task.writesolution
Write a solution to a file.
Obtain or define a solution.
mosek.Task.deletesolution
Undefines a solution and frees the memory it uses.
mosek.Task.getdbi
Obtains the dual bound infeasibility.
mosek.Task.getdcni
Obtains the dual cone infeasibility.
mosek.Task.getdeqi
Optains the dual equation infeasibility.
mosek.Task.getdualobj
Obtains the dual objective value.
mosek.Task.getinti
Obtains the primal equation infeasibility.
mosek.Task.getpbi
Obtains the primal bound infeasibility.
mosek.Task.getpcni
Obtains the primal cone infeasibility.
mosek.Task.getpeqi
Obtains the primal equation infeasibility.
mosek.Task.getprimalobj
Obtains the primal objective value.
mosek.Task.getreducedcosts
Obtains the difference of (slx-sux) for a sequence of variables.
mosek.Task.getsolution
Obtains the complete solution.
mosek.Task.getsolutioni
Obtains the solution for a single constraint or variable.
mosek.Task.getsolutioninf
Obtains information about a solution.
mosek.Task.getsolutionslice
Obtains a slice of the solution.
mosek.Task.getsolutionstatus
Obtains information about the problem and solution statuses.
mosek.Task.getsolutionstatuskeyslice
Obtains a slice of the solution status keys.
mosek.Task.makesolutionstatusunknown
Sets the solution status to unknown.
mosek.Task.optimizersummary
Prints a short summary with optimizer statistics for last optimization.
mosek.Task.putsolution
Inserts a solution.
mosek.Task.putsolutioni
Sets the primal and dual solution information for a single constraint or variable.
mosek.Task.readsolution
Reads a solution from a file.
mosek.Task.solstatostr
Obtains a solution status string.
mosek.Task.solutiondef
Checks whether a solution is defined.
mosek.Task.solutionsummary
Prints a short summary of the current solutions.
mosek.Task.undefsolution
Undefines a solution.
Memory allocation and deallocation.
mosek.Task.checkmem
Checks the memory allocated by the task.
mosek.Task.getmemusage
Obtains information about the amount of memory used by a task.
Input or change problem specification.
mosek.Task.append
Appends a number of variables or constraints to the optimization task.
mosek.Task.appendcone
Appends a new cone constraint to the problem.
mosek.Env.checkoutlicense
Check out a license feature from the license server ahead of time.
mosek.Task.chgbound
Changes the bounds for one constraint or variable.
mosek.Task.commitchanges
Commits all cached problem changes.
mosek.Task.inputdata
Input the linear part of an optimization task in one function call.
mosek.Task.inputdata
Input the linear part of an optimization task in one function call.
mosek.Task.putaij
Changes a single value in the linear coefficient matrix.
mosek.Task.putaijlist
Changes one or more coefficients in the linear constraint matrix.
mosek.Task.putavec
Replaces all elements in one row or column of the linear coefficient matrix.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in the linear constraint matrix by new values.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in the linear constraint matrix by new values.
mosek.Task.putbound
Changes the bound for either one constraint or one variable.
mosek.Task.putboundlist
Changes the bounds of constraints or variables.
mosek.Task.putboundslice
Modifies bounds.
mosek.Task.putcfix
Replaces the fixed term in the objective.
mosek.Task.putcj
Modifies one linear coefficient in the objective.
mosek.Task.putclist
Modifies a part of the linear objective coefficients.
mosek.Task.putcone
Replaces a conic constraint.
mosek.Task.putobjsense
Sets the objective sense.
mosek.Task.putqcon
Replaces all quadratic terms in constraints.
mosek.Task.putqconk
Replaces all quadratic terms in a single constraint.
mosek.Task.putqobj
Replaces all quadratic terms in the objective.
mosek.Task.putqobjij
Replaces one coefficient in the quadratic term in the objective.
mosek.Task.putvartype
Sets the variable type of one variable.
mosek.Task.putvartypelist
Sets the variable type for one or more variables.
Functionality for deleting problem elements such as variables, constraints or cones.
mosek.Task.remove
The function removes a number of constraints or variables.
mosek.Task.removecone
Removes a conic constraint from the problem.
Functionality for adding problem elements such as variables, constraints or cones.
mosek.Task.append
Appends a number of variables or constraints to the optimization task.
mosek.Task.appendcone
Appends a new cone constraint to the problem.
Functionality for inspecting the problem specification (A,Q, bounds, objective e.t.c).
mosek.Task.getaij
Obtains a single coefficient in linear constraint matrix.
mosek.Task.getaslice
Obtains a sequence of rows or columns from the coefficient matrix.
mosek.Task.getaslice
Obtains a sequence of rows or columns from the coefficient matrix.
mosek.Task.getaslicetrip
Obtains a sequence of rows or columns from the coefficient matrix in triplet format.
mosek.Task.getavec
Obtains one row or column of the linear constraint matrix.
mosek.Task.getavecnumnz
Obtains the number of non-zero elements in one row or column of the linear constraint matrix
mosek.Task.getbound
Obtains bound information for one constraint or variable.
mosek.Task.getboundslice
Obtains bounds information for a sequence of variables or constraints.
mosek.Task.getc
Obtains all objective coefficients.
mosek.Task.getcfix
Obtains the fixed term in the objective.
mosek.Task.getcone
Obtains a conic constraint.
mosek.Task.getconeinfo
Obtains information about a conic constraint.
mosek.Task.getcslice
Obtains a sequence of coefficients from the objective.
mosek.Task.getintpntnumthreads
Obtains the number of threads used by the interior-point optimizer.
mosek.Task.getnumanz
Obtains the number of non-zeros in the coefficient matrix.
mosek.Task.getnumanz64
Obtains the number of non-zeros in the coefficient matrix.
mosek.Task.getnumcon
Obtains the number of constraints.
mosek.Task.getnumcone
Obtains the number of cones.
mosek.Task.getnumconemem
Obtains the number of members in a cone.
mosek.Task.getnumintvar
Obtains the number of integer-constrained variables.
mosek.Task.getnumqconknz
Obtains the number of non-zero quadratic terms in a constraint.
mosek.Task.getnumqconknz64
Obtains the number of non-zero quadratic terms in a constraint.
mosek.Task.getnumqobjnz
Obtains the number of non-zero quadratic terms in the objective.
mosek.Task.getnumqobjnz64
Obtains the number of non-zero quadratic terms in the objective.
mosek.Task.getnumvar
Obtains the number of variables.
mosek.Task.getobjsense
Gets the objective sense.
mosek.Task.getprobtype
Obtains the problem type.
mosek.Task.getqconk
Obtains all the quadratic terms in a constraint.
mosek.Task.getqconk64
Obtains all the quadratic terms in a constraint.
mosek.Task.getqobj
Obtains all the quadratic terms in the objective.
mosek.Task.getqobj64
Obtains all the quadratic terms in the objective.
mosek.Task.getqobjij
Obtains one coefficient from the quadratic term of the objective
mosek.Task.getvartype
Gets the variable type of one variable.
mosek.Task.getvartypelist
Obtains the variable type for one or more variables.
Functionality related to conic terms in the problem.
mosek.Task.appendcone
Appends a new cone constraint to the problem.
mosek.Task.getcone
Obtains a conic constraint.
mosek.Task.getconeinfo
Obtains information about a conic constraint.
mosek.Task.getnumcone
Obtains the number of cones.
mosek.Task.putcone
Replaces a conic constraint.
mosek.Task.removecone
Removes a conic constraint from the problem.
Functionality related to changing or inspecting bounds on variables or constraints.
mosek.Task.chgbound
Changes the bounds for one constraint or variable.
mosek.Task.getbound
Obtains bound information for one constraint or variable.
mosek.Task.getboundslice
Obtains bounds information for a sequence of variables or constraints.
mosek.Task.putbound
Changes the bound for either one constraint or one variable.
mosek.Task.putboundlist
Changes the bounds of constraints or variables.
mosek.Task.putboundslice
Modifies bounds.
Output stream functions.
mosek.Env.echointro
Prints an intro to message stream.
mosek.Env.linkfiletostream
Directs all output from a stream to a file.
mosek.Task.linkfiletostream
Directs all output from a task stream to a file.
mosek.Task.optimizersummary
Prints a short summary with optimizer statistics for last optimization.
mosek.Task.readsummary
Prints information about last file read.
mosek.Task.solutionsummary
Prints a short summary of the current solutions.
Change or inspect objective function.
mosek.Task.getc
Obtains all objective coefficients.
mosek.Task.getcfix
Obtains the fixed term in the objective.
mosek.Task.getcslice
Obtains a sequence of coefficients from the objective.
mosek.Task.getdualobj
Obtains the dual objective value.
mosek.Task.getnumqobjnz
Obtains the number of non-zero quadratic terms in the objective.
mosek.Task.getnumqobjnz64
Obtains the number of non-zero quadratic terms in the objective.
mosek.Task.getobjname
Obtains the name assigned to the objective function.
mosek.Task.getobjsense
Gets the objective sense.
mosek.Task.getprimalobj
Obtains the primal objective value.
mosek.Task.getqobj
Obtains all the quadratic terms in the objective.
mosek.Task.getqobj64
Obtains all the quadratic terms in the objective.
mosek.Task.getqobjij
Obtains one coefficient from the quadratic term of the objective
mosek.Task.putcfix
Replaces the fixed term in the objective.
mosek.Task.putcj
Modifies one linear coefficient in the objective.
mosek.Task.putclist
Modifies a part of the linear objective coefficients.
mosek.Task.putobjsense
Sets the objective sense.
mosek.Task.putqobj
Replaces all quadratic terms in the objective.
mosek.Task.putqobjij
Replaces one coefficient in the quadratic term in the objective.
Inspect statistics from the optimizer.
mosek.Task.getdouinf
Obtains a double information item.
mosek.Task.getinfindex
Obtains the index of a named information item.
mosek.Task.getinfmax
Obtains the maximum index of an information of a given type inftype plus 1.
mosek.Task.getinfname
Obtains the name of an information item.
mosek.Task.getintinf
Obtains an integer information item.
mosek.Task.getlintinf
Obtains an integer information item.
Setting and inspecting solver parameters.
mosek.Task.getdouparam
Obtains a double parameter.
mosek.Task.getintparam
Obtains an integer parameter.
mosek.Task.getnumparam
Obtains the number of parameters of a given type.
mosek.Task.getparammax
Obtains the maximum index of a parameter of a given type plus 1.
mosek.Task.getparamname
Obtains the name of a parameter.
mosek.Env.iparvaltosymnam
Obtains the symbolic name corresponding to a value that can be assigned to an integer parameter.
mosek.Task.isdouparname
Checks a double parameter name.
mosek.Task.isintparname
Checks an integer parameter name.
mosek.Task.isstrparname
Checks a string parameter name.
mosek.Task.putdouparam
Sets a double parameter.
mosek.Task.putintparam
Sets an integer parameter.
mosek.Task.putnadouparam
Sets a double parameter.
mosek.Task.putnaintparam
Sets an integer parameter.
mosek.Task.putparam
Modifies the value of parameter.
mosek.Task.putstrparam
Sets a string parameter.
mosek.Task.setdefaults
Resets all parameters values.
Functionality related to naming.
mosek.Task.getconname
Obtains a name of a constraint.
mosek.Task.getname
Obtains the name of a cone, a variable or a constraint.
mosek.Task.getnameindex
Checks whether a name has been assigned and returns the index corresponding to the name.
mosek.Task.getnamelen
Obtains the length of a problem item name.
mosek.Task.getobjname
Obtains the name assigned to the objective function.
mosek.Task.gettaskname64
Obtains the task name.
mosek.Task.getvarname
Obtains a name of a variable.
mosek.Task.putname
Assigns a name to a problem item.
mosek.Task.putobjname
Assigns a new name to the objective.
mosek.Task.puttaskname
Assigns a new name to the task.
Functionality related to preallocating space for problem data.
mosek.Task.getmaxnumanz
Obtains number of preallocated non-zeros in the linear constraint matrix.
mosek.Task.getmaxnumcon
Obtains the number of preallocated constraints in the optimization task.
mosek.Task.getmaxnumcone
Obtains the number of preallocated cones in the optimization task.
mosek.Task.getmaxnumqnz
Obtains the number of preallocated non-zeros for all quadratic terms in objective and constraints.
mosek.Task.getmaxnumvar
Obtains the maximum number variables allowed.
mosek.Task.putmaxnumanz
The function changes the size of the preallocated storage for linear coefficients.
mosek.Task.putmaxnumanz
The function changes the size of the preallocated storage for linear coefficients.
mosek.Task.putmaxnumcon
Sets the number of preallocated constraints in the optimization task.
mosek.Task.putmaxnumcone
Sets the number of preallocated conic constraints in the optimization task.
mosek.Task.putmaxnumqnz
Changes the size of the preallocated storage for quadratic terms.
mosek.Task.putmaxnumqnz
Changes the size of the preallocated storage for quadratic terms.
mosek.Task.putmaxnumvar
Sets the number of preallocated variables in the optimization task.
Functionality related to integer variables.
mosek.Task.getnumintvar
Obtains the number of integer-constrained variables.
mosek.Task.getvarbranchdir
Obtains the branching direction for a variable.
mosek.Task.getvarbranchorder
Obtains the branching priority for a variable.
mosek.Task.getvarbranchpri
Obtains the branching priority for a variable.
mosek.Task.getvartype
Gets the variable type of one variable.
mosek.Task.getvartypelist
Obtains the variable type for one or more variables.
mosek.Task.putvarbranchorder
Assigns a branching priority and direction to a variable.
mosek.Task.putvartype
Sets the variable type of one variable.
mosek.Task.putvartypelist
Sets the variable type for one or more variables.
Functionality related to quadratic terms.
mosek.Task.getqconk
Obtains all the quadratic terms in a constraint.
mosek.Task.getqconk64
Obtains all the quadratic terms in a constraint.
mosek.Task.getqobj
Obtains all the quadratic terms in the objective.
mosek.Task.getqobj64
Obtains all the quadratic terms in the objective.
mosek.Task.getqobjij
Obtains one coefficient from the quadratic term of the objective
mosek.Task.putqcon
Replaces all quadratic terms in constraints.
mosek.Task.putqconk
Replaces all quadratic terms in a single constraint.
mosek.Task.putqobj
Replaces all quadratic terms in the objective.
mosek.Task.putqobjij
Replaces one coefficient in the quadratic term in the objective.
Functions for diagnosing infeasibility.
mosek.Task.getinfeasiblesubproblem
Obtains an infeasible sub problem.
mosek.Task.relaxprimal
Creates a problem that finds the minimal change to the bounds that makes an infeasible problem feasible.
Functions for optimization.
mosek.Task.checkdata
Checks data of the task.
mosek.Task.netoptimize
Optimizes a pure network flow problem.
mosek.Task.optimize
Optimizes the problem.
Functions for network optimization.
mosek.Task.netextraction
Finds embedded network structure.
mosek.Task.netoptimize
Optimizes a pure network flow problem.
Functions for sensitivity analysis.
mosek.Task.dualsensitivity
Performs sensitivity analysis on objective coefficients.
mosek.Task.primalsensitivity
Perform sensitivity analysis on bounds.
mosek.Task.sensitivityreport
Creates a sensitivity report.
Functions for testing data validity.
mosek.Task.checkconvexity
Checks if a quadratic optimization problem is convex.
Functions for solving linear systems with the basis matrix.
mosek.Task.basiscond
Computes conditioning information for the basis matrix.
mosek.Task.initbasissolve
Prepare a task for basis solver.
mosek.Task.solvewithbasis
Solve a linear equation system involving a basis matrix.
Creation and initialization of environment.
mosek.Env.checkinlicense
Check in a license feature from the license server ahead of time.
mosek.Env.init
Initialize a MOSEK environment.
mosek.Env.putlicensedefaults
Set defaults used by the license manager.
Change elements in the coefficient (A) matrix.
mosek.Env.checkoutlicense
Check out a license feature from the license server ahead of time.
mosek.Task.commitchanges
Commits all cached problem changes.
mosek.Task.putaij
Changes a single value in the linear coefficient matrix.
mosek.Task.putaijlist
Changes one or more coefficients in the linear constraint matrix.
mosek.Task.putavec
Replaces all elements in one row or column of the linear coefficient matrix.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in the linear constraint matrix by new values.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in the linear constraint matrix by new values.
system.Exception
This exception is raised is an input or output array was shorter than required.
A Mosek Environment
public Env ()
public Env (String dbgfile)
public void checkinlicense (int feature) throws mosek.Error, mosek.Warning;
Check in a license feature to the license server. By default all licenses consumed by functions using a single environment is kept checked out for the lifetime of the MOSEK environment. This function checks in a given license feature to the license server immidiatly.
If the given license feature is not checked out or is in use by a call to Task.optimizetrm calling this function has no effect.
Please note that returning a license to the license server incurs a small overhead, so frequent calls to this function should be avoided.
public void checkoutlicense (int feature) throws mosek.Error, mosek.Warning;
Check out a license feature from the license server. Normally the required license features will be automatically checked out the first time it is needed by the function Task.optimizetrm. This function can be used to check out one or more features ahead of time.
The license will remain checked out for the lifetime of the MOSEK environment or until the function Env.checkinlicense is called.
If a given feature is already checked out when this function is called, only one feature will be checked out from the license server.
public void echointro (int longver) throws mosek.Error, mosek.Warning;
public void getversion ( int[] major, int[] minor, int[] build, int[] revision) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void init () throws mosek.Error, mosek.Warning;
public void iparvaltosymnam ( int whichparam, int whichvalue, StringBuffer symbolicname) throws mosek.Error, mosek.Warning;
public void linkfiletostream ( int whichstream, String filename, int append) throws mosek.Error, mosek.Warning;
public void putcpudefaults ( int cputype, int sizel1, int sizel2) throws mosek.Error, mosek.Warning;
public void putdllpath (String dllpath) throws mosek.Error, mosek.Warning;
public void putkeepdlls (int keepdlls) throws mosek.Error, mosek.Warning;
public void putlicensedefaults ( String licensefile, int[] licensebuf, int licwait, int licdebug) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void set_Stream ( int whichstream, mosek.Stream stream)
mosek.Exception
This is an exception class representing MOSEK errors.
public Error (int code)
public Error ( int code, String msg)
system.Exception
This is the base class for exceptions based on MOSEK response codes.
public Exception (int code)
mosek.Callback
This is the base class for user-defined progress call-back objects. An object of this type can be attached to a MOSEK task in order to receive frequent calls with a progress indicator during long optimizations. The calls are received by overriding a certain member of this class.
The call-back method is called at the beginning of each iteration in the interior-point optimizer. For the simplex optimizers the parameter Env.iparam.log_sim_freq controls how frequent the call-backs are.
Typically, the user-defined call-back method displays information about the solution process. The call-back function can also be used to terminate the optimization process: If the method returns a non-zero value when called, MOSEK will abort optimization and perform proper cleanup of the task.
It is important that the user-defined call-back function does not modify the optimization task, this will lead to undefined behavior and incorrect results. The only MOSEK functions that can be called safely from within the user-defined call-back function are Task.getdouinf and Task.getintinf which access the task information database. The items in task information database are updated during the optimization process.
public Progress ()
public CType(int) progress (int caller)
mosek.Callback
Base class for stream printer classes which can be attached to MOSEK tasks and environments to intercept output.
public Stream ()
A Mosek Optimization task
public Task ( mosek.Env env, int maxnumcon, int maxnumvar)
public void analyzeproblem (int whichstream) throws mosek.Error, mosek.Warning;
public void analyzesolution ( int whichstream, int whichsol) throws mosek.Error, mosek.Warning;
Print information related to the quality of the solution and other solution statistics.
By default this function prints information about the largest infeasibilites in the solution, the primal (and possibly dual) objective value and the solution status.
Following parameters can be used to configure the printed statistics:
Obtains the primal equation infeasibility.
Optains the dual equation infeasibility.
Obtains the primal bound infeasibility.
Obtains the dual bound infeasibility.
Obtains the dual cone infeasibility.
Obtains the primal cone infeasibility.
Obtains information about a solution.
Obtains information about the problem and solution statuses.
public void append ( int accmode, int num) throws mosek.Error, mosek.Warning;
The function removes a number of constraints or variables.
public void appendcone ( int conetype, double conepar, int[] submem) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Appends a new conic constraint to the problem. Hence, add a constraint
![]() |
to the problem where is a convex cone.
is a subset of the variables which will be specified by the argument submem.
Depending on the value of conetype this function appends a normal (Env.conetype.quad) or rotated quadratic cone (Env.conetype.rquad). Define
![]() |
. Depending on the value of conetype this function appends one of the constraints:
Quadratic cone (Env.conetype.quad) :
![]() |
Rotated quadratic cone (Env.conetype.rquad) :
![]() |
Please note that the sets of variables appearing in different conic constraints must be disjoint.
For an explained code example see Section 5.4.
public void basiscond ( double[] nrmbasis, double[] nrminvbasis) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
If a basic solution is available and it defines a nonsingular basis, then this function computes the 1-norm estimate of the basis matrix and an 1-norm estimate for the inverse of the basis matrix. The 1-norm estimates are computed using the method outlined in [9, pp. 388-391].
By defintion the 1-norm condition number of a matrix B is defined as
![]() |
Moreover, the larger the condition number is the harder it is to solve linear equation systems involving B. Given estimates for and
it is also possible to estimate
.
public void checkconvexity () throws mosek.Error, mosek.Warning;
This function checks if a quadratic optimization problem is convex. The amount of checking is controlled by Env.iparam.check_convexity.
The function throws an exception if the problem is not convex.
public void checkdata () throws mosek.Error, mosek.Warning;
public void checkmem ( String file, int line) throws mosek.Error, mosek.Warning;
public void chgbound ( int accmode, int i, int lower, int finite, double value) throws mosek.Error, mosek.Warning;
Changes a bound for one constraint or variable. If accmode equals Env.accmode.con, a constraint bound is changed, otherwise a variable bound is changed.
If lower is non-zero, then the lower bound is changed as follows:
![]() |
Otherwise if lower is zero, then
![]() |
Please note that this function automatically updates the bound key for bound, in particular, if the lower and upper bounds are identical, the bound key is changed to fixed.
Changes the bound for either one constraint or one variable.
public void commitchanges () throws mosek.Error, mosek.Warning;
public void deletesolution (int whichsol) throws mosek.Error, mosek.Warning;
public void dualsensitivity ( int[] subj, double[] leftpricej, double[] rightpricej, double[] leftrangej, double[] rightrangej) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Calculates sensitivity information for objective coefficients. The indexes of the coefficients to analyze are
![]() |
The results are returned so that e.g is the left shadow price of the objective coefficient with index
.
The type of sensitivity analysis to perform (basis or optimal partition) is controlled by the parameter Env.iparam.sensitivity_type.
For an example, please see Section 12.5.
Perform sensitivity analysis on bounds.
Creates a sensitivity report.
public double getaij ( int i, int j) throws mosek.Error, mosek.Warning;
public void getaij ( int i, int j, double[] aij) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getapiecenumnz ( int firsti, int lasti, int firstj, int lastj) throws mosek.Error, mosek.Warning;
public void getapiecenumnz ( int firsti, int lasti, int firstj, int lastj, int[] numnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the number non-zeros in a rectangular piece of A, i.e. the number
![]() |
where means the number of elements in the set
.
This function is not an efficient way to obtain the number of non-zeros in one row or column. In that case use the function Task.getavecnumnz.
Obtains the number of non-zero elements in one row or column of the linear constraint matrix
Obtains the number of non-zeros in a row or column slice of the coefficient matrix.
public void getaslice ( int accmode, int first, int last, int[] surp, int[] ptrb, int[] ptre, int[] sub, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the number of non-zeros in a row or column slice of the coefficient matrix.
public void getaslice ( int accmode, int first, int last, long[] surp, long[] ptrb, long[] ptre, int[] sub, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the number of non-zeros in a slice of rows or columns of the coefficient matrix.
public void getaslicenumnz ( int accmode, int first, int last, int[] numnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getaslicenumnz ( int accmode, int first, int last) throws mosek.Error, mosek.Warning;
public void getaslicenumnz ( int accmode, int first, int last, long[] numnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getaslicetrip ( int accmode, int first, int last, int[] surp, int[] subi, int[] subj, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the number of non-zeros in a row or column slice of the coefficient matrix.
public void getavec ( int accmode, int i, int[] nzi, int[] subi, double[] vali) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains one row or column of A in a sparse format. If accmode equals Env.accmode.con a row is returned and hence:
![]() |
If accmode equals Env.accmode.var a column is returned, that is:
![]() |
public int getavecnumnz ( int accmode, int i) throws mosek.Error, mosek.Warning;
public void getavecnumnz ( int accmode, int i, int[] nzj) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getbound ( int accmode, int i, int[] bk, double[] bl, double[] bu) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getboundslice ( int accmode, int first, int last, int[] bk, double[] bl, double[] bu) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getc (double[] c) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public double getcfix () throws mosek.Error, mosek.Warning;
public void getcfix (double[] cfix) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getcone ( int k, int[] conetype, double[] conepar, int[] nummem, int[] submem) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getconeinfo ( int k, int[] conetype, double[] conepar, int[] nummem) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getconname ( int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public void getconname ( int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public void getcslice ( int first, int last, double[] c) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getdbi ( int whichsol, int accmode, int[] sub, double[] dbi) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Dual bound infeasibility. If acmode is Env.accmode.con then
![]() |
(14.9.1) |
else
![]() |
(14.9.2) |
Obtains information about a solution.
public void getdcni ( int whichsol, int[] sub, double[] dcni) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains information about a solution.
public void getdeqi ( int whichsol, int accmode, int[] sub, double[] deqi, int normalize) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Optains the dual equation infeasibility. If acmode is Env.accmode.con then
![]() |
(14.9.3) |
If acmode is Env.accmode.var then
![]() |
(14.9.4) |
Obtains information about a solution.
public double getdouinf (int whichdinf) throws mosek.Error, mosek.Warning;
public void getdouinf ( int whichdinf, double[] dvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public double getdouparam (int param) throws mosek.Error, mosek.Warning;
public void getdouparam ( int param, double[] parvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getdualobj ( int whichsol, double[] dualobj) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public Task getinfeasiblesubproblem (int whichsol) throws mosek.Error, mosek.Warning;
public void getinfeasiblesubproblem ( int whichsol, TaskContainer inftask) throws mosek.Error, mosek.Warning;
Creates a problem that finds the minimal change to the bounds that makes an infeasible problem feasible.
public void getinfindex ( int inftype, String infname, int[] infindex) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getinfmax ( int inftype, int[] infmax) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getinfname ( int inftype, int whichinf, StringBuffer infname) throws mosek.Error, mosek.Warning;
public void getinti ( int whichsol, int[] sub, double[] inti) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the primal equation infeasibility.
![]() |
(14.9.5) |
Obtains information about a solution.
public int getintinf (int whichiinf) throws mosek.Error, mosek.Warning;
public void getintinf ( int whichiinf, int[] ivalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getintparam (int param) throws mosek.Error, mosek.Warning;
public void getintparam ( int param, int[] parvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getintpntnumthreads () throws mosek.Error, mosek.Warning;
public void getintpntnumthreads (int[] numthreads) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getlintinf (int whichliinf) throws mosek.Error, mosek.Warning;
public void getlintinf ( int whichliinf, long[] ivalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getmaxnumanz () throws mosek.Error, mosek.Warning;
public void getmaxnumanz (long[] maxnumanz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumcon (int[] maxnumcon) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumcone (int[] maxnumcone) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumqnz (long[] maxnumqnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumvar (int[] maxnumvar) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmemusage ( long[] meminuse, long[] maxmemuse) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getname ( int whichitem, int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public void getname ( int whichitem, int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public int getnameindex ( int whichitem, String name, int[] asgn) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnameindex ( int whichitem, String name, int[] asgn, int[] index) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getnamelen ( int whichitem, int i) throws mosek.Error, mosek.Warning;
public void getnamelen ( int whichitem, int i, long[] len) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumanz () throws mosek.Error, mosek.Warning;
public void getnumanz (int[] numanz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getnumanz64 () throws mosek.Error, mosek.Warning;
public void getnumanz64 (long[] numanz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumcon () throws mosek.Error, mosek.Warning;
public void getnumcon (int[] numcon) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumcone () throws mosek.Error, mosek.Warning;
public void getnumcone (int[] numcone) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumconemem ( int k, int[] nummem) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumintvar (int[] numintvar) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumparam ( int partype, int[] numparam) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumqconknz (int k) throws mosek.Error, mosek.Warning;
public void getnumqconknz ( int k, int[] numqcnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getnumqconknz64 (int k) throws mosek.Error, mosek.Warning;
public void getnumqconknz64 ( int k, long[] numqcnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumqobjnz () throws mosek.Error, mosek.Warning;
public void getnumqobjnz (int[] numqonz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getnumqobjnz64 () throws mosek.Error, mosek.Warning;
public void getnumqobjnz64 (long[] numqonz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getnumvar () throws mosek.Error, mosek.Warning;
public void getnumvar (int[] numvar) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getobjname ( long[] len, StringBuffer objname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getobjname ( long[] len, StringBuffer objname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getobjsense () throws mosek.Error, mosek.Warning;
public void getobjsense (int[] sense) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Sets the objective sense.
public void getparammax ( int partype, int[] parammax) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getparamname ( int partype, int param, StringBuffer parname) throws mosek.Error, mosek.Warning;
public void getpbi ( int whichsol, int accmode, int[] sub, double[] pbi, int normalize) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the primal bound infeasibility. If acmode is Env.accmode.con then
![]() |
(14.9.6) |
If acmode is Env.accmode.var then
![]() |
(14.9.7) |
Obtains information about a solution.
public void getpcni ( int whichsol, int[] sub, double[] pcni) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains information about a solution.
public void getpeqi ( int whichsol, int[] sub, double[] peqi, int normalize) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the primal equation infeasibility.
![]() |
(14.9.8) |
Obtains information about a solution.
public double getprimalobj (int whichsol) throws mosek.Error, mosek.Warning;
public void getprimalobj ( int whichsol, double[] primalobj) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getprobtype () throws mosek.Error, mosek.Warning;
public void getprobtype (int[] probtype) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getqconk ( int k, int[] qcsurp, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getqconk ( int k, int[] qcsurp, int[] numqcnz, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public long getqconk64 ( int k, long[] qcsurp, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getqconk64 ( int k, long[] qcsurp, long[] numqcnz, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getqobj ( int[] qosurp, int[] numqonz, int[] qosubi, int[] qosubj, double[] qoval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getqobj64 ( long[] qosurp, long[] numqonz, int[] qosubi, int[] qosubj, double[] qoval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getqobjij ( int i, int j, double[] qoij) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getsolution ( int whichsol, int[] prosta, int[] solsta, int[] skc, int[] skx, int[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the complete solution.
Consider the case of linear programming. The primal problem is given by
![]() |
(14.9.10) |
and the corresponding dual problem is
![]() |
(14.9.11) |
In this case the mapping between variables and arguments to the function is as follows:
xx: Corresponds to variable x.
y: Corresponds to variable y.
slc: Corresponds to variable .
suc: Corresponds to variable .
slx: Corresponds to variable .
sux: Corresponds to variable .
xc: Corresponds to Ax.
The meaning of the values returned by this function depend on the solution status returned in the argument solsta. The most important possible values of solsta are:
Env.solsta.optimal An optimal solution satisfying the optimality criteria for continuous problems is returned.
Env.solsta.integer_optimal An optimal solution satisfying the optimality criteria for integer problems is returned.
Env.solsta.prim_feas A solution satisfying the feasibility criteria.
Env.solsta.prim_infeas_cer A primal certificate of infeasibility is returned.
Env.solsta.dual_infeas_cer A dual certificate of infeasibility is returned.
Obtains the solution for a single constraint or variable.
Obtains a slice of the solution.
public void getsolutioni ( int accmode, int i, int whichsol, int[] sk, double[] x, double[] sl, double[] su, double[] sn) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the complete solution.
Obtains a slice of the solution.
public void getsolutioninf ( int whichsol, int[] prosta, int[] solsta, double[] primalobj, double[] maxpbi, double[] maxpcni, double[] maxpeqi, double[] maxinti, double[] dualobj, double[] maxdbi, double[] maxdcni, double[] maxdeqi) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Value of the primal objective.
![]() |
(14.9.12) |
Maximum infeasibility in primal bounds on variables.
![]() |
(14.9.13) |
Maximum infeasibility in primal equality constraints.
![]() |
(14.9.14) |
Maximum infeasibility in integer constraints.
![]() |
(14.9.15) |
Value of the dual objective.
![]() |
(14.9.16) |
Maximum infeasibility in bounds on dual variables.
![]() |
(14.9.17) |
Maximum infeasibility in the dual equality constraints.
![]() |
(14.9.18) |
Obtains information about the quality of a solution. Part of the following documentation is restricted to the linear case, it should be clear how to extend to other problem classes.
When optimizing MOSEK solves a reformulated problem with only equality constraints.
![]() |
(14.9.19) |
where
![]() |
and the corresponding dual problem is
![]() |
(14.9.20) |
The values returned by this function refers to these problems.
Please note that this function computes the objective value and other values every time it is called. Hence, for efficiency reasons this function should not be used too frequently.
If only the problem status or the solution status is required then use Task.getsolutionstatus instead.
Obtains the primal equation infeasibility.
Optains the dual equation infeasibility.
Obtains the primal bound infeasibility.
Obtains the dual bound infeasibility.
Obtains the dual cone infeasibility.
Obtains the primal cone infeasibility.
Print information related to the quality of the solution.
Obtains information about the problem and solution statuses.
public void getsolutionslice ( int whichsol, int solitem, int first, int last, double[] values) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains a slice of the solution.
Consider the case of linear programming. The primal problem is given by
![]() |
(14.9.21) |
and the corresponding dual problem is
![]() |
(14.9.22) |
The solitem argument determines which part of the solution is returned:
Env.solitem.xx: The variable values return x.
Env.solitem.y: The variable values return y.
Env.solitem.slc: The variable values return .
Env.solitem.suc: The variable values return .
Env.solitem.slx: The variable values return .
Env.solitem.sux: The variable values return .
A conic optimization problem has the same primal variables as in the linear case. Recall that the dual of a conic optimization problem is given by:
![]() |
(14.9.23) |
This introduces one additional dual variable . This variable can be acceded by selecting solitem as Env.solitem.snx.
The meaning of the values returned by this function also depends on the solution status which can be obtained with Task.getsolutionstatus. Depending on the solution status value will be:
Env.solsta.optimal A part of the optimal solution satisfying the optimality criteria for continuous problems.
Env.solsta.integer_optimal A part of the optimal solution satisfying the optimality criteria for integer problems.
Env.solsta.prim_feas A part of the solution satisfying the feasibility criteria.
Env.solsta.prim_infeas_cer A part of the primal certificate of infeasibility.
Env.solsta.dual_infeas_cer A part of the dual certificate of infeasibility.
Obtains the complete solution.
Obtains the solution for a single constraint or variable.
public void getsolutionstatus ( int whichsol, int[] prosta, int[] solsta) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getsolutionstatuskeyslice ( int accmode, int whichsol, int first, int last, int[] sk) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the complete solution.
Obtains the solution for a single constraint or variable.
public void gettaskname64 ( long[] len, StringBuffer taskname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void gettaskname64 ( long[] len, StringBuffer taskname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getvarbranchdir (int j) throws mosek.Error, mosek.Warning;
public void getvarbranchdir ( int j, int[] direction) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getvarbranchorder ( int j, int[] priority, int[] direction) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public int getvarbranchpri (int j) throws mosek.Error, mosek.Warning;
public void getvarbranchpri ( int j, int[] priority) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getvarname ( int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public void getvarname ( int i, StringBuffer name) throws mosek.Error, mosek.Warning;
public int getvartype (int j) throws mosek.Error, mosek.Warning;
public void getvartype ( int j, int[] vartype) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getvartypelist ( int[] subj, int[] vartype) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the variable type of one or more variables.
Upon return vartype[k] is the variable type of variable subj[k].
public void initbasissolve (int[] basis) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
The array of basis indexes to use.
The array is interpreted as follows: If , then
is in the basis at position i, otherwise
is in the basis at position i.
Prepare a task for use with the Task.solvewithbasis function.
This function should be called
If the basis is singular i.e. not invertible, then
the exception Env.rescode.err_basis_singular is generated.
public void inputdata ( int maxnumcon, int maxnumvar, double[] c, double cfix, int[] aptrb, int[] aptre, int[] asub, double[] aval, int[] bkc, double[] blc, double[] buc, int[] bkx, double[] blx, double[] bux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Input the linear part of an optimization problem.
The non-zeros of A are inputted column-wise in the format described in Section 5.8.3.2.
For an explained code example see Section 5.2 and Section 5.8.3.
public void inputdata ( int maxnumcon, int maxnumvar, double[] c, double cfix, long[] aptrb, long[] aptre, int[] asub, double[] aval, int[] bkc, double[] blc, double[] buc, int[] bkx, double[] blx, double[] bux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Input the linear part of an optimization problem.
The non-zeros of A are inputted column-wise in the format described in Section 5.8.3.2.
For an explained code example see Section 5.2 and Section 5.8.3.
public void isdouparname ( String parname, int[] param) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void isintparname ( String parname, int[] param) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void isstrparname ( String parname, int[] param) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void linkfiletostream ( int whichstream, String filename, int append) throws mosek.Error, mosek.Warning;
public void makesolutionstatusunknown (int whichsol) throws mosek.Error, mosek.Warning;
public void netextraction ( int[] numcon, int[] numvar, int[] netcon, int[] netvar, double[] scalcon, double[] scalvar, double[] cx, int[] bkc, double[] blc, double[] buc, int[] bkx, double[] blx, double[] bux, int[] from, int[] to) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Uses a heuristic to find an embedded network in the problem specified in task. The returned network is a pure network flow problem and can be solved with a direct call to the network optimizer Task.netoptimize.
Each arc a in the network corresponds to a scaled subset of elements in column from the constraint matrix A stored in task. Each node n in the network corresponds to a scaled subset of elements in constraint i=netcon[n] from A. Data structures for network problems is explained in 5.2 and 6.2. The relation between A and the extracted embedded network can be explained as follows:
Please note if a column j=netvar[a] is only represented by one non-zero in the embedded network, then either from[a]=netcon or to[a]=netcon.
Optimizes a pure network flow problem.
public void netoptimize ( double[] cc, double[] cx, int[] bkc, double[] blc, double[] buc, int[] bkx, double[] blx, double[] bux, int[] from, int[] to, int[] prosta, int[] solsta, boolean hotstart, int[] skc, int[] skx, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Finds embedded network structure.
public void optimizersummary (int whichstream) throws mosek.Error, mosek.Warning;
public int optimize () throws mosek.Error, mosek.Warning;
public void optimize (int[] trmcode) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the complete solution.
Obtains the solution for a single constraint or variable.
Obtains information about a solution.
public void primalsensitivity ( int[] subi, int[] marki, int[] subj, int[] markj, double[] leftpricei, double[] rightpricei, double[] leftrangei, double[] rightrangei, double[] leftpricej, double[] rightpricej, double[] leftrangej, double[] rightrangej) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Calculates sensitivity information for bounds on variables and constraints.
For details on sensitivity analysis and the definitions of shadow price and linearity interval see chapter 12.
The constraints for which sensitivity analysis is performed are given by the data structures:
Consider the problem:
![]() |
(14.9.24) |
Suppose that
numi = 1; subi = [0]; marki = [Env.mark.up]
then
leftpricei[0], rightpricei[0], leftrangei[0] and rightrangei[0] will contain the sensitivity information for the upper bound on constraint 0 given by the expression:
![]() |
(14.9.25) |
Similarly, the variables for which to perform sensitivity analysis are given by the structures:
For an example, please see Section 12.5.
The type of sensitivity analysis to be performed (basis or optimal partition) is controlled by the parameter Env.iparam.sensitivity_type.
Performs sensitivity analysis on objective coefficients.
Creates a sensitivity report.
public void probtypetostr ( int probtype, StringBuffer str) throws mosek.Error, mosek.Warning;
public void prostatostr ( int prosta, StringBuffer str) throws mosek.Error, mosek.Warning;
public void putaij ( int i, int j, double aij) throws mosek.Error, mosek.Warning;
Changes a coefficient in A using the method
![]() |
Replaces all elements in one row or column of the linear coefficient matrix.
Changes a single value in the linear coefficient matrix.
The function changes the size of the preallocated storage for linear coefficients.
public void putaijlist ( int[] subi, int[] subj, double[] valij) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Changes one or more coefficients in A using the method
![]() |
If the same entry appears multiple times only the last one will be used.
Replaces all elements in one row or column of the linear coefficient matrix.
Changes a single value in the linear coefficient matrix.
The function changes the size of the preallocated storage for linear coefficients.
public void putavec ( int accmode, int i, int[] asub, double[] aval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all elements in one row or column of A.
Assuming that there are no duplicate subscripts in asub, assignment is performed as follows:
If accmode is Env.accmode.con, then
![]() |
and all other .
If accmode is Env.accmode.var, then
![]() |
and all other .
If asub contains duplicates, the corresponding coefficients will be added together.
For an explanation of the meaning of ptrb and ptre see Section 5.8.3.2.
Replaces all elements in one row or column of the linear coefficient matrix.
Changes a single value in the linear coefficient matrix.
The function changes the size of the preallocated storage for linear coefficients.
public void putaveclist ( int accmode, int[] sub, int[] ptrb, int[] ptre, int[] asub, double[] aval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all elements in a set of rows or columns of A.
The elements are replaced as follows.
If accmode is Env.accmode.con, then for
![]() |
If accmode is Env.accmode.var, then for
![]() |
If the same row or column appears multiple times only the last one will be used.
Replaces all elements in one row or column of the linear coefficient matrix.
The function changes the size of the preallocated storage for linear coefficients.
public void putaveclist ( int accmode, int[] sub, long[] ptrb, long[] ptre, int[] asub, double[] aval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all elements in a set of rows or columns of A.
The elements are replaced as follows.
If accmode is Env.accmode.con, then for
![]() |
If accmode is Env.accmode.var, then for
![]() |
If the same row or column appears multiple times only the last one will be used.
Replaces all elements in one row or column of the linear coefficient matrix.
The function changes the size of the preallocated storage for linear coefficients.
public void putbound ( int accmode, int i, int bk, double bl, double bu) throws mosek.Error, mosek.Warning;
Changes the bounds for either one constraint or one variable.
If the a bound value specified is numerically larger than Env.dparam.data_tol_bound_inf it is considered infinite and the bound key is changed accordingly. If a bound value is numerically larger than Env.dparam.data_tol_bound_wrn, a warning will be displayed, but the bound is inputted as specified.
Changes the bounds of constraints or variables.
public void putboundlist ( int accmode, int[] sub, int[] bk, double[] bl, double[] bu) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Changes the bound for either one constraint or one variable.
public void putboundslice ( int con, int first, int last, int[] bk, double[] bl, double[] bu) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Changes the bound for either one constraint or one variable.
public void putcfix (double cfix) throws mosek.Error, mosek.Warning;
public void putcj ( int j, double cj) throws mosek.Error, mosek.Warning;
Modifies one coefficient in the linear objective vector c, i.e.
![]() |
public void putclist ( int[] subj, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Modifies elements in the linear term c in the objective using the principle
![]() |
If a variable index is specified multiple times in subj only the last entry is used.
public void putcone ( int k, int conetype, double conepar, int[] submem) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void putdouparam ( int param, double parvalue) throws mosek.Error, mosek.Warning;
public void putintparam ( int param, int parvalue) throws mosek.Error, mosek.Warning;
Sets the value of an integer parameter.
Please notice that some parameters take values that are defined in Enum classes. This function accepts only integer values, so to use e.g. the value Env.onoffkey.on, is is necessary to use the member “.value”. For example:
task.putintparam(Env.iparam.opf_write_problem,Env.onoffkey.on.value)
public void putmaxnumanz (int maxnumanz) throws mosek.Error, mosek.Warning;
MOSEK stores only the non-zero elements in A. Therefore, MOSEK cannot predict how much storage is required to store A. Using this function it is possible to specify the number of non-zeros to preallocate for storing A.
If the number of non-zeros in the problem is known, it is a good idea to set maxnumanz slightly larger than this number, otherwise a rough estimate can be used. In general, if A is inputted in many small chunks, setting this value may speed up the the data input phase.
It is not mandatory to call this function, since MOSEK will reallocate internal structures whenever it is necessary.
public void putmaxnumanz (long maxnumanz) throws mosek.Error, mosek.Warning;
public void putmaxnumcon (int maxnumcon) throws mosek.Error, mosek.Warning;
Sets the number of preallocated constraints in the optimization task. When this number of constraints is reached MOSEK will automatically allocate more space for constraints.
It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
Please note that maxnumcon must be larger than the current number of constraints in the task.
public void putmaxnumcone (int maxnumcone) throws mosek.Error, mosek.Warning;
Sets the number of preallocated conic constraints in the optimization task. When this number of conic constraints is reached MOSEK will automatically allocate more space for conic constraints.
It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
Please note that maxnumcon must be larger than the current number of constraints in the task.
public void putmaxnumqnz (int maxnumqnz) throws mosek.Error, mosek.Warning;
MOSEK stores only the non-zero elements in Q. Therefore, MOSEK cannot predict how much storage is required to store Q. Using this function it is possible to specify the number non-zeros to preallocate for storing Q (both objective and constraints).
It may be advantageous to reserve more non-zeros for Q than actually needed since it may improve the internal efficiency of MOSEK, however, it is never worthwhile to specify more than the double of the anticipated number of non-zeros in Q.
It is never mandatory to call this function, since its only function is to give a hint of the amount of data to preallocate for efficiency reasons.
public void putmaxnumqnz (long maxnumqnz) throws mosek.Error, mosek.Warning;
MOSEK stores only the non-zero elements in Q. Therefore, MOSEK cannot predict how much storage is required to store Q. Using this function it is possible to specify the number non-zeros to preallocate for storing Q (both objective and constraints).
It may be advantageous to reserve more non-zeros for Q than actually needed since it may improve the internal efficiency of MOSEK, however, it is never worthwhile to specify more than the double of the anticipated number of non-zeros in Q.
It is never mandatory to call this function, since its only function is to give a hint of the amount of data to preallocate for efficiency reasons.
public void putmaxnumvar (int maxnumvar) throws mosek.Error, mosek.Warning;
Sets the number of preallocated variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.
It is never mandatory to call this function, since its only function is to give a hint of the amount of data to preallocate for efficiency reasons.
Please note that maxnumvar must be larger than the current number of variables in the task.
public void putnadouparam ( String paramname, double parvalue) throws mosek.Error, mosek.Warning;
public void putnaintparam ( String paramname, int parvalue) throws mosek.Error, mosek.Warning;
public void putname ( int whichitem, int i, String name) throws mosek.Error, mosek.Warning;
public void putobjname (String objname) throws mosek.Error, mosek.Warning;
public void putobjsense (int sense) throws mosek.Error, mosek.Warning;
Gets the objective sense.
public void putparam ( String parname, String parvalue) throws mosek.Error, mosek.Warning;
public void putqcon ( int[] qcsubk, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all quadratic entries in the constraints. Consider constraints on the form:
![]() |
(14.9.26) |
The function assigns values to q such that:
![]() |
(14.9.27) |
and
![]() |
(14.9.28) |
Values not assigned are set to zero.
Please note that duplicate entries are added together.
Replaces all quadratic terms in a single constraint.
Changes the size of the preallocated storage for quadratic terms.
public void putqconk ( int k, int[] qcsubi, int[] qcsubj, double[] qcval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all the quadratic entries in one constraint k of the form:
![]() |
(14.9.29) |
It is assumed that is symmetric, i.e.
, and therefore, only the values of
for which i≥j should be inputted to MOSEK. To be precise, MOSEK uses the following procedure
![]() |
Please note that:
For a code example see Section 5.3.2.
Replaces all quadratic terms in constraints.
Changes the size of the preallocated storage for quadratic terms.
public void putqobj ( int[] qosubi, int[] qosubj, double[] qoval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all the quadratic terms in the objective
![]() |
(14.9.30) |
It is assumed that is symmetric, i.e.
, and therefore, only the values of
for which i≥j should be specified. To be precise, MOSEK uses the following procedure
![]() |
Please note that:
For a code example see Section 5.3.1.
public void putqobjij ( int i, int j, double qoij) throws mosek.Error, mosek.Warning;
Replaces one coefficient in the quadratic term in the objective. The function performs the assignment
![]() |
Only the elements in the lower triangular part are accepted. Setting with j>i will cause an error.
Please note that replacing all quadratic element, one at a time, is more computationally expensive than replacing all elements at once. Use Task.putqobj instead whenever possible.
public void putsolution ( int whichsol, int[] skc, int[] skx, int[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void putsolutioni ( int accmode, int i, int whichsol, int sk, double x, double sl, double su, double sn) throws mosek.Error, mosek.Warning;
Sets the primal and dual solution information for a single constraint or variable.
To define a solution or a significant part of a solution, first call the Task.makesolutionstatusunknown function, then for each relevant constraint and variable call Task.putsolutioni to set the solution information.
Sets the solution status to unknown.
public void putsolutionyi ( int i, int whichsol, double y) throws mosek.Error, mosek.Warning;
Sets the solution status to unknown.
Sets the primal and dual solution information for a single constraint or variable.
public void putstrparam ( int param, String parvalue) throws mosek.Error, mosek.Warning;
public void puttaskname (String taskname) throws mosek.Error, mosek.Warning;
public void putvarbranchorder ( int j, int priority, int direction) throws mosek.Error, mosek.Warning;
public void putvartype ( int j, int vartype) throws mosek.Error, mosek.Warning;
Sets the variable type for one or more variables.
public void putvartypelist ( int[] subj, int[] vartype) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Sets the variable type for one or more variables, i.e. variable number is assigned the variable type
.
If the same index is specified multiple times in subj only the last entry takes effect.
Sets the variable type of one variable.
public void readbranchpriorities (String filename) throws mosek.Error, mosek.Warning;
Writes branching priority data to a file.
public void readdata (String filename) throws mosek.Error, mosek.Warning;
Reads an optimization data and associated data from a file.
The data file format is determined by the Env.iparam.read_data_format parameter. By default the parameter has the value Env.dataformat.extension indicating that the extension of the input file should determine the file type, where the extension is interpreted as follows:
Writes problem data to a file.
public void readparamfile () throws mosek.Error, mosek.Warning;
public void readsolution ( int whichsol, String filename) throws mosek.Error, mosek.Warning;
public void readsummary (int whichstream) throws mosek.Error, mosek.Warning;
public Task relaxprimal ( double[] wlc, double[] wuc, double[] wlx, double[] wux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void relaxprimal ( TaskContainer relaxedtask, double[] wlc, double[] wuc, double[] wlx, double[] wux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Creates a problem that computes the minimal (weighted) relaxation of the bounds that will make an infeasible problem feasible.
Given an existing task describing the problem
![]() |
(14.9.31) |
the function forms a new task relaxedtask having the form
![]() |
(14.9.32) |
Hence, the function adds so-called elasticity variables to all the constraints which relax the constraints, for instance and
relax
and
respectively. It should be obvious that (14.9.32) is feasible. Moreover, the function adds the constraint
![]() |
to the problem which makes the variable p bigger than the total weighted sum of the relaxation to the bounds. ,
,
and
are user-defined weights which normally should be nonnegative. If a weight is negative, then the corresponding elasticity variable is fixed to zero.
Hence, when the problem (14.9.32) is optimized, the weighted minimal change to the bounds such that the problem is feasible is computed.
One can specify that a bound should be strictly enforced by assigning a negative value to the corresponding weight, i.e if then
is fixed to zero.
Now let be the optimal objective value to (14.9.32), then a natural thing to do is to solve the optimization problem
![]() |
(14.9.33) |
where the original objective function is minimized subject to the constraint that the total weighted relaxation is minimal.
The parameter Env.iparam.feasrepair_optimize controls whether the function returns the problem (14.9.32) or the problem (14.9.33).The parameter can take one of the following values.
: The returned task relaxedtask contains problem (14.9.32) and is not optimized.
: The returned task relaxedtask contains problem (14.9.32) and is optimized.
: The returned task relaxedtask contains problem (14.9.33) and is optimized.
Please note that the v variables are appended to the x variables ordered as
![]() |
in the returned task.
If NAME_CON (NAME_VAR) is the name of the ith constraint (variable) then the new variables are named as follows:
where “*” can be replaced by a user-defined string by setting the Env.sparam.feasrepair_name_separator parameter.
Please note that if or
then the feasibility repair problem becomes infeasible. Such trivial conflicts must therefore be removed manually before using Task.relaxprimal.
The above discussion shows how the function works for a linear optimization problem. However, the function also works for quadratic and conic optimization problems but it cannot be used for general nonlinear optimization problems.
public void remove ( int accmode, int[] sub) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Appends a number of variables or constraints to the optimization task.
public void removecone (int k) throws mosek.Error, mosek.Warning;
Removes a conic constraint from the problem. This implies that all the conic constraints appearing after cone number k are renumbered, decresing their indexes by one.
In general, it is much more efficient to remove a cone with a high index than a low index.
public void resizetask ( int maxnumcon, int maxnumvar, int maxnumcone, int maxnumanz, int maxnumqnz) throws mosek.Error, mosek.Warning;
Sets the amount of preallocated space assigned for each type of data in an optimization task.
It is never mandatory to call this function, since its only function is to give a hint of the amount of data to preallocate for efficiency reasons.
Please note that the procedure is destructive in the sense that all existing data stored in the task is destroyed.
Sets the number of preallocated variables in the optimization task.
Sets the number of preallocated constraints in the optimization task.
Sets the number of preallocated conic constraints in the optimization task.
The function changes the size of the preallocated storage for linear coefficients.
Changes the size of the preallocated storage for quadratic terms.
public void sensitivityreport (int whichstream) throws mosek.Error, mosek.Warning;
Performs sensitivity analysis on objective coefficients.
Perform sensitivity analysis on bounds.
public void set_Stream ( int whichstream, mosek.Stream stream)
public void setdefaults () throws mosek.Error, mosek.Warning;
public void sktostr ( int sk, StringBuffer str) throws mosek.Error, mosek.Warning;
public void solstatostr ( int solsta, StringBuffer str) throws mosek.Error, mosek.Warning;
public int solutiondef (int whichsol) throws mosek.Error, mosek.Warning;
public void solutiondef ( int whichsol, int[] isdef) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void solutionsummary (int whichstream) throws mosek.Error, mosek.Warning;
public int solvewithbasis ( int transp, int[] sub, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
As input it contains the positions of the non-zeros in b, i.e.
![]() |
As output it contains the positions of the non-zeros in . It is important that sub has room for numcon elements.
As input it is the vector b. Although the positions of the non-zero elements are specified in sub it is required that if b[i]=0. As output val is the vector
.
Please note that val is a dense vector — not a packed sparse vector. This implies that val has room for numcon elements.
public void solvewithbasis ( int transp, int[] numnz, int[] sub, double[] val) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
As input it contains the positions of the non-zeros in b, i.e.
![]() |
As output it contains the positions of the non-zeros in . It is important that sub has room for numcon elements.
As input it is the vector b. Although the positions of the non-zero elements are specified in sub it is required that if b[i]=0. As output val is the vector
.
Please note that val is a dense vector — not a packed sparse vector. This implies that val has room for numcon elements.
If a basic solution is available, then exactly basis variables are defined. These
basis variables are denoted the basis. Associated with the basis is a basis matrix denoted B. This function solves either the linear equation system
![]() |
(14.9.34) |
or the system
![]() |
(14.9.35) |
for the unknowns , with b being a user-defined vector.
In order to make sense of the solution it is important to know the ordering of the variables in the basis because the ordering specifies how B is constructed. When calling Task.initbasissolve an ordering of the basis variables is obtained, whicd can be used to deduce how MOSEK has constructed B. Indeed if the kth basis variable is variable
it implies that
![]() |
Otherwise if the kth basis variable is variable it implies that`
![]() |
Given the knowledge of how B is constructed it is possible to interpret the solution correctly.
Please note that this function exploits the sparsity in the vector b to speed up the computations.
Prepare a task for basis solver.
public void strtoconetype ( String str, int[] conetype) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void strtosk ( String str, int[] sk) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void undefsolution (int whichsol) throws mosek.Error, mosek.Warning;
public void writebranchpriorities (String filename) throws mosek.Error, mosek.Warning;
Reads branching priority data from a file.
public void writedata (String filename) throws mosek.Error, mosek.Warning;
Writes problem data associated with the optimization task to a file in one of four formats:
LP : A text based row oriented format. File extension .lp. See Appendix D.
MPS : A text based column oriented format. File extension .mps. See Appendix C.
OPF : A text based row oriented format. File extension .opf. Supports more problem types than MPS and LP. See Appendix E.
MBT : A binary format for fast reading and writing. File extension .mbt.
By default the data file format is determined by the file name extension. This behaviour can be overridden by setting the Env.iparam.write_data_format parameter.
MOSEK is able to read and write files in a compressed format (gzip). To write in the compressed format append the extension ".gz". E.g to write a gzip compressed MPS file use the extension mps.gz.
Please note that MPS, LP and OPF files require all variables to have unique names. If a task contains no names, it is possible to write the file with automaticly generated anonymous names by setting the Env.iparam.write_generic_names parameter to Env.onoffkey.on.
Reads problem data from a file.
public void writeparamfile (String filename) throws mosek.Error, mosek.Warning;
public void writesolution ( int whichsol, String filename) throws mosek.Error, mosek.Warning;
mosek.Exception
This is an exception class representing MOSEK warnings.
public Warning (int code)