15
votes
Accepted
Is Apple's M1 suitable for Operations Research?
One problem you might encounter is that the many solvers are either not available for M1 like CPLEX[1]. M1 support for Gurobi might be mixed in general due to issue like "Only use single-threaded ...
10
votes
Comparison of Algebraic modelling languages and general programming languages
GAMS and AMPL are general purpose modelling languages and can he used to describe any type of nonlinear function, including some niche stuff like floor, ceil, max, etc (AMPL). I don't have experience ...
10
votes
Is Apple's M1 suitable for Operations Research?
We at Mosek has started porting Mosek to the Apple M1 CPU so the upcoming version 10 will support it.
Here is an initial thought.
Normally optimization software links to a BLAS/LAPACK library such as ...
7
votes
Add robustness of AMPL code through file name
AMPL assumes that a parameter takes only numerical values, unless you add the keyword symbolic to say that string values are also permitted. So your first statement ...
6
votes
Accepted
Find a particular optimal solution
I don't think there is anything special in AMPL for doing this, but it can be done.
Option 1 is to add a term to the objective that penalizes the sum of all variables. (I'm assuming that all variables ...
6
votes
Accepted
VRPTW implementation
Before implementing anything, you need to understand the equations. A good approach is to think in terms of resources. When handling capacity constraints, you are dealing with a load resource which is ...
6
votes
Overwrite on a txt file from AMPL
To overwrite a file that you have previously been writing in an AMPL session, first close the file:
close (OutputFile);
Then use > to overwrite the file:
...
5
votes
Accepted
Overwrite on a txt file from AMPL
This should overwrite :
k > (OutputFile);
While this appends :
k >> (OutputFile);
5
votes
5
votes
Constraint that checks for an undirected graph whether it is connected?
I am aware of models that model such constraints using a network-flow-type approach. The basic idea is to create a source node that send "flow" of an imaginary product for which all nodes have a ...
5
votes
Accepted
Unexpected runtime error
I don't think you want ==> here, since Free_Day[p,d] = 1 ==> Free_Day[p,next(d,Days)] = 1 is satisfied anytime ...
4
votes
Accepted
4
votes
Matrix in ampl: constraint that the values are all different
I'm not sure if this helps you, but here is a "pure" IP model for the magic square problem, i.e. no all_different. However it's in MiniZinc (not AMPL), but it ...
4
votes
Accepted
Declare numerical-sequence set in AMPL .dat file
The .. operator cannot be used in the data section (i.e. it won't be expanded, see the AMPL FAQ). What you can do is to declare the limits in the model, e.g.
...
4
votes
Accepted
Obtaining the intermediate solutions in AMPL
Yes it is reasonable. For problems where closing the optimality gap is difficult, you may want to save e.g. the 10 best solutions found before termination. This is called a solution pool and it is a ...
4
votes
Accepted
How do I get the first and last item of a set in GLPK
I'm not familiar with GLPK, but since it's based on AMPL, the following AMPL implementation might be of some help:
...
4
votes
Accepted
it is possible to have a constraint that does not contain any decision variables
Constraints define your feasibility region; bounds your search space. A constraint with no dv (decision or optimization variable) simply becomes a testing condition. If parameter value satisfies the ...
3
votes
Error defining a binary parameter in AMPL
Using the assignment operator := inside the loop is redefining h for each combination of k and j, which is an error.
I assume that your actual data set will not have the same 2D data matrix for all (k,...
3
votes
Accepted
How to formulate case distinctions in AMPLs objective function?
Let $\rho$ be some small value.
\begin{align}M \times f(x) &\geq x - 1 + \rho\\M \times (1 - f(x)) &\geq 1 - x - \rho\end{align}
Here is the small working code in Python ...
3
votes
Matrix in ampl: constraint that the values are all different
Please check this link to my answer to your previous question. I included a link in which without using alldiff, Sudoku problem (where the magic constant is equal ...
3
votes
Accepted
Matrix in ampl: constraint that the values are all different
Outside an exam scenario, the correct answer is "switch to a solver that supports alldiff", but I'm assuming you are required to solve this in Gurobi.
One way to ...
3
votes
Matrix in ampl: constraint that the values are all different
In AMPL's website, there is a code for solving sudoku which is very similar to your problem. In their code they also used alldiff. The only thing that you need to ...
3
votes
Understanding the AMPL Solver LIbrary within Pyomo
The AMPL Solver Library (or ASL) is an open-source interface between solvers and modelling languages. As long as a solver can (i) read an .nl file and (ii) produce a .sol file, it will work out of the ...
3
votes
Combinatorial Optimization using AMPL
Here is the AMPL interpretation of @RobPratt's answer which works perfectly using the gurobi in my local pc:
...
3
votes
Combinatorial Optimization using AMPL
Here is the SAS code that I used to obtain the results in the linked thread. Maybe it will help you correct your AMPL errors. In particular, note that you should declare each variable only once.
<...
3
votes
Accepted
How to define hybrid variables without using additional binary variables?
An alternative approach to binary variables or semicontinuous variables is the following cubic polynomial inequality:
$$x(x-L_B)(U_B-x)\ge 0$$
Because $x \ge 0$, this constraint enforces
$$(x = 0) \...
3
votes
Accepted
How to set combined stop condition in AMPL/CPLEX?
Your ratio current/best possible is not itself a gap; it is part of what you would use to compute the relative gap.
The relative gap defined by CPLEX is the absolute difference between the objective ...
3
votes
Constraint that checks for an undirected graph whether it is connected?
One possible solution (not necessarily quick or efficient) is a lazy constraint approach:
Solve your problem, ignoring the connection requirement
Examine the solution and find the subgraph $H$ that ...
3
votes
Accepted
Constrained shift assignment problem using ilogcp solver can´t find an optimal solution
There's an experimental version of "Gurobi for AMPL" that should accept your constraint DL just as you have written it. It uses AMPL's new "MP" ...
2
votes
AMPL implement constraint
This looks most like the math (and avoids checking for every $(i,j,t)$ a logical condition that depends only on $i$ and $j$):
{i in PP, j in PP diff {i}, t in TT}
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
ampl × 31optimization × 9
linear-programming × 5
cplex × 5
solver × 5
mixed-integer-programming × 3
modeling × 3
pyomo × 3
binary-variable × 3
modeling-languages × 3
integer-programming × 2
gurobi × 2
constraint-programming × 2
graphs × 2
logical-constraints × 2
gams × 2
constraint × 1
combinatorial-optimization × 1
linearization × 1
nonlinear-programming × 1
vehicle-routing × 1
simplex × 1
benders-decomposition × 1
c++ × 1
assignment-problem × 1