Questions tagged [ampl]

AMPL is an algebraic modeling language for mathematical optimization. It supports a wide range of problems such as linear, quadratic and nonlinear problems in continuous and discrete variables and is connected to most solvers.

AMPL, an acronym for A Mathematical Programming Language, is an algebraic modeling language for describing and solving high-complexity problems for large-scale mathematical computation (i.e. large-scale optimization and scheduling-type problems). It was developed by Robert Fourer, David Gay and Brian Kernighan at Bell Laboratories. AMPL supports dozens of solvers, both open source and commercial, including CBC, CPLEX, FortMP, Gurobi, MINOS, IPOPT, SNOPT and KNITRO.

More on AMPL

AMPL home page

AMPL on Wikipedia

414 questions
19
votes
3 answers

Comparison of GAMS versus AMPL Algebraic Modelling Languages

I'd be interested in getting the opinion from users of GAMS and AMPL on what the strength and weaknesses of each these languages are.
Emmanuel
  • 3,475
  • 6
  • 29
  • 45
8
votes
10 answers

Mathematical Programming Languages

Given my previous questions about the the usage of AMPL. Are there any other programming/scripting languages that are strictly meant for mathmatical processing? For example: Matlab (it does deviate a bit from a mathematical structure, but its…
monksy
  • 14,156
  • 17
  • 75
  • 124
6
votes
3 answers

AMPL cannot find "minos"

I've faced a problem with AMPL. I'm using 32-bit version of Linux OS. I'm trying to solve a simple linear programmin problem but I can't understand what is wrong... Here is model, data files and session script as well. The answer to command "solve"…
Roman Dryndik
  • 1,167
  • 1
  • 13
  • 34
5
votes
1 answer

AMPL vs. Python - Importing tables (multi-dimensional dictionaries?)

I am an AMPL user trying to write a linear programming optimization model using Python (My first Python code). I am trying to find how to declare indexed parameters over compound sets. For example, in AMPL, i would say: Set A Set B Set…
4
votes
2 answers

Converting `AMPL` or `GAMS` files to `Python`

I would like to make some experiments in Python with constraint satisfaction problems from this database: all of the examples there are given in both the AMPL and GAMS file format. Is there a tool to convert these equations to simple python…
Peter Franek
  • 577
  • 3
  • 8
  • 25
4
votes
1 answer

How do I change the default solver in AMPL?

AMPL by default uses MINOS. I have to type option solver "./lpsolve"; every time I want to use lpsolve as my solver. Is there a way to change the default?
hattoriace
  • 75
  • 1
  • 3
4
votes
1 answer

GLPK MathProg sets and groups

I hope this is obvious to someone. I have only had a vanilla use of GLPK/MathProg. I am having trouble figuring out the syntax in GNU MathProg (within GLPK) to do the following, for example: set PartsOfWeek; set WeekDays; data; set PartsOfWeek :=…
tipanverella
  • 3,477
  • 3
  • 25
  • 41
3
votes
1 answer

Adding binary variables in GLPK

I'm using GLPK under Linux to solve some linear programming problems. In one of my restrictions I have: s.t. example: binary_var+binary_val <=1; Where binary_val is a variable defined as 'binary'. If binary_val takes the value 1, will its sum be…
alfongj
  • 2,255
  • 1
  • 19
  • 23
3
votes
1 answer

What constraints make my problem infeasible?

I'm using CPLEX 12.8 for modelling my thesis project and I have a problem that I cannot solve. I get the following output: CPLEX 12.8.0.0: integer infeasible. 1828 MIP simplex iterations 316 branch-and-bound nodes No basis. Is there any way to…
3
votes
1 answer

Specifying default values

I have a parameter B in matrix format, defined in the model file as param B {Rn,Rn}; for which I define the non-sparse values as from numpy import random from scipy import sparse from amplpy import AMPL, Environment, dataframe B =…
FooBar
  • 15,724
  • 19
  • 82
  • 171
3
votes
1 answer

AMPL Variable Definition

I would like to define a variable in AMPL that can either be 0 or a range of values from 40 to 100. Using var x >=40, <=100 || == 0; is not valid syntax unfortunately. Should I define one of these constraints as a parameter?
3
votes
1 answer

Solving Steiner Tree with GLPK

I'm new at using the GPLK and I'm trying to solve the Steiner Tree problem through it. The mathematical formulation I'm using is this one: This is the piece of code I'm testing: # Number of terminal vertexes param p, integer; # Number of steiner…
user3369563
3
votes
1 answer

Initialize 3 dimension variable in AMPL

I have a variable called Rest defined as: var Rest{I,J,T} >= 0; where T is the set of time periods and I and J the arcs. I need to define that every value for I and J where T = 0 must be 0. I is the set of supply nodes, and J the set of demand…
Cenderze
  • 1,202
  • 5
  • 33
  • 56
3
votes
1 answer

IPython: What does AMPL have to point to to run Gecode?

Following this post - http://zverovich.net/2013/06/27/visualizing-geographical-ampl-data-using-ipython-and-google-charts.html I tried something like this: ... option solver…
James Salamon
  • 1,412
  • 1
  • 22
  • 18
3
votes
2 answers

How to print to file in AMPL? `option log_file` doesn't work

I want to use some printf to print to a file. I can use for{i in set1} printf '%10.5f\n',var1[i] >> ('a' & 'very' & 'long' & 'string' & 123 & sprintf('%5d', foo)); for{i in set2} printf '%10.5f\n',var2[i] >> ('a' & 'very' & 'long' & 'string' & 123…
Oriol
  • 274,082
  • 63
  • 437
  • 513
1
2 3
27 28