As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [ampl]

For questions related to the algebraic modeling language AMPL.

Filter by
Sorted by
Tagged with
2 votes
1 answer
165 views

it is possible to have a constraint that does not contain any decision variables

I had formulated an optimization model, and along the way I had to change a variable into a parameter. In doing so, one of my constraints that contained the variable I changed no longer contained a ...
orion's user avatar
  • 23
1 vote
3 answers
120 views

Optimization solver that satisfies variable values within set membership

Is there a solver that can handle an AMPL model of this sort: ...
wanderinganon's user avatar
3 votes
1 answer
240 views

Unexpected runtime error

I have a model that contains the sets (both ordered and Days also circular): Days and Personnel, and I'm trying to make a restriction run exaclty once per Day for every member of Personnel. I'm using ...
Cyrus Roettern's user avatar
3 votes
2 answers
62 views

Constrained shift assignment problem using ilogcp solver can´t find an optimal solution

I´ve been trying to solve a contrained assignation problem given a set of constraints based in a real-world problem. I modeled the problem in AMPL as follows: ...
Cyrus Roettern's user avatar
1 vote
0 answers
208 views

How to make unconstrained variables non-negative (as in excel solver) in AMPL?

This is a sequencing problem. I've got this variables ...
Don Quijote's user avatar
1 vote
0 answers
139 views

How to use ampl.lic in Pyomo

I have the licence of some solvers and I want to use these solvers in Pyomo. The licence file is ampl.lic and my machine is Macbook. I have an executable file for Baron solver which is only for demo ...
hamta's user avatar
  • 77
0 votes
1 answer
122 views

How do I get the first and last item of a set in GLPK

I have a college exercise that I need to create a linear programming model from an academic paper. This has to be written in Gusek software which uses GLPK as a resolver. The article defines sets in ...
mrlucasrib's user avatar
1 vote
1 answer
153 views

Why is the value negative? AMPL

I developed an LP model where it allocates the number of cassava crackers to the declared number of stores depending on their minimum demand. I have a concern because when I ran the code in AMPL, ...
sonyeoja's user avatar
15 votes
2 answers
4k views

Is Apple's M1 suitable for Operations Research?

I am curious about the performance of Apple's M1 chip solving optimizations models, MIP, LP, and in solutions approach as benders or columns generations. I read that is a spectacular cpu to perform ...
orpanter's user avatar
  • 423
2 votes
1 answer
157 views

Error defining a binary parameter in AMPL

I have to define this binary parameter in AMPL: param h{k in K, j in Jk, t in T, r in R}; binary which equals 1 if a bus of type $k$ and age $j$ can be assigned to ...
ValeBi's user avatar
  • 21
2 votes
2 answers
226 views

AMPL Gurobi Define Variables Bounds

I am trying to define both upper and lower bounds for a vector of variables in AMPL (solver Gurobi). However, after solving to optimal solution, the variables violate the bounds. The only way these ...
Undecided's user avatar
  • 159
3 votes
1 answer
291 views

VRPTW implementation

Does anybody have an example of the vehicle routing problem with time windows (VRPTW), implemented on Python with CPLEX library, AMPL, or MiniZinc? So far I've looked into ...
AGH's user avatar
  • 175
5 votes
1 answer
135 views

Add robustness of AMPL code through file name

I want to add robustness to my AMPL code, here is what I am actually doing: In my script I use a .txt file that contains all my parameters, let's call it "instance.txt". I want to print my ...
odd's user avatar
  • 113
5 votes
2 answers
479 views

Overwrite on a txt file from AMPL

I have a result I want to save in a .txt file. So I use this line to save a result k: ...
odd's user avatar
  • 113
1 vote
1 answer
156 views

Handy way to index set of tuples in AMPL

I am dealing with a discrete math optimization problem on a complete graph. My variables are the arcs but I want to delete the arcs that "cost too much". I have $n$ nodes which means I have $...
odd's user avatar
  • 113
3 votes
1 answer
174 views

Find a particular optimal solution

After writing an integer linear program in AMPL, I solved it using CPLEX. Now, I have some variables that must necessarily be 1, others that must necessarily be 0 and finally it is possible that some ...
LJG's user avatar
  • 133
4 votes
2 answers
363 views

Combinatorial Optimization using AMPL

I want to solve the following integer programming problem using AMPL. The problem is the following (It was already asked on mathstackexchange.com, but I need to know how to solve it using AMPL): Let $...
user3831's user avatar
3 votes
1 answer
256 views

How to define hybrid variables without using additional binary variables?

I am working on a large NLP model with equilibrium equations in which the variables are defined in the following form: $$x_i \in [L_B, U_B] \cup\{0\} \quad \text{where} \quad L_B \ \& \ U_B \in\...
Oguz Toragay's user avatar
  • 8,483
3 votes
0 answers
71 views

Integer variable optimization - decreasing execution time

I have a variable declared as follows in AMPL: ...
S_Scouse's user avatar
  • 793
3 votes
1 answer
330 views

How to set combined stop condition in AMPL/CPLEX?

I would like to set a stop condition combined of a timelimit and a relative MIP gap. So I would like AMPL/CPLEX to look for the solution of my LP for an hour and if there isn't a solution stop if or ...
baxbear's user avatar
  • 287
7 votes
3 answers
395 views

Constraint that checks for an undirected graph whether it is connected?

I would like to create a constraint with AMPL that checks whether I am able to reach from one node $v$ to all other nodes of a set but I don't really know how to formulate it (especially in AMPL (+...
baxbear's user avatar
  • 287
5 votes
2 answers
78 views

AMPL implement constraint

I'm trying to implement the following in AMPL: $$ i \in [N], j \in[N] \backslash \{i\}, t \in [T] $$ I have so far written the following: ...
Ulrich_Peters's user avatar
5 votes
1 answer
77 views

How to formulate case distinctions in AMPLs objective function?

This is my first real optimisation problem I formulated and now trying to solve by using AMPL. The following objective function is from a linear 0-1 LP means all variables $x_i^b\in\{0,1\}$, with $i\...
baxbear's user avatar
  • 287
6 votes
1 answer
74 views

Issue interpreting sets of constraints in AMPL

I'm new to AMPL and am trying to model the following constraints. \begin{align}y_{ij3}&\le\sum_\ell X_{j\ell2}\quad(m=2,k=3)\\y_{ijk}&\le\sum_\ell\sum_mx_{j\ell m},\quad\forall i\in I,\forall ...
george's user avatar
  • 135
5 votes
0 answers
109 views

Magic square in AMPL: presolve: constraint cannot hold [duplicate]

I'm solving the magic square problem without using the alldiff operator. To insert different values ​​in the matrix, I initialized a variable: ...
Matteo's user avatar
  • 223
7 votes
4 answers
1k views

Matrix in ampl: constraint that the values ​are all different

I'm solving the magic square problem for my operational research exam. The constraints of my model are that the sum of the elements on the lines must be equal to a constant (var constant), that the ...
Matteo's user avatar
  • 223
8 votes
1 answer
791 views

Understanding the AMPL Solver LIbrary within Pyomo

For anyone familiar with the Pyomo book, it occasionally makes reference to the AMPL Solver Library, and to my understanding, if you can manage to hook up to the solver library then you are able to ...
GrayLiterature's user avatar
6 votes
1 answer
187 views

Obtaining the intermediate solutions in AMPL

I know that for some solvers, for example, the constraint programming solver in Google OR-Tools, it is possible to see all the intermediate solutions that the solver finds while it searches for an ...
Oguz Toragay's user avatar
  • 8,483
14 votes
1 answer
1k views

Comparison of Algebraic modelling languages and general programming languages

Some optimization software/frameworks (commercial or open-source) such as AMPL, GAMS, Cplex, ... have a specific Algebraic modelling language. Some of them have another type of programming that uses ...
A.Omidi's user avatar
  • 7,664
4 votes
1 answer
286 views

Declare numerical-sequence set in AMPL .dat file

Suppose I want an AMPL set to contain the integers 1 through 5. How can I declare this in the .dat file? I can do it in the .mod file, like this: things.mod: ...
LarrySnyder610's user avatar