# Tag Info

1

You should probably also consider Optuna, a fairly new but rapidly improving optimization framework. It was originally targeted at machine learning hyperparameter optimization, but it works for all kinds of problems and provides generic algorithms (Gaussian processes, NSGA-II, TPE estimators, etc.).

3

I'm assuming your w, R, D variables are not in form of dictionaries (if they are the function below becomes much simpler). I go with "easier to ask for forgiveness than permission" (EAFP) programming. def _cos(i,t): try: _r = R[i,t] except KeyError: _r = 0 try: _d = D[i,t] except KeyError: _d = 0 ...

2

After a few hours extra deliberation and and working on the problem, I was able to figure out the reason. It was as I thought initially and my calculation for my flow_in wasn't DCP and I am not entirely sure or understand why, but I will be definitely teaching myself this in the time going forward. I was able to adjust the calculation to look like the ...

2

Yes, this can be done in pyomo. Pyomo implements ConcreteModel() as a Block() object, so you could just place one over the other. Thus, merging two models is quite straightforward. You'll have to define the objective separately. Here's how to do it: from pyomo.environ import * model1 = ConcreteModel() model1.constraint1 = ... model1.constraint2 = ... # ...

4

One of the most important things to keep in mind is that we should install Pyomo in another environment than the base environment together with its solvers. However, this is not enough to use Pyomo properly. In the case of ipopt solver, it returns the error No executable found for solver 'ipopt'. To overcome this error, we need to search the exe file of ...

6

For asymmetric TSP, you can use a directed graph, with variables $x_{i,j}$ for $i \not= j$, and the flow balance constraints are: \begin{align} \sum_{j \not= i} x_{i,j} &= 1 &&\text{for all $i$} \\ \sum_{j \not= i} x_{j,i} &= 1 &&\text{for all $i$} \\ \end{align} For symmetric TSP, you should use an undirected graph, with variables $... 7 So you are dealing with a configuration where for any path$A-B-...-Z$, the reverse path$Z-...-B-A$is also valid. To break this symmetry, you can impose that the index of node$A$must be smaller than the index of node$Z$: $$x_{i0} \le \sum_{j| j\le i}x_{0j}\quad \forall i$$ This way, if arc$(i,0)$enters the depot, then there must be a lower indexed ... 1 Based off on what Daniel commented: select all the edges used in any vehicle's tour that are asymmetrical group them by vehicle, collecting the count of the number of asymetrical edges in that vehicle's tour add a hard constraint that there must be at least one (=> penalize if count is zero) Alternatives: Make it a soft constraint: Add a soft ... 2 As a veteran MATLAB user, I'm horrified by some of the conventions the developers of Python chose to use. There are some inconsistencies in array notation that are very troubling. They decided to defy convention used in many other programming languages, including MATLAB, C, FORTRAN, Julia, etc. Matrix manipulation is extremely difficult and prone to error in ... 1 Depending on what your decision variables are you are looking at an integer, mixed integer, or mixed integer linear programming problem. It seems to me that you want to solve it using a Python model. If that is the case, you can look at Pyomo or PuLP systems if you're looking for open-source solvers. 6 I would approach this as a mixed integer linear programming (MILP) problem. There are a number of MILP solvers, some open source, some commercial (with some of the commercial solvers providing free licenses for educational use). Many of them either have a Python API or can be used with PuLP (mentioned in comment to the selected answer). You might want to ... 5 I won't write a python solution as i am not familiar with any python modeling language but i can describe the approach i took in the past to solve problems like this. I would solve this problem using a technique of finite horizon optimal control where we have an$x_t$a state vector for each time point, a control signal$u_t$, a prediction$p_t$. The core of ... 5 Let$f(x)=(f_1(x),f_2(x),\dots,f_n(x))$be a lexicographic objective function, where$f_1(x)$is more important than$f_2(x)$which in turn is more important than$f_3(x)$, etc. I'll assume you are solving a minimization problem. In a mathematical programming solver, such an objective function could be easily implemented as follows. First find the solution$...

Top 50 recent answers are included