This question already has an answer here:

I have a mixed integer (quadratic/linear) optimization problem with about 3000 variables in a form which I can't extract the coefficient vectores. However MILP solver in Matlab requires the f input which is a column vector of coefficients as input and A which is coefficient matrix in constraints.

Is there any toolbox which I can define the objective function and constraints like a function (similar to matlab ga gets the handle to the objective and constraint functions )?


marked as duplicate by Anton Menshov, Christian Clason, nicoguaro Nov 8 '18 at 13:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ You haven't told us what MILP solver you're attempting to use. However, if you have the ability to compute $Ax$ by calling a subroutine and $x$ is a vector of only 3,000 variables, then you can easily reconstruct the columns of $A$ by multiplying $A$ times each of the columns of a 3,000 by 3,000 identity matrix. Is the issue here that $A$ has so many rows that you can't store it? How big is $A$? $\endgroup$ – Brian Borchers Aug 31 '15 at 2:42
  • 2
    $\begingroup$ When you say you cannot extract the coefficients, do you mean that you are not capable of doing so, or that the model is not linear and does not have any such representation? YALMIP for instance lets you define the model in a high-level format and automatically call MILP solvers in MATLAB. $\endgroup$ – Johan Löfberg Aug 31 '15 at 9:08
  • $\begingroup$ @JohanLöfberg Thank you for your reply. In fact I'm not able to extract the coefficients. because the problem is defined in a high level format. for the quadratic problem it's variance(f(x),g(x) + varianc(c(x),d(x))... and x is of the size 3000. the linear problem is defined in a similar high level format and it's not easy to find the coeffs matrix or I don't know how to at least. $\endgroup$ – sarah daneshvar Aug 31 '15 at 18:06
  • $\begingroup$ Johnan is trying to tell you that you can use YALMIP users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Main.Download to directly input the problem in a high level format. You can directly use var for variance, as described in my answer scicomp.stackexchange.com/questions/19838/… . YALMIP does the "dirty work" for you to convert the high level specification into a form which solvers can use. $\endgroup$ – Mark L. Stone Sep 13 '15 at 11:12
  • $\begingroup$ I see that Johan has provided a YALMIP solution at scicomp.stackexchange.com/questions/20607/… $\endgroup$ – Mark L. Stone Sep 13 '15 at 11:21

Browse other questions tagged or ask your own question.