I am a (almost) beginner with CPLEX and optimization. I am trying to set up an optimization problem in Matlab using the newly added feature of CPLEX (12.7.1), which enables the definition of piecewise linear (PWL) constraints.
However, it is not clear to me how to do it in Matlab. The documentation on this is quite sparse. IBM has only one example (transport.m) , which defines the piecewise linear constraint as a combination of linear equalities and SOSs of type 2. However, this is not really using the newly added feature to directly specify a piecewise linear function. And the procedure in matlab can become quite cumbersome as the number of variables and piecewise constraints increase.
Do you know if there is a way to express it differently, in Matlab?
Thank you
The new piecewise linear constraint support you mention was announced in the release notes here (In version 12.7.0). The MATLAB API was not included in that list. If having the functionality directly in MATLAB is important to you, you could add a request for it in the IBM RFE Community. In the meantime, you'll need to use one of the other APIs (C, C++, Java, .NET, Python).
You could call another executable from within MATLAB using the system command. On the other hand, besides requiring a bit more work, your current technique should be fine.
Related
I am trying to implement bayesian optimization using gauss process regression, and I want to try the multiple output GP firstly.
There are many softwares that implemented GP, like the fitrgp function in MATLAB and the ooDACE toolbox.
But I didn't find any available softwares that implementd the so called multiple output GP, that is, the Gauss Process Model that predict vector valued functions.
So, Are there any softwares that implemented the multiple output gauss process that I can use directly?
I am not sure my answer will help you as you seem to search matlab libraries.
However, you can do co-kriging in R with gstat. See http://www.css.cornell.edu/faculty/dgr2/teach/R/R_ck.pdf or https://github.com/cran/gstat/blob/master/demo/cokriging.R for more details about usage.
The lack of tools to do cokriging is partly due to the relative difficulty to use it. You need more assumptions than for simple kriging: in particular, modelling the dependence between in of the cokriged outputs via a cross-covariance function (https://stsda.kaust.edu.sa/Documents/2012.AGS.JASA.pdf). The covariance matrix is much bigger and you still need to make sure that it is positive definite, which can become quite hard depending on your covariance functions...
I have a function fun(x,y,z), such that say, x=1:10, y=50:60, z=100:105. Which optimization method (and how) I can use to get the minimum of this function, for example, where (x,y,z)=(3,52,101). I am working in Matlab.
Thank you for any help
Algorithms
There are many many algorithms out there that you can use for direct search optimization such as Nelder-Mead, Particle Swarm, Genetic Algorithm, etc.
I believe Nelder-Mead is a simplex optimization method which is used by fminsearch function in MATLAB.
Also, there is Genetic Algorithm which comes with MATLAB Global Optimization toolbox. You may want to give that a try as well.
Particle Swarm Optimization (PSO) is another direct search method that you can use. However, there is no official toolbox for Particle Swarm method built by Mathworks. The good news is there is quite a few PSO toolbox developed by other people. I personally have used this one and am quite happy with the performance. Its syntax is similar to Genetic Algorithm functions that come with Global Optimization Toolbox.
Discrete Optimization
Regarding your question that you are looking for a set of integer values namely x,y, and z corresponding to the minimum objective function value, I would add a part at the beginning of the objective function that rounds the variables to the closest integers and then feeds them to your main function fun(x,y,z). This way you would discretize your function space.
I hope my answer helps.
What algorithm is used by the matlab function linopt::minimize ? I have to write the source code for solving a Mixed Integer Linear Programming problem. Please tell me the algorithms I can work upon.
It is not specified in the documentation of Mathlab (c.f. http://www.mathworks.fr/fr/help/symbolic/mupad_ref/linopt-minimize.html). However, they do provide some references at the end of the page (you should have a look there).
My guesses are the following (based on my humble knowledge regarding state-of-the-art methods for solving LP/MILP) :
1-If the problem is not MILP, we usually use the simplex algorithm (http://en.wikipedia.org/wiki/Simplex_algorithm).
2-If the problem is MILP (i.e. there is some integer variables), one usually use a Branch and Bound algorithm in which we might use simplex for improving the search (we call it Branch and Cut)
P.S. This is not an exhaustive response since other methods can be used but the above are the most known ones.
I'm quite surprised not to find one in standard library. Is there some reason it is missing or I just need to use a specific toolbox?
Implementing it myself would be very problematic because of the complexity of algorithm involved.
As far as I understand, CPLEX, LP_solve and GLPK, among other LP solvers, offer sensitivity analysis.
I have the above three solvers installed on my machine, along with these two MATLAB wrappers:
CPLEX for MATLAB API (for CPLEX)
YALMIP (a general MATLAB wrapper for several solvers)
I looked in the documentation of these two wrappers but could not find a way of running sensitivity analysis from them. Do they support it? If not, are there any LP solvers that offer MATLAB support for their sensitivity analysis?
What do I mean by sensitivity analysis?
I mean sensitivity analysis with respect to the cost function and constraints. Conceptually speaking, sensitivity analysis tries to address the following question:
How would the solution change if some aspect of the problem is
changed?
For example:
What is the range of values the coefficient for the variable j can
take without affecting the optimality of the solution?
More specifically, here is a list of the Java, C++ and C APIs that CPLEX provides for sensitivity analysis.
Here is information about the sensitivity analysis provided by LP_solve. You can find the help text for the previous link within LP_solve's main reference guide by searching for "sensitivity" here.