This chapter lists all functionality in the MOSEK Java API.
Functions in the interface grouped by functionality.
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.readsummary
Prints information about last file read.
mosek.Task.writebranchpriorities
Writes branching priority 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.getdualobj
Obtains the dual objective value.
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.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 a solution.
mosek.Task.undefsolution
Undefines a solution.
mosek.Task.writedata
Writes problem data to a file.
Memory allocation and deallocation.
mosek.Task.checkmemtask
Checks the memory allocated by the task.
mosek.Task.getmemusagetask
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.Task.appendcons
Appends one or more constraints and specifies bounds and A coefficients.
mosek.Task.appendvars
Appends one or more variables and specifies bounds on variables, c coefficients and A coefficients.
mosek.Task.chgbound
Changes the bounds for one constraint or variable.
mosek.Task.clonetask
Creates a clone of an existing task.
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.putaij
Changes a single value in the linear coefficient matrix.
mosek.Task.putaijlist
Changes one or more coefficients in A.
mosek.Task.putavec
Replaces all elements in one row or column of A.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in A 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 c.
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 of the coefficients 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 A.
mosek.Task.getaslice
Obtains a sequence of rows or columns from A.
mosek.Task.getaslicetrip
Obtains a sequence of rows or columns from A in triplet format.
mosek.Task.getavec
Obtains one row or column of A.
mosek.Task.getavecnumnz
Obtains the number of non-zero elements in one row or column of A.
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 c.
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 part of c.
mosek.Task.getnumanz
Obtains the number of non-zeros in A.
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.getnumqconnz
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.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.getqobj
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.linkfiletoenvstream
Directs all output from a stream to a file.
mosek.Task.linkfiletotaskstream
Directs all output from a task stream to a file.
mosek.Task.readsummary
Prints information about last file read.
mosek.Task.solutionsummary
Prints a short summary of a solution.
Change or inspect objective function.
mosek.Task.getc
Obtains all objective coefficients c.
mosek.Task.getcfix
Obtains the fixed term in the objective.
mosek.Task.getcslice
Obtains a part of c.
mosek.Task.getdualobj
Obtains the dual objective value.
mosek.Task.getnumqobjnz
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.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 c.
mosek.Task.putobjsense
Sets the objective sense.
mosek.Task.putqobj
Replaces all quadratic terms in the objective.
mosek.Task.putqobjij
Replaces one of the coefficients in the quadratic term in the objective.
Inspect statistics from the optimizer.
mosek.Task.appendstat
Appends a record the statistics file.
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.startstat
Starts the statistics file.
mosek.Task.stopstat
Stops the statistics file.
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.Task.getstrparam
Obtains the value of a string parameter.
mosek.Env.getsymbcondim
Obtains dimensional information for the defined symbolic constants.
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.putnastrparam
Sets a string 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.getmaxnamelen
Obtains the maximum length of any objective, constraint, variable or cone name.
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.getobjname
Obtains the name assigned to the objective function.
mosek.Task.gettaskname
Obtains the task name.
mosek.Task.getvarname
Obtains a name of a variable.
mosek.Task.putname
Assigns the name name to a problem item such as a constraint.
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 for A.
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 Q (both 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.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 Q.
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.getqobj
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 of the coefficients 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.optimize
Optimizes the problem.
mosek.Task.optimizeconcurrent
Optimize a given task with several optimizers concurrently.
mosek.Task.optimizetrm
Optimizes the 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.initbasissolve
Prepare a task for use with the Task.solvewithbasis function.
mosek.Task.solvewithbasis
Solve a linear equation system involving a basis matrix.
Creation and initialization of environment.
mosek.Env.initenv
Initialize a MOSEK environment.
mosek.Env.putlicensedefaults
Set defaults used by the license manager.
Change elements in the coefficient (A) matrix.
mosek.Task.appendcons
Appends one or more constraints and specifies bounds and A coefficients.
mosek.Task.appendvars
Appends one or more variables and specifies bounds on variables, c coefficients and A coefficients.
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 A.
mosek.Task.putavec
Replaces all elements in one row or column of A.
mosek.Task.putaveclist
Replaces all elements in one or more rows or columns in A by new values.
system.Exception
This exception is raised is an input or output array was shorter than required.
A Mosek Environment
Syntax:
public Env ()
Syntax:
public Env (String dbgfile)
Arguments:
public void echointro (int longver) throws mosek.Error, mosek.Warning;
public void getsymbcondim ( int[] num, int[] maxlen) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getversion ( int[] major, int[] minor, int[] build, int[] revision) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void initenv () throws mosek.Error, mosek.Warning;
public void iparvaltosymnam ( int whichparam, int whichvalue, StringBuffer symbolicname) throws mosek.Error, mosek.Warning;
public void linkfiletoenvstream ( 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.
Syntax:
public Error (int code)
Arguments:
Syntax:
public Error ( int code, String msg)
Arguments:
system.Exception
This is the base class for exceptions based on MOSEK response codes.
Syntax:
public Exception (int code)
Arguments:
mosek.Callback
Base class for MOSEK exit call-back handler. An object of this type can be attached to a MOSEK environment.
If MOSEK encounters a fatal error, for example if memory corrupted, a certain member of the class is called before the program terminates.
public void exit ( String file, int line, String msg)
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.
Syntax:
public Progress ()
public void progress (int caller)
mosek.Callback
Base class for stream printer classes which can be attached to MOSEK tasks and environments to intercept output.
Syntax:
public Stream ()
A Mosek Optimization task
Syntax:
public Task ( mosek.Env env, int maxnumcon, int maxnumvar)
Arguments:
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. 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 appendcons ( int[] aptrb, int[] aptre, int[] asub, double[] aval, int[] bkc, double[] blc, double[] buc) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
The function appends one or more constraints to the optimization task. The bounds and A are modified as follows
![]() |
(13.10.1) |
and
![]() |
(13.10.2) |
Sets the number of preallocated constraints in the optimization task.
public void appendstat () throws mosek.Error, mosek.Warning;
public void appendvars ( double[] cval, int[] aptrb, int[] aptre, int[] asub, double[] aval, int[] bkx, double[] blx, double[] bux) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
The function appends one or more variables to the optimization problem. Moreover, the function initializes c, A and the bounds corresponding to the appended variables as follows
![]() |
(13.10.3) |
and
![]() |
(13.10.4) |
where numvar is the number variables before the new variables are appended.
Sets the number of preallocated variables in the optimization task.
public void checkconvexity () throws mosek.Error, mosek.Warning;
public void checkdata () throws mosek.Error, mosek.Warning;
public void checkmemtask ( 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 clonetask (TaskContainer clonedtask) throws mosek.Error, mosek.Warning;
public void commitchanges () throws mosek.Error, mosek.Warning;
public void conetypetostr ( int conetype, StringBuffer str) 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 11.5.
Perform sensitivity analysis on bounds.
Creates a sensitivity report.
public void getaij ( int i, int j, double[] aij) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
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 A.
Obtains the number of non-zeros in a row or column slice of A.
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 A.
public void getaslicenumnz ( int accmode, int first, int last, int[] 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 A.
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 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 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;
Obtains the maximum length of any objective, constraint, variable or cone name.
public void getcslice ( int first, int last, double[] c) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getdouinf ( int whichdinf, double[] dvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
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 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 getintinf ( int whichiinf, int[] ivalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getintparam ( int param, int[] parvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnamelen (int[] maxlen) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumanz (int[] 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 (int[] maxnumqnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmaxnumvar (int[] maxnumvar) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getmemusagetask ( int[] meminuse, int[] maxmemuse) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getname ( int whichitem, int i, int[] len, StringBuffer name) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Obtains the maximum length of any objective, constraint, variable or cone name.
public void getnameindex ( int whichitem, String name, int[] asgn, int[] index) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumanz (int[] numanz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumcon (int[] numcon) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
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 void getnumqconnz ( int i, int[] numqcnz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumqobjnz (int[] numqonz) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getnumvar (int[] numvar) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getobjname ( int[] len, StringBuffer objname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
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 getprimalobj ( int whichsol, double[] primalobj) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getprobtype (int[] probtype) 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 void getqobj ( int[] qosurp, int[] 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
![]() |
(13.10.6) |
and the corresponding dual problem is
![]() |
(13.10.7) |
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_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;
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
![]() |
(13.10.8) |
and the corresponding dual problem is
![]() |
(13.10.9) |
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:
![]() |
(13.10.10) |
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_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 getstrparam ( int param, int[] len, StringBuffer parvalue) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void getsymbcon ( int i, int maxlen, StringBuffer name, int[] value) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void gettaskname ( int[] len, StringBuffer taskname) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
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 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;
Obtains the maximum length of any objective, constraint, variable or cone name.
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
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 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 linkfiletotaskstream ( int whichstream, String filename, int append) throws mosek.Error, mosek.Warning;
public void makesolutionstatusunknown (int whichsol) throws mosek.Error, mosek.Warning;
public void optimize () throws mosek.Error, mosek.Warning;
Optimize a given task with several optimizers concurrently.
Obtains the complete solution.
Obtains the solution for a single constraint or variable.
Obtains information about a solution.
public void optimizeconcurrent (Task[] taskarray) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Solves several instances of the same problem in parallel, with unique parameter settings for each task. The argument task contains the problem to be solved. taskarray is a pointer to an array of num empty tasks. The task task and the num tasks pointed to by taskarray are solved in parallel. That is threads are started with one optimizer in each. Each of the tasks can be initialized with different parameters, e.g different selection of solver.
All the concurrently running tasks are stopped when the optimizer successfully terminates for one of the tasks. After the function returns task contains the solution found by the task that finished first.
After Task.optimizeconcurrent returns task holds the optimal solution of the task which finished first. If all the concurrent optimizations finished without providing an optimal solution the error code from the solution of the task task is returned.
In summary a call to Task.optimizeconcurrent does the following:
For an explained code example see section 7.6.4.
public void optimizetrm (int[] trmcode) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
This function is equivalent to Task.optimize except in the case where Task.optimize would have returned a termination response code such as
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 11.
The constraints for which sensitivity analysis is performed are given by the data structures:
Consider the problem:
![]() |
(13.10.11) |
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:
![]() |
(13.10.12) |
Similarly, the variables for which to perform sensitivity analysis are given by the structures:
For an example, please see section 11.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 A.
Changes one or more coefficients in A.
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 A.
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 5.8.3.2 and .
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 A.
Changes a single value in 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 for one constraint or variable.
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;
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 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 A 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 A.
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 putnastrparam ( String paramname, String parvalue) 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:
![]() |
(13.10.13) |
The function assigns values to q such that:
![]() |
(13.10.14) |
and
![]() |
(13.10.15) |
Values not assigned are set to zero.
Replaces all quadratic terms in a single constraint.
Changes the size of the preallocated storage for Q.
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:
![]() |
(13.10.16) |
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 Q.
public void putqobj ( int[] qosubi, int[] qosubj, double[] qoval) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
Replaces all the quadratic terms in the objective
![]() |
(13.10.17) |
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 of the coefficients in the quadratic term in the objective. The function performs the assignment
![]() |
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 function 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;
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.
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 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
![]() |
(13.10.18) |
the function forms a new task relaxedtask having the form
![]() |
(13.10.19) |
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 (13.10.19) 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 (13.10.19) 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 (13.10.19), then a natural thing to do is to solve the optimization problem
![]() |
(13.10.20) |
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 (13.10.19) or the problem (13.10.20).The parameter can take one of the following values.
: The returned task relaxedtask contains problem (13.10.19) and is not optimized.
: The returned task relaxedtask contains problem (13.10.19) and is optimized.
: The returned task relaxedtask contains problem (13.10.20) 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 Q.
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 void solutiondef ( int whichsol, int[] isdef) throws mosek.Error, mosek.Warning, mosek.ArrayLengthException;
public void solutionsummary (int whichstream) throws mosek.Error, mosek.Warning;
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
![]() |
(13.10.21) |
or the system
![]() |
(13.10.22) |
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 use with the Task.solvewithbasis function.
public void startstat () throws mosek.Error, mosek.Warning;
public void stopstat () throws mosek.Error, mosek.Warning;
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 C.
MPS : A text based column oriented format. File extension .mps. See Appendix B.
OPF : A text based row oriented format. File extension .opf. Supports more problem types than MPS and LP. See Appendix D.
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.
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.
Syntax:
public Warning (int code)
Arguments: