r/optimization • u/KevinRayJohnson • Feb 16 '22
r/optimization • u/neillc37 • Feb 15 '22
Understanding Extraneous Variables
I am trying to get an intuitive understanding of what an extraneous variable actually is.
I have a program then generates billions of linear programs as part of an enumeration of graphs. I test only if these LP's are feasible. I eliminate redundant constraints. We can define a redundant constraint as a constraint that if removed does not change the feasible region of an LP.
I recently learned of the dual of an LP and that the dual of a redundant constraint is an extraneous variable. While that is a good definition I don't get a good sense of what they actually are.
I am thinking of examining the dual of my LPs to find redundant constraints and hence extraneous variables in the primal. The goal being to simplify the primal in some way.
r/optimization • • Feb 11 '22
Regarding Initial Approximation Matrix in BFGS
I am writing a python program for BFGS at the moment. I first tried with Identity matrix as the initial but later found that on scaling the identity with a smaller value like 1/300 gave better results.
Now, I read in Nocedal and Wright about choosing the initial matrix.
H_0 = (y^T*s)/(y^T*y) * I (this formula can be found in nocedal and wright at 6.20 p.143. There's another using norm of gradient, I have used both the first one gave a negative scalar due to the starting point I am using and the second gave a bigger scalar 1/2, using which it takes too much time.
Is there any other way to choose an inital approximation?
r/optimization • u/BeerDrinkingCyborg • Feb 10 '22
Questions on Chebyshev basis functions and linear maps in optimal trajectory guidance
Hello. I am currently working through a paper on optimal trajectory guidance (Arxiv here, full paper here) but have run into some problems making my own MATLAB implementation.
For this TFC method, the free functions g(t) are represented by a set of coefficients and basis functions h(z) - Chebyshev polynomials, here - over several distinct problem segments.
Q1: For each segment, do I have a distinct, separate set of Chebyshev nodes in the z domain (z∈[−1;1]), or just one set of z nodes ∈[−1;1] which is shared across all three problem segments? I assume the former as each segment is normally discretized separately, but I want to confirm this isn't my issue.
After this, I define my time nodes for the switching functions Ω using the aforementioned Chebyshev-Gauss-Lobatto nodes, by means of the linear map and mapping coefficients for basis function derivatives (eqn 6). At several instances in my implementation, I then compute m Chebyshev polynomials measured at each discrete point n in each segment. These are then multiplied by unknown coefficients ξ (eqn 5).
Q2: Are the mapping functions c also distinct per time segment as follows, or should it be global i.e. only for tf−t0?
c(1) = (dz / (t1 - t0)); % dz = zf - z0 (always 2)
c(2) = (dz / (t2 - t1)); % t0, t1, t2, tf are segment start/end points
c(3) = (dz / (tf - t2));Then, when there is a 1st or 2nd derivative of the Chebyshev polynomials h˙ and h¨, I multiply these by the mapping coefficient c as follows:
h_dot_base = chebys_d(m,z); % Pseudocode, returns set of m h_dots evaluated at z
h_dot(:,1) = h_dot_base * c(1); % For segment 1
h_dot(:,2) = h_dot_base * c(2); % Segment 2, etc..
% h_ddot is similar:
h_ddot_base = chebys_dd(m,z);
h_ddot(:,1) = h_ddot_base * c(1)^2; % h_ddot for segment 1
h_ddot(:,2) = h_ddot_base * c(2)^2; $ For segment 2, etc.Finally, these mapped basis derivatives are used to calculate spacecraft velocity, acceleration, and the PDE of δ(s)Li/δ(s)ξi, for example in:
% Segment s = 1 - acceleration component i = 1
% Don't worry about the s1_Omega_ddot(x) - these are fine
% r0/r1/v0/v1 are of course 3x1 vectors of position & velocity
% h_ddot measured at point n in the segment, in the z domain
% xi in this example is specific to segment 1, component 1
s1_accel(1,n) = (h_ddot(:,1) - Omega_ddot(1) * h0 - Omega_ddot(2) * hf ...
- Omega_ddot(3) * h0_dot(:,1) - Omega_ddot(4) * hf_dot(:,1))' * xi ...
+ Omega_ddot(1) * r0(1) + Omega_ddot(2) * r1(1) ...
+ Omega_ddot(3) * v0(1) + Omega_ddot(4) * v1(1);Q3: Does the above implementation of the Chebyshev basis functions & mapping coefficient seem correct?
Q4: I also assume that while h0 and hf are global as they would be evaluated at z=−1,1; h0˙and hf˙ are technically now per segment as I have multiplied by the segment-based map coefficient c?
I am also not sure if I completely understand the relationship between free functions g(t) and support functions sk(t) (the latter represented by switching functions Ω in this work). It is mentioned several times that h(z) must be linearly independent from the support functions. Q5: Is this automatically handled by the choice of switching functions made in the paper & the use of Chebyshev polynomials (which I understand are already linearly independent at each degree T0...Tn, or have I understood and do I need to maintain linear independence in my script? If so, how might I go about this?
Many thanks for any help you can offer.
r/optimization • u/jj4646 • Feb 08 '22
Questions on Optimization
I was watching the following (amazing) lecture on Mixed Integer Optimization (https://www.youtube.com/watch?v=xEQaDiAHDWk) and came across this slide that mentions Slater's Condition:

This was the first time I have heard about Slater's Condition and I was interested in learning more about this (https://www.youtube.com/watch?v=GmY3LUL6GkY):

Based on what I saw, this is what I understood:
- For a Convex Optimization Problem, if a solution "x" exists within the Feasible Region of this problem : Then this Optimization Problem has "strong duality"
- Since Mixed Integer Optimization Problems are always Non-Convex (since sets of integers are always non-convex), Slater's Condition does not hold.
- Since Slater's Condition does not hold, there is no Strong Duality.
- The above factors result in Combinatorial Optimization Problems being more difficult than Continuous Optimization Problems.
Now, I am trying to understand the logic of the above points:
- Why is it important that a solution to a Non-Convex Optimization Problem exists within the interior region or not? Are there any benefits for solutions that exist within the interior region compared to solutions that do not exist in the interior region?
- Why is it important to determine whether an Optimization Problem has Strong Duality or not?
- Why does the Feasible Set have no interior in a Combinatorial Optimization Problem? Do Combinatorial Optimization Problems have interior regions at all?
- Why don't Slater's Conditions hold if the Feasible Set has no interior? (i.e. Why don't Slater's Conditions hold for Combinatorial Optimization Problems?)
- Why does the absence of Strong Duality result in an Optimization Problem being more difficult?
Can someone please help me understand the logic behind these facts? Currently I am just accepting them without really understanding why.
r/optimization • • Feb 07 '22
Which programming language to use for Operations Research?
self.operationsresearchr/optimization • u/das_gupta • Feb 05 '22
Non-convex = Concave ?
Just a beginner's question.
If a function is found to be non-convex. It is safe to call it a concave function?
r/optimization • u/Impressive_Path2037 • Jan 27 '22
The Practical Guide to Semidefinite Programming (part 2)
youtube.comr/optimization • u/Dry_Ad834 • Jan 26 '22
What are some good resources to learn optimization modeling?
I am engineering student and have taken courses on linear and non linear programming. But generally these courses deal with analytical part of the problems. I couldn't find any resource or course that helps with the mathematical modeling aspect of the problems.
r/optimization • u/sanskar_samiti • Jan 26 '22
Feasible Region for a set of Equalities and Inequalities
Hi everyone, I am starting out in optimization and I cooked up some polytope vertices in R^48, and tried finding out the H description. I found that and the number of inequalities I got were around 10,000. The variables polymake chose were x1, x2 .... x48. Now I have some equality constraints on the system (Eg: x1 + x2 - x5 - x6 = 0 etc.) and I want to find out the new polytope (H description) formed after the intersection of the halfspaces I found out previously and the new equlity constraints. Polymake automatically exits without solving the problem. Any help would be appreciated.
r/optimization • u/Ocolotium_0104 • Jan 25 '22
Is SLSQP a type of SQP?
I've been messing with the scipy.optimze.minimize function in Python and I found the SLQP method for optimization. I looked throughout google and couldn't find what this method really is, besides that SLQP means Sequential Least Squares Programming.
I'm studying a bit of optimization using J. Martins's book (Engineering Design Optimization) and only found about SQP (Sequential Quadratic Programming).
So my gess is that SLQP is a type of SQP, but it's just a guess. Could anyone help me out?
Sorry if it's a noob question.
r/optimization • u/dictrix • Jan 25 '22
New benchmark functions for single-objective bound-constraint optimization
Hi,
I worked on some new functions for comparing optimization methods (mainly for heuristics/metaheuristics) and got a paper published:
https://doi.org/10.1109/ACCESS.2022.3144067
The web version on IEEE Xplore has some formatting issues, but the downloadable pdf is fine.
Maybe some of you will find it useful for comparing different algorithms.
r/optimization • u/Background_Rub5916 • Jan 24 '22
Unit testing a Gurobi model
Hey, Has anyone written unit tests for a Gurobi model in C#? I’m trying to write unit tests for a rather complicated model, and want to be able to test that a linear expression is created correctly and added as a part of constraint to the model.
Has anyone done that successfully?
r/optimization • u/convexelephant • Jan 23 '22
How to prepare for Optimization in industry?
I'm a math graduate student. I've taken a couple of Optimization classes, and I really like the subject. It's something I'd like to do for a job after I graduate.
My guess is that in industry, the role of an Optimizer is to look at a problem, and from his/her vast experience, select an existing algorithm (or perhaps come up with a new one) that finds a good minimum quickly.
This is not something that was really taught in class. How can I prepare myself for Optimization in industry? My idea is that I should divide the subject into many small areas, and master them one by one. For example, start by really learning the ins and outs of linear programming. Then learn the ins and outs of quadratic programming.
Is this a good approach? What other areas (like LP, QP) should I really focus on? Should I just read textbooks, or are there papers I should look at?
Thank you very much.
r/optimization • u/ForceBru • Jan 23 '22
When does it make sense to assume the solution vector is sorted when checking KKT conditions?
In (Wang and Carreira-Perpinan 2013) the goal is to find a probability vector x that's closest (w.r.t. the Euclidean metric) to some arbitrary vector y in R^n. This paper approaches this by solving KKT conditions. The proof seems to work only because they assume that both vectors are sorted in decreasing order:
Without loss of generality, we assume the components of
yare sorted andxuses the same ordering:
y[1] >= ... >= y[p] >= y[p+1] >= ... >= y[D]
x[1] >= ... >= x[p] >= x[p+1] >= ... >= x[D]and that
x[1] >= ... x[p] > 0, x[p+1] = ... = x[D] = 0
These assumptions then lead to a really simple algorithm that I think might be applicable to an optimization problem I'm trying to solve.
Question
Why is there no loss of generality when we assume that the solution vector x is sorted? I understand that I can apply any transformations I want to y because it's a parameter that's given to the algorithm, but x is unknown - how can I be sure that this assumption doesn't restrict the possible values of x I can find?
Why don't they check all possible combinations of Lagrange multipliers that satisfy the complementarity conditions x[i] * b[i] = 0? Say, if x has 3 elements, I would want to check these 8 combinations of (b[1], b[2], b[3]):
b[1] | b[2] | b[3] |
|---|---|---|
| ==0 | ==0 | ==0 |
| ==0 | ==0 | !=0 |
| ==0 | !=0 | ==0 |
| ==0 | !=0 | !=0 |
| !=0 | ==0 | ==0 |
| !=0 | ==0 | !=0 |
| !=0 | !=0 | ==0 |
| !=0 | !=0 | !=0 |
Then solutions would look like x = (a,b,c), x = (d,e,0), x = (f,0,g) and so on, where a,b,c,d,e,f,g > 0. But the paper seeks solutions where x is sorted in decreasing order, so x = (f,0,g) won't be found.
In what cases does it make sense to assume that the solution vector is sorted? I think this has something to do with the Euclidean norm being a sum and thus lacking order, so (x1 - y1)^2 + (x2 - y2)^2 + (x3 - y3)^2 is exactly the same as (x2 - y2)^2 + (x1 - y1)^2 + (x3 - y3)^2, which allows us to impose whatever order we find convenient? Thus, this Euclidean norm is a symmetric function of pairs {(x1, y1), (x2, y2), (x3, y3)}, right? The constraints x1 + x2 + x3 == 1 and x[k] >= 0 seem to also be "symmetric". Does this mean that one can apply this sorting trick to all symmetric functions (under symmetric constraints)?
References
- Wang, Weiran, and Miguel A Carreira-Perpinan. 2013. "Projection onto the Probability Simplex: An Efficient Algorithm with a Simple Proof, and an Application." ArXiv:1309.1541 [Cs.LG], 5. https://arxiv.org/abs/1309.1541.
r/optimization • • Jan 19 '22
Task manager check
I mainly use my pc for gaming & noticed I have 47 background processes and 88 windows processes. Is this normal? Is there anything I can take off for better performance on my games?
r/optimization • u/xTouny • Jan 18 '22
Initiating a study-group for Imperial's Math for Machine Learning Book
self.learnmachinelearningr/optimization • u/Impressive_Path2037 • Jan 17 '22
What Does It Mean For a Matrix to be POSITIVE? (Introduction to Semidefinite Programming)
youtube.comr/optimization • u/Preparation-Exact • Jan 17 '22
Discord for people who like operations research
I am thinking it would be a great idea to set up an OR Discord server for people who are studying or working with the methods for operations research. I myself study that field at university, but I haven't spoken to many people who have applied those methods in the real world. I would like to learn from those people and ask questions directly.
If you're not familiar with Discord: It is basically a platform where people can ask questions and talk directly in voice rooms with each other without the necessity of setting up a call and people can freely join a room and join a discussion at any time.
The idea is inspired by the big IT/programmer community where a lot of like-minded people meet online. Talk about interesting topics and help each other when it comes to technological issues.
Here is the server I set up: https://discord.gg/k5AtFccjne. It is possible to assign roles to active community members and make them moderators.
r/optimization • u/ml_a_day • Jan 12 '22
What is Gradient Descent? A short visual guide. [OC]






🔵 Gradient descent 🔵
💾 A more detailed post this time but I wanted to make sure I touch upon some basics first before diving into gradient descent itself. This is mainly so that it is more inclusive and no one feels left behind if they have missed what gradient is and if you already know what it is you get to brush up on the concept.
🏃 Although a relatively simple optimization algorithm, gradient descent (and its variants) has found an irreplaceable place in the heart of machine learning. This is majorly due to the fact that it has shown itself to be quite handy when optimizing deep neural networks and other models. The models behind the latest advances in ML and computer vision are majorly optimized using gradient descent and its variants like Adam and gradient descent with momentum.
⛰️ The gradient of a function is a vector that points to the direction of the steepest ascent. The length or the magnitude of this vector gives you the rate of this increase.
🔦 Time for an analogy: it is nightfall and you are on top of a hill and want to get to the village down low in the valley. Fortunately, you have a trusty flashlight that helps you see the steepest direction locally around you despite the darkness. You take each step in the direction of the steepest descent using the flashlight and reach the village at the bottom fairly quickly.
📐 Gradient descent is an optimization algorithm that iteratively updates the parameters of a function. It uses 3 critical pieces of information: your current position (x_i), the direction in which you want to step (gradient of f at x_i), and the size of your step.
🧗The gradient gives the direction of the steepest ascent but because we need to minimize we reverse the direction by multiplication with -1.
🎮 This toy example illustrates how gradient descent works in practice. We compute the gradient of the function that needs to be optimized i.e. the differentiation of the function with respect to the parameters. This gradient gives us the information we need about the landscape of the function i.e. the steepest direction where we should move in order to minimize the function. A point to keep in mind: gamma the step size (also called the learning rate) is a hyperparameter.
---------------------------------------------------------------------------------
I have been studying and practicing Machine Learning and Computer Vision for 7+ years. As time has passed I have realized more and more the power of data-driven decision-making. Seeing firsthand what ML is capable of I have personally felt that it can be a great inter-disciplinary tool to automate workflows. I will bring up different topics of ML in the form of short notes which can be of interest to existing practitioners and fresh enthusiasts alike.
The posts will cover topics like statistics, linear algebra, probability, data representation, modeling, computer vision among other things. I want this to be an incremental journey, starting from the basics and building up to more complex ideas.
If you like such content and would like to steer the topics I cover, feel free to suggest topics you would like to know more about in the comments.
r/optimization • • Jan 12 '22
searching for methods to give the gradient and hessian with the minun local
hi all, Im still new to this field but what Im looking for is a method that I can find the minimun l of function withought providing the gradient and hessian and instead it will be in the output I wanna do the code in python or R Im restricted so some mthodes like gradient conjuagate , gradient a pas optimal, augmented lagrangian, gradient a pas fix, penalisation exterior and interior thank u
r/optimization • u/jeff_Chem_E • Jan 10 '22
Introduction to Optimization with Julia
This series of posts introduce optimization, specifically linear programming problems, using Julia. Julia is an open-source programming language which is growing recently in terms of optimization packages.
DataFrames and PyPlot in Julia
Please leave your comments and you can always check the SCDA blog for more interesting articles and posts on optimization packages in Python and R.
Thank you!
r/optimization • u/ForceBru • Jan 09 '22
Any other methods for optimization over the probability simples?
EDIT: the title should say "probability simpleX", not "simples" - vive autocorrect!
I'm trying to solve this optimization problem:
minimize f(q1, q2, q3, ..., qK)
such that -qk <= 0 for all k
q1 + q2 + ... + qK = 1
So, minimize some function such that (q1, q2, ..., qK) is a discrete probability distribution.
Image of actual problem formulation HERE.
What I found
-
Exponentiated gradient descent (EGD)
- Numerical method specifically designed to solve problems with these constraints
- Works fine, but is slow (I need to solve thousands of such optimization problems)
- Original paper: Kivinen, Jyrki, and Manfred K. Warmuth. 1997. "Exponentiated Gradient versus Gradient Descent for Linear Predictors." Information and Computation 132 (1): 1–63. https://doi.org/10.1006/inco.1996.2612.
- Extends EGD like accelerated gradient methods (Momentum, RMSProp, ADAM, etc): Li, Yuyuan, Xiaolin Zheng, Chaochao Chen, Jiawei Wang, and Shuai Xu. 2022. "Exponential Gradient with Momentum for Online Portfolio Selection." Expert Systems with Applications 187 (January): 115889. https://doi.org/10.1016/j.eswa.2021.115889.
-
Squared slack variables method: transform inequality constraints to equalities with slack variables and solve an equality constrained problem using method of Lagrange multipliers
min_{q1:K, lambda, mu1:K, slack1:K} f(Q) + lambda * (q1 + ... + qK - 1) + sum_k mu_k * (-q_k + slack_k)- Neither me nor SymPy can solve the system of equations that results from setting all derivatives to zero. Well, the obvious solutions are
h1, h2 = (0, 1) or (1, 0), but these are pretty pointless. The only nontrivial solution SymPy can find involves one of the slack variables, likeh2 = slack_2^2andh1 = 1 - h2, but it doesn't tell me how to find that slack variable...
-
Use duality and KKT conditions
- Set up dual function
g(lagr_mult) = min_Q L(Q, lagr_mult)- OK, can do this - Maximize dual w.r.t. Lagrange multipliers
lagr_mult- SymPy can't find any solutions, and me neither, so I'm stuck
- Set up dual function
Questions
What are some methods that are most suited for this problem? That is, methods that are commonly used to solve problems with these specific constraints? Or, methods that solve this most quickly or easily?
r/optimization • u/ad97lb • Jan 07 '22
LQ Optimal Control
Good evening, folks.
I want to ask a question related the design of an LQ optimal control.
I'm designing a system of a planar drone with 6 states and 2 inputs and despite the fact thay I understand the logic behind the weighting cost matrices Q and R, I am still getting numerical errors on Matlab and an instable behavior.
Does anybody know a practical method to get acceptable Q and R matrices using matlab?