Hot answers tagged

51 votes
Accepted

MATLAB vs. Python in industry

Regardless of what completes the phrase "Python vs ...", the answer is always going to be Python. Very few people who are serious about using optimisation in production use MATLAB, and the ones who ...
user avatar
19 votes

MATLAB vs. Python in industry

I agree with everything Nikos said and I add some colors to some of the reasons: Python is free and open-source but Matlab is not. Anyone can write codes in Python and share it with others who can ...
user avatar
  • 5,756
17 votes

MATLAB vs. Python in industry

Nikos Kazazakis and EhsanK have given you great reasons for using Python. I will focus on the point from you about needing to use an additional package/library in Python for matrix and vector ...
user avatar
  • 311
14 votes

MATLAB vs. Python in industry

I work for a company that offers a commercial optimization solver. The solver offers interfaces to both MATLAB and Python for solving problems defined in those languages. We only get one or two ...
user avatar
  • 141
14 votes
Accepted

Solver rounding precision vs programming language rounding precision

Numerical stability (computations going sideways) and numerical tolerances are related but not identical. Floating point arithmetic being subject to rounding and truncation errors (unavoidably), every ...
user avatar
  • 31.1k
10 votes
Accepted

Matlab fmincon for a problem with many nonlinear constraints

The problem might be @(x) in the first line of the function. Adding this creates an anonymous function, while MATLAB simply expects a numerical vector as output. ...
user avatar
9 votes

MATLAB vs. Python in industry

MATLAB is a language built on top of a library. Python (with NumPy & numba) is a language with a library built under it. Neither is ideal. Like all languages, both have a few quirks, due to their ...
user avatar
8 votes

MATLAB vs. Python in industry

I did my PhD on a topic involving numerical simulations of mechanical systems. I worked primarily in MATLAB, which I already had experience in and seemed to have some good 'out of the box' ...
user avatar
8 votes

When should I use a solver for IP and MIP and can I just use a library from Python, R, Matlab, etc...?

I assume the solver you're referring to in Python/R/Matlab, are the open-source solvers such as CBC or GLPK (you can find out more in this question: Where can I find open source LP solvers?). If that'...
user avatar
  • 5,756
8 votes

Matlab fmincon for a problem with many nonlinear constraints

Following Kevin Dalmeijer's answer (Accepted), I found the following approach to solve the problem that I had. (composing this answer for future similar questions): The general form of Fmincon ...
user avatar
  • 8,340
7 votes

Advantages of IBM CPLEX Studio over CPLEX in MATLAB?

Since you are asking from a MSc student's point of view and actually need to use CPLEX, I assume that your research mainly focuses on the applications of OR. Therefore, two things are required to be ...
user avatar
7 votes
Accepted

What underlies intlinprog in MATLAB?

Mention of intlinprog, without further specification, generally means the intlinprog of the MATLAB Optimization Toolbox. However, Gurobi also has a function called <...
user avatar
6 votes

Solver rounding precision vs programming language rounding precision

(1) Numerical stability is a real issue but not so common in my area of discrete optimisation (for obvious reasons). I only get it in two cases. Sometimes I get preprocessed data that has been rounded,...
user avatar
  • 1,225
6 votes

MATLAB vs. Python in industry

I am geophysics professor and have been solving scientific computing problems in Matlab since 2000. In the last ~8 years graduate students have been preferring to work in Python. I have the following ...
user avatar
  • 61
6 votes
Accepted

MILP Minimum set Vertex cover coding by Python or MATLAB?

In Python, with pulp and networkx : ...
user avatar
  • 10.4k
6 votes
Accepted

Is it possible to change the underlying field from Euclidean to $\mathbb{F}_p$?

Introduce an integer variable $y$ and replace the RHS with $k+py$.
user avatar
  • 22.7k
5 votes
Accepted

Following code doesn't work in matlab with CVX

Use CVX's entr function. $\sum_{i=1}^ 4x_i\ln(x_i)$ can be entered as -sum(entr(x)) ...
user avatar
5 votes

Branch and bound algorithm programming code

If you want to work inside Excel (or LibreOffice), you might look at OpenSolver. Google's OR-Tools includes the CBC solver and the option to use GLPK, SCIP or Gurobi. (Gurobi is commercial software ...
user avatar
  • 31.1k
5 votes

Branch and bound algorithm programming code

Depending on the type of your MIP, there are numerous open-source options: MILP: CBC Convex MINLP: Bonmin Non-convex MINLP: Couenne All of the above: SCIP (free for academics)
user avatar
5 votes

Branch and bound algorithm programming code

There are several open-source software packages that use branch-and-bound to solve integer programming, for example: GLPK: https://www.gnu.org/software/glpk CBC: https://github.com/coin-or/Cbc
user avatar
5 votes

Transform nonlinear cost function to get LP or MILP

Assuming you meant $C=\max() - \min()$ instead of $C=\max() + \min()$, you can introduce nonnegative variables $X_\text{import}$ and $X_\text{export}$ and linear constraints $$(P_\text{charge} + P_\...
user avatar
  • 22.7k
5 votes
Accepted

Transform nonlinear cost function to get LP or MILP

Taking a different tack from Rob, I'm going to assume that the original objective function $C$ is correct as stated and is being minimized, with $C_\text{export}>0$ being a per-unit compensation ...
user avatar
  • 31.1k
4 votes

When should I use a solver for IP and MIP and can I just use a library from Python, R, Matlab, etc...?

The main reasons are performance and quality of numerics. Non-professional stuff tend to lack the polish professionals spend time doing to ensure that numerical issues don't compromise the solving ...
user avatar
4 votes

Matlab fmincon for a problem with many nonlinear constraints

You can specify many nonlinear constraints and objectives without having to define functions with the problem-based modeling approach starting with MATLAB R2019a. "Many" are those that are polynomial ...
user avatar
4 votes

MATLAB vs. Python in industry

My first language I have learned was MATLAB. After learning C++ I realized MATLAB is bad for really learning about programming in such. I would recommend you also Python as language because it is ...
user avatar
4 votes

MATLAB vs. Python in industry

Sounds like you are intending to build solvers. You will be better off in MATLAB. As you noted, matrix and vector operations are part of the language. You'll need matrix decompositions and maybe ...
user avatar
4 votes
Accepted

How to normalize the objective functions of multi-objective optimization for a MPC?

The reason for minimizing fuel consumption is presumably to minimize fuel cost. If you can come up with a cost rate for travel time, then you can combine the two objectives into an overall cost ...
user avatar
  • 31.1k
3 votes
Accepted

Why is the Lagrange Multiplier not equal the Shadow Price (Excel solver, Matlab linprog, Gurobi)?

If you look at the "allowable decrease" in the RHS of the highlighted constraint, it's zero. A number of the binding constraints have either allowable increase or allowable decrease zero. ...
user avatar
  • 31.1k
3 votes
Accepted

How do I solve this Optimization problem?

Here is the model you can write using LocalSolver, our global optimization solver. Please note that LocalSolver is a commercial software like MATLAB. Nevertheless, you can benefit from free trial or ...
user avatar
  • 2,717
2 votes

MPS file generation

I am not an expert in YALMIP but you may check the saveampl(F,h,filename) command written in YALMIP website. An example of the implementation is given as: ...
user avatar
  • 8,340

Only top scored, non community-wiki answers of a minimum length are eligible