Appends a number of constraints or variables to the model. Appended constraints will be declared free and appended variables will be fixed at the level zero. Note MOSEK will automatically expand the problem dimension to accommodate the additional constraints and variables.
MSKrescodee MSK_append (MSKtask_t task, MSKaccmodee iscon, MSKintt num);
Appends a new conic constraint to the problem. Hence, add a constraint
MSKrescodee MSK_appendcone (MSKtask_t task, MSKconetypee conetype, MSKrealt conepar, MSKintt nummem, MSKCONST MSKidxt * submem);
The function appends one or more constraints to the optimization task.
The bounds and are modified as follows
MSKrescodee MSK_appendcons (MSKtask_t task, MSKintt num, MSKCONST MSKlidxt * aptrb, MSKCONST MSKlidxt * aptre, MSKCONST MSKidxt * asub, MSKCONST MSKrealt * aval, MSKCONST MSKboundkeye * bkc, MSKCONST MSKrealt * blc, MSKCONST MSKrealt * buc);
Appends a record to the statistics file.
MSKrescodee MSK_appendstat (MSKtask_t task);
The function appends one or more variables to the optimization problem. Moreover, the function
initializes ,
and the bounds corresponding to the appended variables as follows
MSKrescodee MSK_appendvars (MSKtask_t task, MSKintt num, MSKCONST MSKrealt * cval, MSKCONST MSKlidxt * aptrb, MSKCONST MSKlidxt * aptre, MSKCONST MSKidxt * asub, MSKCONST MSKrealt * aval, MSKCONST MSKboundkeye * bkx, MSKCONST MSKrealt * blx, MSKCONST MSKrealt * bux);
Obtains a identifier string corresponding to a bound key.
MSKrescodee MSK_bktostr (MSKtask_t task, MSKboundkeye bk, MSKstring_t str);
Debug version of MSK_callocenv.
MSKCONST MSKrescodee * MSK_callocdbgenv (MSKenv_t env, size_t number, size_t size, MSKCONST MSKstring_t file, unsigned line);
Debug version of MSK_calloctask.
MSKCONST MSKrescodee * MSK_callocdbgtask (MSKtask_t task, size_t number, size_t size, MSKCONST MSKstring_t file, unsigned line);
Equivalent to calloc i.e. allocate space for an array of length number where each element is of size size.
MSKCONST void * MSK_callocenv (MSKenv_t env, size_t number, size_t size);
Equivalent to calloc i.e. allocate space for an array of length number where each element is of size size.
MSKCONST void * MSK_calloctask (MSKtask_t task, size_t number, size_t size);
This function checks if a quadratic optimization problem is convex. The amount of checking is controlled by MSK_IPAR_CHECK_CONVEXITY. The function returns MSK_RES_ERR_NONCONVEX if the problem is not convex.
MSKrescodee MSK_checkconvexity (MSKtask_t task);
Checks the memory allocated by the environment.
MSKrescodee MSK_checkmemenv (MSKenv_t env, MSKCONST MSKstring_t file, MSKintt line);
Checks the memory allocated by the task.
MSKrescodee MSK_checkmemtask (MSKtask_t task, MSKCONST MSKstring_t file, MSKintt line);
Compares the version of the MOSEK DLL with a specified version. Normally the specified version is the version at the build time.
MSKrescodee MSK_checkversion (MSKenv_t env, MSKintt major, MSKintt minor, MSKintt build, MSKintt revision);
Changes the bounds for one constraint or variable. If con is nonzero, then the bounds are changed for a bound. Otherwise the bounds is changed for a variable.
If lower is nonzero, then the lower bound is changed as follows:
Note this function automatically updates the bound key for bound.
MSKrescodee MSK_chgbound (MSKtask_t task, MSKaccmodee con, MSKidxt i, MSKintt lower, MSKintt finite, MSKrealt value);
Creates a clone (or copy if you wish) of an existing task. Callback functions are not included in the cloned task. A task that has nonlinear function callbacks cannot be cloned.
MSKrescodee MSK_clonetask (MSKtask_t task, MSKtask_t * clonedtask);
Obtains the cone string identifier corresponding to a cone type.
MSKrescodee MSK_conetypetostr (MSKtask_t task, MSKconetypee conetype, MSKstring_t str);
Deletes a MOSEK environment and all the data associated with it.
Before calling this function it is in general a good idea to call the function MSK_unlinkfuncfromenvstream for each stream that has have had function linked to it.
MSKrescodee MSK_deleteenv (MSKenv_t * env);
Deletes a MOSEK file file descriptor.
MSKrescodee MSK_deletefile (MSKCONST MSKfile_t * file);
Deletes a solution and frees the memory it uses.
MSKrescodee MSK_deletesolution (MSKtask_t task, MSKintt whichsol);
Deletes a task.
MSKrescodee MSK_deletetask (MSKtask_t * task);
Calculate sensitivity information for objective
coefficients. The indexes of the coefficients to analyze are
The type of sensitivity analysis to performed (basis or optimal partition) is controlled by the parameter MSK_IPAR_SENSITIVITY_TYPE.
MSKrescodee MSK_dualsensitivity (MSKtask_t task, MSKlintt numj, MSKCONST MSKidxt * subj, MSKrealt * leftpricej, MSKrealt * rightpricej, MSKrealt * leftrangej, MSKrealt * rightrangej);
Prints the code to the environment message stream formatted ``nicely''.
code
must be a valid response code listed in Appendix .
Moreover, the corresponding response string listed
in Appendix
is printed. It is the users
responsibility to provide appropriate arguments for
the response string listed in Appendix
too.
MSKrescodee MSK_echocodeenv (MSKenv_t env, MSKrescodee code, ...);
Prints the code to the message task stream formatted ``nicely''.
code
must be a valid response code listed in Appendix .
Moreover, the corresponding response string listed
in Appendix
is printed. It is the users
responsibility to provide appropriate arguments for
the response string listed in Appendix
too.
MSKrescodee MSK_echocodetask (MSKtask_t task, MSKrescodee code, ...);
Sends a message to a given environment stream.
MSKrescodee MSK_echoenv (MSKenv_t env, MSKstreamtypee whichstream, MSKCONST MSKstring_t format, ...);
Prints a intro to message stream.
MSKrescodee MSK_echointro (MSKenv_t env, MSKintt longver);
Prints a format string to a task stream.
MSKrescodee MSK_echotask (MSKtask_t task, MSKstreamtypee whichstream, MSKCONST MSKstring_t format, ...);
Free space allocated by a MOSEK function. Must not be applied to the MOSEK environment and task.
MSKrescodee MSK_freedbgenv (MSKenv_t env, MSKCONST void * buffer, MSKCONST MSKstring_t file, unsigned line);
Free space allocated by a MOSEK function. Must not be applied to the MOSEK environment and task.
MSKrescodee MSK_freedbgtask (MSKtask_t task, MSKCONST void * buffer, MSKCONST MSKstring_t file, unsigned line);
Free space allocated by a MOSEK function. Must not be applied to the MOSEK environment and task.
void MSK_freeenv (MSKenv_t env, MSKCONST void * buffer);
Free space allocated by a MOSEK function. Must not be applied to the MOSEK environment and task.
void MSK_freetask (MSKtask_t task, MSKCONST void * buffer);
Obtains a single coefficient in .
MSKrescodee MSK_getaij (MSKtask_t task, MSKidxt i, MSKidxt j, MSKrealt * aij);
Obtains the number nonzeros of a rectangular piece of i.e. the number
This function is not a an efficient way to obtain the number of nonzeros in one row or column. In that case use the function MSK_getavecnumnz.
MSKrescodee MSK_getapiecenumnz (MSKtask_t task, MSKidxt firsti, MSKidxt lasti, MSKidxt firstj, MSKidxt lastj, MSKlintt * numnz);
Obtains a sequence of rows or columns from in sparse
format.
MSKrescodee MSK_getaslice (MSKtask_t task, MSKaccmodee iscon, MSKidxt first, MSKidxt last, MSKlintt maxnumnz, MSKlintt * surp, MSKlidxt * ptrb, MSKlidxt * ptre, MSKidxt * sub, MSKrealt * val);
Obtains the number of nonzeros in a row or column slice of .
MSKrescodee MSK_getaslicenumnz (MSKtask_t task, MSKaccmodee iscon, MSKidxt first, MSKidxt last, MSKlintt * numnz);
Obtains a sequence of rows or columns from in a sparse triplet
format. Define
by
MSKrescodee MSK_getaslicetrip (MSKtask_t task, MSKaccmodee iscon, MSKidxt first, MSKidxt last, MSKlintt maxnumnz, MSKlintt * surp, MSKidxt * subi, MSKidxt * subj, MSKrealt * val);
Obtains one row or column of in a sparse format.
Hence if isrow is nonzero, then
MSKrescodee MSK_getavec (MSKtask_t task, MSKaccmodee isrow, MSKidxt i, MSKintt * nzi, MSKidxt * subi, MSKrealt * vali);
Obtains the number of nonzero elements in one row or column of .
MSKrescodee MSK_getavecnumnz (MSKtask_t task, MSKaccmodee isrow, MSKidxt i, MSKintt * nzj);
Obtains bounds information for one constraint or variable.
MSKrescodee MSK_getbound (MSKtask_t task, MSKaccmodee iscon, MSKidxt i, MSKboundkeye * bk, MSKrealt * bl, MSKrealt * bu);
Obtains bounds information for a sequence of variables or constraints.
MSKrescodee MSK_getboundslice (MSKtask_t task, MSKaccmodee iscon, MSKidxt first, MSKidxt last, MSKboundkeye * bk, MSKrealt * bl, MSKrealt * bu);
Obtains build information.
MSKrescodee MSK_getbuildinfo (MSKstring_t buildstate, MSKstring_t builddate, MSKstring_t buildtool);
Obtains whole .
MSKrescodee MSK_getc (MSKtask_t task, MSKrealt * c);
Obtains the current user defined call-back function and associated userhandle.
MSKrescodee MSK_getcallbackfunc (MSKtask_t task, MSKcallbackfunc * func, void ** handle);
Obtains the fixed term in the objective.
MSKrescodee MSK_getcfix (MSKtask_t task, MSKrealt * cfix);
Obtains a short description of the meaning of a response code code.
MSKrescodee MSK_getcodedisc (MSKrescodee code, MSKstring_t symname, MSKstring_t str);
Obtains a conic constraint.
MSKrescodee MSK_getcone (MSKtask_t task, MSKidxt k, MSKconetypee * conetype, MSKrealt * conepar, MSKintt * nummem, MSKidxt * submem);
Obtains information about a conic constraint.
MSKrescodee MSK_getconeinfo (MSKtask_t task, MSKidxt k, MSKconetypee * conetype, MSKrealt * conepar, MSKintt * nummem);
Obtains a sequence of elements in .
MSKrescodee MSK_getcslice (MSKtask_t task, MSKidxt first, MSKidxt last, MSKrealt * c);
Obtains a double information item from task information database.
MSKrescodee MSK_getdouinf (MSKtask_t task, MSKdinfiteme whichdinf, MSKrealt * dvalue);
Obtains the value of a double parameter.
MSKrescodee MSK_getdouparam (MSKtask_t task, MSKdparame param, MSKrealt * parvalue);
Obtains the dual objective value for a solution.
MSKrescodee MSK_getdualobj (MSKtask_t task, MSKsoltypee whichsol, MSKrealt * dualobj);
Obtains the environment used to create the task.
MSKrescodee MSK_getenv (MSKtask_t task, MSKenv_t * env);
Obtains the name of the global optimizer DLL.
MSKrescodee MSK_getglbdllname (MSKenv_t env, size_t sizedllname, MSKstring_t dllname);
Obtains an infeasible sub problem based on the certificate of in feasibility. The subproblem returned is often smaller than the original problem and can therefor be used to diagnose the infeasibility.
MSKrescodee MSK_getinfeasiblesubproblem (MSKtask_t task, MSKintt whichsol, MSKtask_t * inftask);
Obtains the index of a named information item.
MSKrescodee MSK_getinfindex (MSKtask_t task, MSKinftypee inftype, MSKCONST MSKstring_t infname, MSKintt * infindex);
Obtains the maximum index of an information of a given type inftype plus 1.
MSKrescodee MSK_getinfmax (MSKtask_t task, MSKinftypee inftype, MSKintt * infmax);
Obtains the name of an information item.
MSKrescodee MSK_getinfname (MSKtask_t task, MSKinftypee inftype, MSKintt whichinf, MSKstring_t infname);
Obtains an integer information item from the task information database.
MSKrescodee MSK_getintinf (MSKtask_t task, MSKiinfiteme whichiinf, MSKintt * ivalue);
Obtains the value of an integer parameter.
MSKrescodee MSK_getintparam (MSKtask_t task, MSKiparame param, MSKintt * parvalue);
Obtains the maximum length of any objective, constraint, variable, or cone name.
MSKrescodee MSK_getmaxnamelen (MSKtask_t task, size_t * maxlen);
Obtains the maximum number of non-zeros allowed in in the optimization task.
MSKrescodee MSK_getmaxnumanz (MSKtask_t task, MSKlintt * maxnumanz);
Obtains the maximum number constraints allowed in the optimization task.
MSKrescodee MSK_getmaxnumcon (MSKtask_t task, MSKintt * maxnumcon);
Obtains the maximum number cones allowed in the optimization task.
MSKrescodee MSK_getmaxnumcone (MSKtask_t task, MSKintt * maxnumcone);
Obtains the maximum number of nonzeros allowed in all the
matrices (both objective and constraints).
MSKrescodee MSK_getmaxnumqnz (MSKtask_t task, MSKintt * maxnumqnz);
Obtains the maximum number variables allowed in the optimization task.
MSKrescodee MSK_getmaxnumvar (MSKtask_t task, MSKintt * maxnumvar);
Obtains information about the amount of memeory use by a task.
MSKrescodee MSK_getmemusagetask (MSKtask_t task, size_t * meminuse, size_t * maxmemuse);
Obtains a double information item from task information database.
MSKrescodee MSK_getnadouinf (MSKtask_t task, MSKCONST MSKstring_t whichdinf, MSKrealt * dvalue);
Obtains the value of a named double parameter.
MSKrescodee MSK_getnadouparam (MSKtask_t task, MSKCONST MSKstring_t paramname, MSKrealt * parvalue);
Obtains an integer information item from the task information database.
MSKrescodee MSK_getnaintinf (MSKtask_t task, MSKCONST MSKstring_t whichiinf, MSKintt * ivalue);
Obtains the value of a named integer parameter.
MSKrescodee MSK_getnaintparam (MSKtask_t task, MSKCONST MSKstring_t paramname, MSKintt * parvalue);
Obtains a name of a item i.e. for instance a problem name.
MSKrescodee MSK_getname (MSKtask_t task, MSKproblemiteme whichitem, MSKidxt i, size_t maxlen, size_t * len, MSKstring_t name);
Checks whether a name has already been assigned to an item i.e. a constraint, a variable, or a cone. If the name has already been assigned, then the index of the item that name has been assigned to is returned.
MSKrescodee MSK_getnameindex (MSKtask_t task, MSKproblemiteme whichitem, MSKCONST MSKstring_t name, MSKintt * asgn, MSKidxt * index);
Obtains the value of a named string parameter.
MSKrescodee MSK_getnastrparam (MSKtask_t task, MSKCONST MSKstring_t paramname, size_t maxlen, size_t * len, MSKstring_t parvalue);
Obtains the value of a string parameter.
MSKrescodee MSK_getnastrparamal (MSKtask_t task, MSKCONST MSKstring_t paramname, size_t numaddchr, MSKstring_t * value);
This function is used to retrieve the nonlinear callback functions. If NULL no nonlinear callback function exists.
MSKrescodee MSK_getnlfunc (MSKtask_t task, void ** nlhandle, MSKCONST MSKnlgetspfunc * nlgetsp, MSKCONST MSKnlgetvafunc * nlgetva);
Obtains the number of non-zeros in .
MSKrescodee MSK_getnumanz (MSKtask_t task, MSKlintt * numanz);
Obtains the number of constraints.
MSKrescodee MSK_getnumcon (MSKtask_t task, MSKintt * numcon);
Obtains the number of cones.
MSKrescodee MSK_getnumcone (MSKtask_t task, MSKintt * numcone);
Obtains the number of members in a cone.
MSKrescodee MSK_getnumconemem (MSKtask_t task, MSKidxt k, MSKintt * nummem);
Obtains the number of integer constrained variables.
MSKrescodee MSK_getnumintvar (MSKtask_t task, MSKintt * numintvar);
Obtains the number of parameters of a given type.
MSKrescodee MSK_getnumparam (MSKtask_t task, MSKparametertypee partype, MSKintt * numparam);
Obtains the number of nonzero quadratic terms in a constraint.
MSKrescodee MSK_getnumqconnz (MSKtask_t task, MSKidxt i, MSKlintt * numqcnz);
Obtains the number of nonzero quadratic terms in the objective.
MSKrescodee MSK_getnumqobjnz (MSKtask_t task, MSKlintt * numqonz);
Obtains the number of variables.
MSKrescodee MSK_getnumvar (MSKtask_t task, MSKintt * numvar);
Obtains the name assigned to the objective function.
MSKrescodee MSK_getobjname (MSKtask_t task, size_t maxlen, size_t * len, MSKstring_t objname);
Obtains the maximum index of a parameter of a given type plus 1.
MSKrescodee MSK_getparammax (MSKtask_t task, MSKparametertypee partype, MSKCONST MSKintt * parammax);
Obtains the name for a parameter param of type partype.
MSKrescodee MSK_getparamname (MSKtask_t task, MSKparametertypee partype, MSKparametertypee param, MSKstring_t parname);
Obtains the primal objective value for a solution.
MSKrescodee MSK_getprimalobj (MSKtask_t task, MSKsoltypee whichsol, MSKrealt * primalobj);
Obtains the problem type.
MSKrescodee MSK_getprobtype (MSKtask_t task, MSKintt * probtype);
Obtains all the quadratic terms in a constraint. The quadratic terms are stored sequentially qcsubi, qcsubj, and qcval.
MSKrescodee MSK_getqconk (MSKtask_t task, MSKidxt k, MSKlintt maxnumqcnz, MSKlintt * qcsurp, MSKlintt * numqcnz, MSKidxt * qcsubi, MSKidxt * qcsubj, MSKrealt * qcval);
Obtains the quadratic terms in the objective. The required quadratic terms are stored sequentially in qosubi, qosubj, and qoval.
MSKrescodee MSK_getqobj (MSKtask_t task, MSKlintt maxnumqonz, MSKlintt * qosurp, MSKlintt * numqonz, MSKidxt * qosubi, MSKidxt * qosubj, MSKrealt * qoval);
Obtains one coefficient in the quadratic term of the objective i.e.
obtains
MSKrescodee MSK_getqobjij (MSKtask_t task, MSKidxt i, MSKidxt j, MSKrealt * qoij);
Obtain the class of a response code.
MSKrescodee MSK_getresponseclass (MSKrescodee r, MSKrescodetypee * rc);
Obtains the complete solution.
MSKrescodee MSK_getsolution (MSKtask_t task, MSKsoltypee whichsol, MSKprostae * prosta, MSKsolstae * solsta, MSKstakeye * skc, MSKstakeye * skx, MSKstakeye * skn, MSKrealt * xc, MSKrealt * xx, MSKrealt * y, MSKrealt * slc, MSKrealt * suc, MSKrealt * slx, MSKrealt * sux, MSKrealt * snx);
Obtains the primal and dual solution information for a single constraint or variable.
MSKrescodee MSK_getsolutioni (MSKtask_t task, MSKintt iscon, MSKidxt i, MSKsoltypee whichsol, MSKstakeye * sk, MSKrealt * x, MSKrealt * sl, MSKrealt * su, MSKrealt * sn);
Obtains the whole or a part of the solution. This function must only be called with progress callback function.
This is an experimental implementation. Please contact MOSEK support before using this function.
MSKrescodee MSK_getsolutionincallback (MSKtask_t task, MSKcallbackcodee where, MSKsoltypee whichsol, MSKprostae * prosta, MSKsolstae * solsta, MSKstakeye * skc, MSKstakeye * skx, MSKstakeye * skn, MSKrealt * xc, MSKrealt * xx, MSKrealt * y, MSKrealt * slc, MSKrealt * suc, MSKrealt * slx, MSKrealt * sux, MSKrealt * snx);
Obtains information about a solution.
MSKrescodee MSK_getsolutioninf (MSKtask_t task, MSKsoltypee whichsol, MSKprostae * prosta, MSKsolstae * solsta, MSKrealt * primalobj, MSKrealt * maxpbi, MSKrealt * maxpcni, MSKrealt * maxpeqi, MSKrealt * maxinti, MSKrealt * dualobj, MSKrealt * maxdbi, MSKrealt * maxdcni, MSKrealt * maxdeqi);
Obtains a slice of the solution.
MSKrescodee MSK_getsolutionslice (MSKtask_t task, MSKsoltypee whichsol, MSKsoliteme solitem, MSKidxt first, MSKidxt last, MSKrealt * values);
Obtains information about the prolem and solution statuses.
MSKrescodee MSK_getsolutionstatus (MSKtask_t task, MSKsoltypee whichsol, MSKprostae * prosta, MSKsolstae * solsta);
Obtains the value of a string parameter.
MSKrescodee MSK_getstrparam (MSKtask_t task, MSKsparame param, size_t maxlen, size_t * len, MSKstring_t parvalue);
Obtains the value of a string parameter.
MSKrescodee MSK_getstrparamal (MSKtask_t task, MSKsparame param, size_t numaddchr, MSKstring_t * value);
Obtains the name and corresponding value for the th symbolic constant.
MSKrescodee MSK_getsymbcon (MSKtask_t task, MSKidxt i, size_t maxlen, MSKstring_t name, MSKintt * value);
Obtains the number of symbolic constants defined by MOSEK and the maximum length of name of any symbolic constant.
MSKrescodee MSK_getsymbcondim (MSKenv_t env, MSKintt * num, size_t * maxlen);
Obtains the name assigned to the task.
MSKrescodee MSK_gettaskname (MSKtask_t task, size_t maxlen, size_t * len, MSKstring_t taskname);
Gets the variable type of one variable.
MSKrescodee MSK_getvartype (MSKtask_t task, MSKidxt j, MSKvariabletypee * vartype);
obtains the variable type for one or more variables. I.e. variable vartype[k] is assigned the variable type of variable subj[k].
MSKrescodee MSK_getvartypelist (MSKtask_t task, MSKintt num, MSKCONST MSKidxt * subj, MSKintt * vartype);
Obtains information about the version of MOSEK.
MSKrescodee MSK_getversion (MSKintt * major, MSKintt * minor, MSKintt * build, MSKintt * revision);
This function must be called before the first usage of the function MSK_solvewithbasis. The function initialize various internal data structures which are required by MSK_solvewithbasis.
Moreover, if the optimization task is modified between two calls of MSK_solvewithbasis, then MSK_initbasissolve should called again immediately before the second call to MSK_solvewithbasis.
MSKrescodee MSK_initbasissolve (MSKtask_t task, MSKidxt * basis);
This function initializes the MOSEK environment, for instance the function contacts the license server. Error messages from the license manager can be captured by linking to the environment message stream.
MSKrescodee MSK_initenv (MSKenv_t env);
The procedure is used to input the linear part of an optimization task.
MSKrescodee MSK_inputdata (MSKtask_t task, MSKintt maxnumcon, MSKintt maxnumvar, MSKintt numcon, MSKintt numvar, MSKCONST MSKrealt * c, MSKrealt cfix, MSKCONST MSKlidxt * aptrb, MSKCONST MSKlidxt * aptre, MSKCONST MSKidxt * asub, MSKCONST MSKrealt * aval, MSKCONST MSKboundkeye * bkc, MSKCONST MSKrealt * blc, MSKCONST MSKrealt * buc, MSKCONST MSKboundkeye * bkx, MSKCONST MSKrealt * blx, MSKCONST MSKrealt * bux);
Obtains the symbolic name corresponding to a value that can be assigned to a integer parameter.
MSKrescodee MSK_iparvaltosymnam (MSKenv_t env, MSKparametertypee whichparam, MSKiparame whichvalue, MSKstring_t symbolicname);
Checks whether parname is a valid double parameter name.
MSKrescodee MSK_isdouparname (MSKtask_t task, MSKCONST MSKstring_t parname, MSKdparame * param);
Checks whether parname is a valid integer parameter name.
MSKrescodee MSK_isintparname (MSKtask_t task, MSKCONST MSKstring_t parname, MSKiparame * param);
Checks whether parname is a valid string parameter name.
MSKrescodee MSK_isstrparname (MSKtask_t task, MSKCONST MSKstring_t parname, MSKsparame * param);
Direct all output to a stream to a file.
MSKrescodee MSK_linkfiletoenvstream (MSKenv_t env, MSKstreamtypee whichstream, MSKCONST MSKstring_t filename, MSKintt append);
Direct all output to a task stream to a file.
MSKrescodee MSK_linkfiletotaskstream (MSKtask_t task, MSKstreamtypee whichstream, MSKCONST MSKstring_t filename, MSKintt append);
Connects a user defined function to a stream.
MSKrescodee MSK_linkfunctoenvstream (MSKenv_t env, MSKstreamtypee whichstream, MSKCONST void * handle, MSKstreamfunc func);
Connects a user defined function to a task stream.
MSKrescodee MSK_linkfunctotaskstream (MSKtask_t task, MSKstreamtypee whichstream, MSKCONST void * handle, MSKstreamfunc func);
Creates a new optimization task.
MSKrescodee MSK_makeemptytask (MSKenv_t env, MSKtask_t * task);
Creates a new MOSEK environment. Before the created environment can be used to create a task, then the environment must be initialized using the function MSK_initenv.
MSKrescodee MSK_makeenv (MSKenv_t * env, MSKvoid_t usrptr, MSKmallocfunc usrmalloc, MSKfreefunc usrfree, MSKCONST MSKchart * dbgfile);
Creates a MOSEK file descriptor. It is important if the file is to be written to that the MSK_putfileiomode is used to make the function writable.
MSKrescodee MSK_makefile (MSKtask_t task, MSKCONST MSKwchart * path, MSKCONST MSKfile_t * file);
Creates a MOSEK file descriptor.
MSKrescodee MSK_makefilechar (MSKtask_t task, MSKCONST MSKchart * path, MSKCONST MSKfile_t * file);
Set the solution status to unknown. Also all the status keys of constraints and variables are set to unknown.
MSKrescodee MSK_makesolutionstatusunknown (MSKtask_t task, MSKsoltypee whichsol);
Creates a new task.
MSKrescodee MSK_maketask (MSKenv_t env, MSKintt maxnumcon, MSKintt maxnumvar, MSKtask_t * task);
Optimizes the problem.
MSKrescodee MSK_optimize (MSKtask_t task);
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 a 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.
If all the concurrent optimizations finished with an error code different from MSK_RES_OK, then the error code from the solution of the task task is returned.
After MSK_optimizeconcurrent returns task holds the optimal solution and other solution information of the task that finished first.
In summary a call to MSK_optimizeconcurrent does the following:
MSKrescodee MSK_optimizeconcurrent (MSKtask_t task, MSKCONST MSKtask_t * taskarray, MSKintt num);
Calculate sensitivity information for bounds on variables or constraints.
The type of sensitivity analysis to performed (basis or optimal partition) is controlled by the parameter MSK_IPAR_SENSITIVITY_TYPE.
MSKrescodee MSK_primalsensitivity (MSKtask_t task, MSKlintt numi, MSKCONST MSKidxt * subi, MSKCONST MSKboundkeye * marki, MSKlintt numj, MSKCONST MSKidxt * subj, MSKCONST MSKboundkeye * markj, MSKrealt * leftpricei, MSKrealt * rightpricei, MSKrealt * leftrangei, MSKrealt * rightrangei, MSKrealt * leftpricej, MSKrealt * rightpricej, MSKrealt * leftrangej, MSKrealt * rightrangej);
Prints a part of the problem data to a stream. This function is normally used for debugging purpose only. I.e. to verify that the correct data has been inputted.
MSKrescodee MSK_printdata (MSKtask_t task, MSKstreamtypee whichstream, MSKidxt firsti, MSKidxt lasti, MSKidxt firstj, MSKidxt lastj, MSKidxt firstk, MSKidxt lastk, MSKintt c, MSKintt qo, MSKintt a, MSKintt qc, MSKintt bc, MSKintt bx, MSKintt vartype, MSKintt cones);
Prints the current parameter settings to the message stream.
MSKrescodee MSK_printparam (MSKtask_t task);
Obtains a explanatory string corresponding to a problem type.
MSKrescodee MSK_probtypetostr (MSKtask_t task, MSKproblemtypee probtype, MSKstring_t str);
Obtains a explanatory string corresponding to a problem status.
MSKrescodee MSK_prostatostr (MSKtask_t task, MSKprostae prosta, MSKstring_t str);
Changes a coefficient in using the method
MSKrescodee MSK_putaij (MSKtask_t task, MSKidxt i, MSKidxt j, MSKrealt aij);
Changes one or more coefficients in using the method
MSKrescodee MSK_putaijlist (MSKtask_t task, MSKintt num, MSKCONST MSKidxt * subi, MSKCONST MSKidxt * subj, MSKCONST MSKrealt * valij);
Replaces all elements in one row or column of
with another set of user specified elements. If isrow
is nonzero, then
The above formulas assumes there are no duplicates in subi. If that is not the case, then the duplicate elements are added together.
MSKrescodee MSK_putavec (MSKtask_t task, MSKaccmodee isrow, MSKidxt i, MSKlintt nzi, MSKCONST MSKidxt * subi, MSKCONST MSKrealt * vali);
The function replaces all elements in one or more rows or columns of
with another set of specified elements.
Assume isrow is nonzero then for
let
MSKrescodee MSK_putaveclist (MSKtask_t task, MSKaccmodee isrow, MSKlintt num, MSKCONST MSKidxt * sub, MSKCONST MSKlidxt * ptrb, MSKCONST MSKlidxt * ptre, MSKCONST MSKidxt * asub, MSKCONST MSKrealt * aval);
Changes the bounds for either one constraint or one variable.
MSKrescodee MSK_putbound (MSKtask_t task, MSKaccmodee iscon, MSKidxt i, MSKboundkeye bk, MSKrealt bl, MSKrealt bu);
Changes the bounds for either some constraints or variables. In the case multiple bound changes are specified for a constraint or a variable, then only the last change has any effect.
MSKrescodee MSK_putboundlist (MSKtask_t task, MSKaccmodee iscon, MSKlintt num, MSKCONST MSKidxt * sub, MSKCONST MSKboundkeye * bk, MSKCONST MSKrealt * bl, MSKCONST MSKrealt * bu);
Changes the bounds for a sequence of variables or constraints.
MSKrescodee MSK_putboundslice (MSKtask_t task, MSKaccmodee con, MSKidxt first, MSKidxt last, MSKCONST MSKboundkeye * bk, MSKCONST MSKrealt * bl, MSKCONST MSKrealt * bu);
The function is used to input a user defined call-back function. The call-back function is called frequently during the optimization process.
MSKrescodee MSK_putcallbackfunc (MSKtask_t task, MSKcallbackfunc func, MSKCONST void * handle);
Replaces the a fixed term in the objective by a new one.
MSKrescodee MSK_putcfix (MSKtask_t task, MSKrealt cfix);
Modifies one element in the linear term in the
objective using the principle
MSKrescodee MSK_putcj (MSKtask_t task, MSKidxt j, MSKrealt cj);
Modifies elements in the linear term in the
objective using the principle
MSKrescodee MSK_putclist (MSKtask_t task, MSKintt num, MSKCONST MSKidxt * subj, MSKCONST MSKrealt * val);
Replaces a conic constraint with a new conic constraint.
MSKrescodee MSK_putcone (MSKtask_t task, MSKidxt k, MSKconetypee conetype, MSKrealt conepar, MSKintt nummem, MSKCONST MSKidxt * submem);
Set defaults CPU type and cache sizes. This function should be called before MSK_initenv.
MSKrescodee MSK_putcpudefaults (MSKenv_t env, MSKintt cputype, MSKintt sizel1, MSKintt sizel2);
The function is used to input a user defined ctrl-c function which is called occasionally during the optimization process. If the ctrl-c function returns a nonzero value, then MOSEK terminates the optimization process and returns with the return code MSK_RES_TRM_USER_BREAK.
Note the function is only called if the parameter MSK_IPAR_CHECK_CTRL_C is set to MSK_ON.
MSKrescodee MSK_putctrlcfunc (MSKenv_t env, MSKctrlcfunc ctrlcfunc, MSKCONST void * handle);
Sets the path to DLL/shared libraries that MOSEK are loading. If needed, then it should normally be called before MSK_initenv.
MSKrescodee MSK_putdllpath (MSKenv_t env, MSKCONST MSKstring_t dllpath);
Sets the value of a double parameter.
MSKrescodee MSK_putdouparam (MSKtask_t task, MSKdparame param, MSKrealt parvalue);
In the case MOSEK has a fatal error, then an exit function is called. The exit function should terminate MOSEK. In general it is not necessary to define an exit function.
MSKrescodee MSK_putexitfunc (MSKenv_t env, MSKexitfunc exitfunc, MSKCONST void * handle);
Sets the compression type for a file.
MSKrescodee MSK_putfilecompression (MSKfile_t file, MSKintt compression);
Sets the io mode for a file.
MSKrescodee MSK_putfileiomode (MSKfile_t file, MSKintt iomode);
Sets the value of an integer parameter.
MSKrescodee MSK_putintparam (MSKtask_t task, MSKiparame param, MSKintt parvalue);
Controls whether explicit loaded DLLs should be kept even after they no longer are in use.
MSKrescodee MSK_putkeepdlls (MSKenv_t env, MSKintt keepdlls);
Set defaults used by the license manager. This function should be called before MSK_initenv.
MSKrescodee MSK_putlicensedefaults (MSKenv_t env, MSKCONST MSKstring_t licensefile, MSKCONST MSKintt * licensebuf, MSKintt licwait, MSKintt licdebug);
MOSEK stores only the nonzero elements in . Therefore, MOSEK
cannot predict how much storage is required to store
. Using this function
it is possible to specify the maximum nonzeros reserved for storing
.
It may be advantageous to reserve more nonzeros for than
actually needed because it may improve the internal efficiency of MOSEK.
However, it is never worthwhile to specify more than
the double of the anticipated number of nonzeros in
.
MSKrescodee MSK_putmaxnumanz (MSKtask_t task, MSKlintt maxnumanz);
The function changes the maximum number of constraints allowed in a task. Observe that maxnumcon must be larger than the current number of constraints in the task.
MSKrescodee MSK_putmaxnumcon (MSKtask_t task, MSKintt maxnumcon);
The function changes the maximum number of conic constraints allowed in a task. Observe that maxnumcone must be larger than the number of cones in the task.
MSKrescodee MSK_putmaxnumcone (MSKtask_t task, MSKintt maxnumcone);
Specifies the maximum number of nonzeros allowed in all the
matrices (both objective and constraints).
MSKrescodee MSK_putmaxnumqnz (MSKtask_t task, MSKlintt maxnumqnz);
The function changes the maximum number of variables allowed in a task. Observe that maxnumvar must be larger than the number of variables in the task.
MSKrescodee MSK_putmaxnumvar (MSKtask_t task, MSKintt maxnumvar);
Sets the value of a named double parameter.
MSKrescodee MSK_putnadouparam (MSKtask_t task, MSKCONST MSKstring_t paramname, MSKrealt parvalue);
Sets the value of a named integer parameter.
MSKrescodee MSK_putnaintparam (MSKtask_t task, MSKCONST MSKstring_t paramname, MSKintt parvalue);
Assigns the name name to a problem item such as a constraint.
MSKrescodee MSK_putname (MSKtask_t task, MSKproblemiteme whichitem, MSKidxt i, MSKCONST MSKstring_t name);
Sets the value of a named string parameter.
MSKrescodee MSK_putnastrparam (MSKtask_t task, MSKCONST MSKstring_t paramname, MSKCONST MSKstring_t parvalue);
This function is used to communicate the nonlinear function information to MOSEK.
MSKrescodee MSK_putnlfunc (MSKtask_t task, MSKCONST void * nlhandle, MSKnlgetspfunc nlgetsp, MSKnlgetvafunc nlgetva);
Assigns the name objname to the objective function.
MSKrescodee MSK_putobjname (MSKtask_t task, MSKCONST MSKstring_t objname);
Checks if parname is valid parameter name. If yes then, then parameter is set to value specified by parvalue.
MSKrescodee MSK_putparam (MSKtask_t task, MSKCONST MSKstring_t parname, MSKCONST MSKstring_t parvalue);
Replaces all the quadratic terms in the constraints with new ones.
MSKrescodee MSK_putqcon (MSKtask_t task, MSKlintt numqcnz, MSKCONST MSKidxt * qcsubk, MSKCONST MSKidxt * qcsubi, MSKCONST MSKidxt * qcsubj, MSKCONST MSKrealt * qcval);
Replaces all the quadratic entries in one constraint.
MSKrescodee MSK_putqconk (MSKtask_t task, MSKidxt k, MSKlintt numqcnz, MSKCONST MSKidxt * qcsubi, MSKCONST MSKintt * qcsubj, MSKCONST MSKrealt * qcval);
Replaces all the quadratic terms in the objective with new ones.
MSKrescodee MSK_putqobj (MSKtask_t task, MSKlintt numqonz, MSKCONST MSKidxt * qosubi, MSKCONST MSKidxt * qosubj, MSKCONST MSKrealt * qoval);
Replaces one of the coefficients in the quadratic term
in the objective. I.e. the procedure performs the assignment
MSKrescodee MSK_putqobjij (MSKtask_t task, MSKidxt i, MSKidxt j, MSKrealt qoij);
Inserts a solution into the task.
MSKrescodee MSK_putsolution (MSKtask_t task, MSKsoltypee whichsol, MSKCONST MSKstakeye * skc, MSKCONST MSKstakeye * skx, MSKCONST MSKstakeye * skn, MSKCONST MSKrealt * xc, MSKCONST MSKrealt * xx, MSKCONST MSKrealt * y, MSKCONST MSKrealt * slc, MSKCONST MSKrealt * suc, MSKCONST MSKrealt * slx, MSKCONST MSKrealt * sux, MSKCONST MSKrealt * snx);
Sets the primal and dual solution information for a single constraint or variable. If a sequence of function calls MSK_putsolutioni is used defined to a new solution, then normally the function MSK_makesolutionstatusunknown should be called before the first call of the function MSK_putsolutioni.
MSKrescodee MSK_putsolutioni (MSKtask_t task, MSKaccmodee iscon, MSKidxt i, MSKsoltypee whichsol, MSKstakeye sk, MSKrealt x, MSKrealt sl, MSKrealt su, MSKrealt sn);
Input the dual variable of a solution.
MSKrescodee MSK_putsolutionyi (MSKtask_t task, MSKidxt i, MSKsoltypee whichsol, MSKrealt y);
Sets the value of a string parameter.
MSKrescodee MSK_putstrparam (MSKtask_t task, MSKsparame param, MSKCONST MSKstring_t parvalue);
Assigns the name taskname to the task.
MSKrescodee MSK_puttaskname (MSKtask_t task, MSKCONST MSKstring_t taskname);
Sets the variable type of one variable.
MSKrescodee MSK_putvartype (MSKtask_t task, MSKidxt j, MSKvariabletypee vartype);
Sets the variable type for one or more variables. I.e. variable subj[k] is assigned the variable type vartype[k].
MSKrescodee MSK_putvartypelist (MSKtask_t task, MSKintt num, MSKCONST MSKidxt * subj, MSKCONST MSKintt * vartype);
Reads problem data associated with the optimization task from a file.
The expected format of the data file is determined based on parameter MSK_IPAR_READ_DATA_FORMAT. If this parameter has the (default) value MSK_DATA_FORMAT_EXTENSION, then the extension of the file name is used to determine the file format. I.e. if file name has the extension .lp.gz then it is assumed to be a compressed LP formatted file is written.
MSKrescodee MSK_readdata (MSKtask_t task, MSKCONST MSKstring_t filename);
Reads problem data from a file. A call to this procedure destroys whatever problem data is already defined in the task.
MSKrescodee MSK_readdatafile (MSKtask_t task, MSKfile_t file, MSKintt format);
Reads a parameter file.
MSKrescodee MSK_readparamfile (MSKtask_t task);
Reads a solution file and inserts the solution into the solution whichsol.
MSKrescodee MSK_readsolution (MSKtask_t task, MSKintt whichsol, MSKCONST MSKstring_t filename);
Prints a short summary related to the last MPS file that was read.
MSKrescodee MSK_readsummary (MSKtask_t task, MSKintt whichstream);
This function creates a problem that computes a minimal (weighted) relaxation of the bounds that will make an infeasible problem feasible.
Given an existing task describing the problem
![]() |
(2.5) |
Hence, if the problem () is optimized, then the minimal change
to the bounds in a weighted sense is computed that will make the problem feasible.
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 (
), then
a natural thing to do is to solve the optimization problem
The parameter MSK_IPAR_FEASREPAIR_OPTIMIZE controls
whether the function returns the problem () or the
problem (
).The parameter can take one of the
following values.
Note that the variables are appended to the
variables in the
order
If NAME_CON (NAME_VAR) is the name of the th
constraint (variable) then the new variables are named as follows:
where ``*'' is a user defined separator string given by the parameter MSK_SPAR_FEASREPAIR_NAME_SEPARATOR.
The above discussion shows how the function works for an linear optimization problem. However, the function works in a similar way for quadratic and conic optimization problems but it cannot be used for general nonlinear optimization problems.
Note that if
or
then the feasibility repair
problem becomes infeasible. Such trivial conflicts
must therefor be removed manualy befor using
MSK_relaxprimal.
MSKrescodee MSK_relaxprimal (MSKtask_t task, MSKtask_t * relaxedtask, MSKrealt * wlc, MSKrealt * wuc, MSKrealt * wlx, MSKrealt * wux);
The function removes a number of constraints or variables from the optimization task. this implies that the existing constraints and variables are renumbered. For instance if constraint 5 is removed then constraint 6 becomes constraint 5 and so forward.
MSKrescodee MSK_remove (MSKtask_t task, MSKaccmodee iscon, MSKintt num, MSKCONST MSKintt * sub);
Remove a conic constraint from the problem. Observe this implies that all the conic constraints appearing after the removed cone is renumbered. I.e. their index is decreased by one.
In general it is much more efficient to remove a cone with a high index than a low index.
MSKrescodee MSK_removecone (MSKtask_t task, MSKidxt k);
Replaces the file extension in a file name by a new one.
void MSK_replacefileext (MSKstring_t filename, MSKCONST MSKstring_t newextension);
Resize the maximum dimension for a MOSEK task. Note the procedure is destructive meaning the data stored in the task is destroyed.
MSKrescodee MSK_resizetask (MSKtask_t task, MSKintt maxnumcon, MSKintt maxnumvar, MSKintt maxnumcone, MSKlintt maxnumanz, MSKlintt maxnumqnz);
Read a sensitivity format file from location given by MSK_SPAR_SENSITIVITY_FILE_NAME and write the result to the stream whichstream. If MSK_SPAR_SENSITIVITY_RES_FILE_NAME is set to a non empty string, then the sensitivity report is also written to a file of this name.
MSKrescodee MSK_sensitivityreport (MSKtask_t task, MSKstreamtypee whichstream);
Resets all the parameters to their default values.
MSKrescodee MSK_setdefaults (MSKtask_t task);
Obtains a explanatory string corresponding to a status key.
MSKrescodee MSK_sktostr (MSKtask_t task, MSKintt sk, MSKstring_t str);
Obtains a explanatory string corresponding to a solution status.
MSKrescodee MSK_solstatostr (MSKtask_t task, MSKsolstae solsta, MSKstring_t str);
Checks whether a solution defined.
MSKrescodee MSK_solutiondef (MSKtask_t task, MSKintt whichsol, MSKintt * isdef);
Prints a short summary related to the current solution.
MSKrescodee MSK_solutionsummary (MSKtask_t task, MSKstreamtypee whichstream);
If a basic solution is available, then exactly
basis variables are defined.
Those
basis variables are denoted the basis. Associated with the basis
is a basis matrix denoted
.
This function solves either the linear equation system
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
is constructed.
When calling MSK_initbasissolve a ordering
of the basis variables is obtained. This ordering can be used to deduce how MOSEK has constructed
. Indeed
if the
th basis variable is variable
then this implies
Observe this function exploits the sparsity in the vector to speed up the computations.
MSKrescodee MSK_solvewithbasis (MSKtask_t task, MSKintt transp, MSKintt * numnz, MSKidxt * sub, MSKrealt * val);
OBSERVE val is dense vector and NOT a packed sparse vector. This implies val has room for numcon elements.
Starts the statistics file.
MSKrescodee MSK_startstat (MSKtask_t task);
Stops the statistics file.
MSKrescodee MSK_stopstat (MSKtask_t task);
Make a copy of a string. The string created by this procedure must be freed by MSK_freeenv.
MSKCONST MSKrescodee MSK_strdupdbgenv (MSKenv_t env, MSKCONST MSKstring_t str, MSKCONST MSKstring_t file, unsigned line);
Make a copy of a string. The string created by this procedure must be freed by MSK_freetask.
MSKCONST MSKrescodee MSK_strdupdbgtask (MSKtask_t task, MSKCONST MSKstring_t str, MSKCONST MSKstring_t file, unsigned line);
Make a copy of a string. The string created by this procedure must be freed by MSK_freeenv.
MSKCONST MSKrescodee MSK_strdupenv (MSKenv_t env, MSKCONST MSKstring_t str);
Make a copy of a string. The string created by this procedure must be freed by MSK_freetask.
MSKCONST MSKrescodee MSK_strduptask (MSKtask_t task, MSKCONST MSKstring_t str);
Obtains cone type code corresponding to a cone type string.
MSKrescodee MSK_strtoconetype (MSKtask_t task, MSKCONST MSKstring_t str, MSKintt * conetype);
Obtains the status key corresponding to a explanatory string.
MSKrescodee MSK_strtosk (MSKtask_t task, MSKCONST MSKstring_t str, MSKintt * sk);
Obtains the value corresponding to a symbolic name defined by MOSEK.
MSKrescodee MSK_symnamtovalue (MSKCONST MSKstring_t name, MSKstring_t value);
Undefines a solution.
MSKrescodee MSK_undefsolution (MSKtask_t task, MSKintt whichsol);
Disconnects a user defined function to a stream.
MSKrescodee MSK_unlinkfuncfromenvstream (MSKenv_t env, MSKstreamtypee whichstream);
Disconnects a user defined function to a task stream.
MSKrescodee MSK_unlinkfuncfromtaskstream (MSKtask_t task, MSKstreamtypee whichstream);
Checks if parname is valid parameter name. If yes then, partype and param denotes the type and the index of parameter respectively.
MSKrescodee MSK_whichparam (MSKtask_t task, MSKCONST MSKstring_t parname, MSKintt * partype, MSKparametertypee * param);
Write problem data associated with the optimization task to a file in one of three formats i.e. the LP, the MPS, or the MBT format.
The type of the data file written is determined either based on parameter MSK_IPAR_WRITE_DATA_FORMAT. If the parameter MSK_IPAR_WRITE_DATA_FORMAT has the (default) value MSK_DATA_FORMAT_EXTENSION, then the extension of the file name is used to determine the file format. I.e. if file name has the extension .lp.gz then a compressed LP formatted file is written.
Note in the case no names has been inputted into the task an anonymous names are required in the data file, then the option MSK_IPAR_WRITE_GENERIC_NAMES should be turned on.
MSKrescodee MSK_writedata (MSKtask_t task, MSKCONST MSKstring_t filename);
Write problem data associated with the optimization task to a file in one of three formats i.e. the LP, the MPS, or the MBT format.
Note in the case no names has been inputted into the task an anonymous names are required in the data file, then the option MSK_IPAR_WRITE_GENERIC_NAMES should be turned on.
MSKrescodee MSK_writedatafile (MSKtask_t task, MSKfile_t file, MSKintt format);
Writes all the parameters to a parameter file.
MSKrescodee MSK_writeparamfile (MSKtask_t task, MSKCONST MSKstring_t filename);
Saves the current basic, interior-point, or integer solution to a file.
MSKrescodee MSK_writesolution (MSKtask_t task, MSKintt whichsol, MSKCONST MSKstring_t filename);