Interior-point linear programing solver in MATLAB, with target barrier parameter option - matlab

Is there any linear programing solver, written for MATLAB, that (a) solves with the primal-dual interior point method, (b) the user has the options to set the target barrier parameter (he lowest value of barrier parameter for which the KKT system is solved)?
I currently use IPOPT, which has the target barrier parameter options.
However, at convergence, the product of dual*slack seems to only be approximately satisfied (with an error of say (+-)1e-7 for a target parameter of 1e-5).
I have tried to play around with the tolerances, but to no avail.

For MATLAB use, I recommend using CVX, which includes Gurobi, MOSEK, GLPK, and SDPT3. All of those can solve the linear program very efficiently.
CVX is very easy to use in MATLAB.

Related

Define initial parameters of a nonlinear fit with no information

I was wondering if there exists a technical way to choose initial parameters to these kind of problems (as they can take virtually any form). My question arises from the fact that my solution depends a little on initial parameters (as usual). My fit consists of 10 parameters and approximately 5120 data points (x,y,z) and has non linear constraints. I have been doing this by brute force, that is, trying parameters randomly and trying to observe a pattern but it led me nowhere.
I also have tried using MATLAB's Genetic Algorithm (to find a global optimum) but with no success as it seems my function has a ton of local minima.
For the purpose of my problem, I need justfy in some manner the reasons behind choosing initial parameters.
Without any insight on the model and likely values of the parameters, the search space is too large for anything feasible. Think that just trying ten values for every parameter corresponds to ten billion combinations.
There is no magical black box.
You can try Bayesian Optimization to find a global optimum for expensive black box functions. Matlab describes it's implementation [bayesopt][2] as
Select optimal machine learning hyperparameters using Bayesian optimization
but you can use it to optimize any function. Bayesian Optimization works by updating a prior belief over a distribution of functions with the observed data.
To speed up the optimization I would recommend adding your existing data via the InitialX and InitialObjective input arguments.

Optimization of multivariable function In Matlab

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.

Some issues with fmincon in matlab

I was using Matlab's fmincon but the optimization stopped with the following message
fmincon stopped because the size of the current step is less than
the selected value of the step size tolerance.
I have TolX set to 10^-10 and Tolfun to 10^-10 as well
I checked the logs and the first-order optimality was 198. Therefore this is definitely not the optimum solution. What could possibly go wrong?
Further, I used different version of matlab R2013b and R2014a and for the same code and data, they have different results. Is there something wrong with fmincon in matlab R2013b?
When you have a question about the difference between two versions of Matlab or, as in this case, two toolbox versions, the first place to check is release notes: for Matlab and for the Optimization toolbox. Indeed, it seems that fmincon was updated. Do you specify an 'Algorithm'? If not, the difference may be due the different default in R2014a. In this case, you may be able to specify the use of the 'interior-point' algorithm in R2013b and get better results.
You can read about the algorithms used by fmincon here.

alternatives to lsqlin MATLAB

Ok so I have a script that runs among other things lsqlin optimization function millions of times. To speed up this code I "codegen" it (basically automatically creates some mex files). This is a followup of Linear systems of inequations.
The problem here is that lsqlin as well as other optimization functions are not transformed and need to be called externally, which leads to loss of efficient.
I already found the MINQ toolbox but could not understand how to translate from lsqlin to this. Also found the QPC toolbox which requires a licence, which I am currently waiting.
Does anyone suggest another toolbox and how to convert from lsqlin to that?
General idea to codegen a lsqlin script (as can be seen a link is called and not a full conversion).
CODE:
function main_script()
coder.extrinsic('lsqlin_script')
for i=1:10^7
X=lsqlin_script(A,b,X0)
...
end
end
function X=lsqlin_script(A,b,X0)
X=lsqlin(eye(2),X0, A, b,[],[],[],[],X0, optimoptions('lsqlin','Display','Off'));
end
RUN:
codegen main_script.m
main_script_mex(INPUTS)
If you would describe your original problem I think you could expect more answers.
A possible approach to avoid lsqlin:
Calculate the orthogonal projection of Pxyz onto every plane defined by A and b.
Check whether the projections satisfy the inequality requirements. From those which satisfy select the closest point to Pxyz. If no valid point is found then the closest point will be on the intersection of planes. Calculate the shortest distance from Pxyz to every intersection lines... follow the steps applied for projection on planes..
As you can see it is not fully elaborated, you should work out the details if you think it may solve your problem.
For these calculations you do not need optimization function.

Constrained mixed integer optimization: genetic algorithm used with SimEvents. How can I set a simulation output as a constraint?

I'm using the genetic algorithm from the MATLAB Global Optimization Toolbox with SimEvents, in order to implement a mixed integer optimization making use of simulation outputs to evaluate the fitness function. My model is pretty similar to the one described in this video from MathWorks website:
http://www.mathworks.it/videos/optimizing-manufacturing-production-processes-68961.html
Reading the documentation, I found that ga can solve constrained problems only if such constraints are linear inequalities. The constraints are supposed to be written as functions of the problem's variables, that in this case are the number of resources used during the simulation.
I would like, instead, to set a constraint that takes into account another simulation output (e.g. the drain utilization), i.e. minimize
objfun = backlog*10000 + cost
where backlog is a simulation output (obtained using simOut.get), considering the following constraint:
drain_utilization > 0.7
where drain_ utilization is another simulation output (again, obtained using simOut.get).
Is it possible or this feature is not supported by the Global Optimization Toolbox?
Thank you in advance and forgive me for any improper term, but I'm new to the Global Optimization Toolbox.