Questions tagged [matlab]
For questions about solving Operations Research problems using Matlab programming language.
29
questions
33
votes
12
answers
15k
views
MATLAB vs. Python in industry
I am a beginning PhD student in math, and I would like to focus on optimization. I am learning programming for the first time, and I have written out some rudimentary optimization algorithms in both ...
14
votes
2
answers
222
views
Solver rounding precision vs programming language rounding precision
Often times I have this issue. For example, I need to have a non-negative coefficient, say $c_0$, in my optimization problem (otherwise the problem is not convex). Moreover, to obtain this $c_0$ I ...
10
votes
1
answer
615
views
Advantages of IBM CPLEX Studio over CPLEX in MATLAB?
This question comes from the perspective of an MSc student new to both OR and programming OR problems in a MIP framework. My research has led me down this path of needing to program an optimization ...
9
votes
3
answers
3k
views
Matlab fmincon for a problem with many nonlinear constraints
Using Matlab to solve a problem which has linear objective function and many nonlinear constraints, I am trying to generate the inequality nonlinear constraints by a function and pass it to fmincon ...
9
votes
2
answers
219
views
When should I use a solver for IP and MIP and can I just use a library from Python, R, Matlab, etc...?
Are there any rules of thumb for figuring out when you need to use a solver like Gurobi or CPLEX, and when you can just solve you problems directly with a Python, R, or Matlab package?
Is it just a ...
6
votes
8
answers
3k
views
Ideal programming language for an operations researcher
No single programming language will meet every need. However, there should be a language that most operations research scientists prefer to master.
I have coded different algorithms in Matlab and ...
6
votes
1
answer
501
views
What underlies intlinprog in MATLAB?
When a paper says they used the intlinprog in MATLAB to solve an integer program, what system actually does the solving? I have seen documentation about Gurobi and MATLAB: does Gurobi always provide ...
6
votes
1
answer
168
views
MPS file generation
I have a code in MATLAB which uses YALMIP to structure my optimization model and solve it via a solver. I would like to obtain a .mps file out of my model, apparently, YALMIP does not produce this if ...
5
votes
2
answers
508
views
Transform nonlinear cost function to get LP or MILP
I'm trying to schedule power of multiple prosumers in a microgrid.
The problem includes a cost function with min and max ...
4
votes
3
answers
2k
views
Branch and bound algorithm programming code
I want to solve an integer programming problem using the branch and bound method, but I'm having trouble finding the programming code. From what I saw, almost all algorithms use it for traveling ...
4
votes
1
answer
895
views
MILP Minimum set Vertex cover coding by Python or MATLAB?
As a following up for my question for modeling a simple moded of the minimum set vertex cover problem, which is shown next. I would like to have your help in modeling this problem using Python or ...
4
votes
1
answer
226
views
Following code doesn't work in matlab with CVX
Given the following problem \begin{align}\min&\quad x_1+2x_2+3x_3+4x_4+\sum_{i=1}^4x_i\ln(x_i)\\\text{s.t.}&\quad e^\top x=1\\&\quad x\geq0\end{align}
I was asked to solved the dual ...
4
votes
0
answers
246
views
Does anyone have the criss cross algorithm programming code to solve linear programming problems?
I have a project that requires programming code for the simplex algorithm and criss-cross algorithm. The purpose of this project is to compare the two methods. I've tried to find it, but the ...
3
votes
1
answer
701
views
Why is the Lagrange Multiplier not equal the Shadow Price (Excel solver, Matlab linprog, Gurobi)?
I have a LP with equality and inequality constraints.
When solving the LP with the excel-solver (GRG Nonlinear) the sensitivity report returns the lagrange multiplier for all constraints.
When solving ...
3
votes
1
answer
897
views
Linear programming sensitivity analysis using Matlab
I have a linear program in the MPS file format listing all the rows, columns, right-hand sides, etc. I can read that in Matlab and solve it using linprog. However, it seems there is no easy way to do ...
2
votes
1
answer
56
views
Is it possible to change the underlying field from Euclidean to $\mathbb{F}_p$?
I have an ILP $Ax=b$ that I know has feasible solution(s), and I would like to find a/all feasible solution(s). The issue is that $A,x,b$ are defined over $\mathbb{F}_p$. More specifically, I need the ...
2
votes
0
answers
62
views
Where is the relative gap from cplexbilp?
I am invoking cplexbilp (CPLEX 12.9) from Matlab R2022a. I request all 4 return arguments:
...
2
votes
0
answers
73
views
Determining the number of nodes within a cycle for an MILP problem
I have a MILP problem that requires knowing the number of nodes within a cycle (there will be multiple depending on inputs). I believe this will involve tracing nodes/values within cycles using the ...
2
votes
0
answers
128
views
Defining a highly non-linear function of integer variables
I have a complicated non-linear objective function of positive integer variables subject to linear constraints:
$\mathop {Min}\limits_{\underline x} f(\underline x)$
s.t.
$A\underline x\leq \underline ...
2
votes
0
answers
310
views
Reading MPS file for linear programming and reconstructing the Optimization model
Are you aware of any tutorial that can help me learn on how to reconstruct the objective function and constraints from a MPS file once it's loaded in MATLAB. I can load the mps file given to me and ...
1
vote
1
answer
196
views
How do I solve this Optimization problem?
Optimization of a simple expansion problem
minimise:
$$
\sum_{t=1}^{5}\left[\sum_{i=1}^{2}x_{i,t}CC_i\left(\frac{1+EIC}{1+r}\right)^t+UE_t*C_{UE}\right]
$$
subject to:
$$
0 \leq x_{i,t} \leq 5 \\
...
1
vote
1
answer
56
views
Solving stochastic dynamic problem by space state MATLAB program
I have a maximization problem as shown in the picture below. The output has a common shock z that follows a two-state Markov chain with a transition matrix Π. Does anyone know how I would go about ...
1
vote
0
answers
72
views
Create randomly an undirected connected graph using Matlab [closed]
I want to create randomly an undirected connected graph $G=(V,E)$ with $n$ nodes and $m$ edges using Matlab. How can I do this?
0
votes
2
answers
289
views
How to normalize the objective functions of multi-objective optimization for a MPC?
I have a MPC with two objective functions, one that minimises fuel consumption and one that minimises the travel time of a vessel. I want to combine these two objectives into one weighted objective, ...
0
votes
1
answer
94
views
Mixed Integer Programming - How to model a term in objective function with a constant multiplied by (1-Decision Variable)
I am solving an optimization problem, where I want to minimize the objective function
$$Z = \sum_q \left(D_q \text{fare}_q - \sum_{p \ne q} \Delta D^p_q \text{fare}_q \right) (1-Z_q)$$
Each $q$ is an ...
0
votes
1
answer
92
views
lsqcurvefit error in simulation of demands in MATLAB
I want to simulate the demand of a factory. This is not a real problem, the demand follows this relation $D= AB^2C^3$ where $A$, $B$ and $C$ have normal distributions: $$A\sim N(10,2.5),\quad B\sim(6,...
0
votes
1
answer
121
views
How to convert an element of a variable to a convex constraint using binary variables?
I defined a complex variable in cvx, but I want to restrict the first element of the variable to be larger than the max of the variable, but it doesn't work. Someone told me to transform it using a ...
0
votes
0
answers
68
views
is it possible to improve the solution process of an MILP?
I am trying to optimize a charging station for EVs in matlab with intlinprog, which is connected to a PV-Modul, to an system storage systeme and to the network grid. I am using different Storage ...
-2
votes
1
answer
239
views
Optimized Production Planning & Scheduling
I want to create an optimized schedule and production to meet demand of four different buyers. I am starting with Pulp but not able to account for continuous production variable and discrete dispatch ...