428 questions
0
votes
1
answer
44
views
MATLAB AMPL API Error: "Unable to resolve the name com.ampl.AMPL" despite valid license
I'm trying to run an optimization script (*.m file) using the AMPL API for MATLAB, but I encounter the following error:
Unable to resolve the name com.ampl.AMPL.
This prevents me from using AMPL ...
1
vote
1
answer
52
views
Is it possible to write AMPL NL-file in binary format by Pyomo?
We use Pyomo to exchange data with AMPL-compatable solvers by NL-file (as input) and SOL-file (as output). For some models Pyomo ConcreteModel.write(...) function generates rather big NL-files in text ...
-4
votes
1
answer
60
views
Why Google Colab reported syntax error for my code regarding amplxl
I am very new to this. I wanted to use EXCEL table data as input for my AMPL optimization code through Google Colab. I wrote the code as below, but it said Syntax Error. I don't know why. Can anyone ...
2
votes
3
answers
154
views
Why the result is infeasible?
Suppose I have a set of jobs, each needing one mold; changing from mold A to mold B has a cost. I want to search for the job sequence that minimizes the mold change cost.
job mold
Mold shift cost
My ...
2
votes
1
answer
62
views
AMPLPY: How to reset/update the parameter after solving the AMPL model?
This is a Python code segment for solving an optimal power flow problem:
if self.ini_state:
solver.read(self.pb_path[0]) # Problem parameters
solver.param['BaseMVA'] = 1
...
0
votes
0
answers
68
views
Job getting killed on HPC cluster, why?
I am trying to solve a nonlinear optimization problem in AMPL. It is quite large but not ridiculously so. I solved a similar problem on my home PC (about 1 order of magnitude less in size though).
I ...
0
votes
0
answers
52
views
How to run software installed in my home folder on a compute node
I have some software (AMPL) installed on my home folder on a Grid Engine based HPC cluster at a university.
I'm looking just to source AMPL properly when I run my jobscript in the queue.
I need to run ...
0
votes
2
answers
65
views
I have an AMPl model, like an infeasible or unbounded problem. Set dualreductions=0 or iis=1 for definitive answer. 0 simplex iterations
# SETS set B; # Candidate central kitchens set S; # Schools set C; # Categories class set K; # Set of commodities set N; # Set of nutrients set Y; # Set of groups set G {Y} within K; # Set of ...
0
votes
1
answer
93
views
Defining sets and parameters from .csv file
I have a CSV file that has an index (hours) and two parameters (consumption and insolation). I want AMPL to create another index Day that consists of 24 consecutive hours of each parameter date so I ...
-1
votes
1
answer
84
views
Why am I getting this syntax error in AMPL? (beginner)
I am learning AMPL for a university project and i don't understand why i'm getting a syntax error, my code:
model:
set FOODS;
param calories;
param proteins;
param calcium;
param vitaminA;
param cost;
...
1
vote
1
answer
79
views
Can I provide solution to ampl and check which constraints were violated?
I'm trying to fix my model for which I have a solution that should work. Is it possible to provide that solution to the solver and see which and how constraints are violated?
Edit:
Let's say I have ...
1
vote
1
answer
137
views
Conversion from .mod to .nl files without simplifications
I have some AMPL files in .mod format, which I want to convert to .nl format.
In this way, I can then easily parse them for further processing.
However, I noticed that in the conversion the problem is ...
-1
votes
1
answer
76
views
I keep running into an error with AMPL wherein whenever I try to model my mod file I get an error: d is not defined [closed]
I keep running into an error with AMPL wherein whenever I try to model my mod file I get an error:
giap.mod, line 23 (offset 1996): d is not defined
context: {(d, b) >>> : <<< d ...
0
votes
2
answers
105
views
Read in named (unindexed) parameters from a table in AMPL
If I have a number of named parameters in an AMPL model, and a table (either in an Excel spreadsheet or in AMPL's built-in format) with columns ParamName, ParamValue, is there a nice way to read these ...
1
vote
0
answers
102
views
Issue with calling Knitro
I use pyomo to formulate my problem and then use ampl to call knitro to solve my problem, as show in code below:
self.solver_pyo = pyo.SolverFactory(modules.find(“Knitro”), solve_io = “nl”)
My ...
0
votes
0
answers
106
views
Show current gap while logging in AMPL+CBC solver
I'm trying using CBC instead the old dog CPLEX in my project to solve a large MILP problem. I would like to get the current gap as it's showed in CPLEX log but in the showed CBC messages.
CPLEX ...
0
votes
1
answer
45
views
AMPL - integrand following max{...} has invalid type
In the code snippet T, P, C are sets and x, z are binary variables.
Equipa {t in T, p in P}:
max{c in C} x[p,t,c] = z[p,t];
I get the error:
integrand following max{...} has invalid type
How can ...
2
votes
1
answer
519
views
Pyomo not loading solvers ('couenne', 'bonmin') from ampl
When I want to perform an optimisation with pyomo, using one of the solvers I installed via the AMPL license tool, I get an error when just checking the availability of the solver.
This happens for ...
0
votes
1
answer
36
views
AMPL not running
Why am I facing this error when executing my code?
ampl: model Assingment_3.mod;
Assingment_3.mod, line 11 (offset 202):
syntax error
context: 1 >>> 30 <<<
# Define the set ...
0
votes
1
answer
138
views
Already defined variable in AMPL
`I'm new to AMPL and I'm having a hard time understanding why I'm getting a feedback about my variables being already defined.
I keep getting message stating:
diet0.mod
line 2 offset 16
Xbread is ...
0
votes
0
answers
114
views
Pyomo: reading a three dimensional parameter from a .dat file
When reading AMPL type .dat files in Pyomo, I encounter a problem dealing with two- and three-dimensional parameters.
Following is a MWE:
The Pyomo file is:
from pyomo.environ import *
data = ...
-1
votes
1
answer
99
views
AMPL Syntax Error - N is already defined, but i didnt define it
Here is the .dat code:
# ---------- Sets ----------
set N := 1 2 3 4 5 6 7 8 9 10;
set L := 1 2 3;
set N_l[1] := 1 7 8;
set N_l[2] := 2 4 5 6;
set N_l[3] := 3 9 10;
# ---------- Parameters ----------
...
0
votes
1
answer
99
views
AMPL code. Error: Where is the issue? mod or dat file?
set D := {1, 2, 3, 4};
param d :=
1 80
2 70
3 120
4 150
5 100;
param a := 1; # Cost per napkin for cleaning
param b := 2; # Cost per napkin for buying new napkins
param c := 0.5; # Cost per day ...
0
votes
0
answers
72
views
Gurobi 10.0.1: Error: Objective Q not PSD (negative diagonal entry)
I wrote an optimizaton model and I tested it on ampl using gurobi solver. The solver gives me the following error: “Gurobi 10.0.1: Error: Objective Q not PSD (negative diagonal entry)”. I don’t know ...
1
vote
1
answer
198
views
AMPL: How can I run a for loop in AMPL to perform a logical comparison?
variables:
set I:={1..4}; # prod 1-4
var x{I} >=0 integer; # Set this to a non-negative number!
var y{I} binary; # Fixed cost is no matter what!
Constraints:
#Profit
#I have tried this ...
0
votes
1
answer
38
views
Assignnemt problem - Help to write simple constraint - AMPL
I am currently writing a simple bin packing problem using an AMPL model.
The idea is to have orders and carts and minimize the total cost.
Each order must be assigned to a cart, and a cart can have ...
1
vote
2
answers
204
views
AMPL / Python - Performance & Memory issue
I’ve writen a simple model that optimize item location assignment for a warehouse of 30 000 locations.
My code works with 3 items and gurobi or cplex, but :
With CBC : Not working after 1 minutes ...
0
votes
1
answer
144
views
Unauthorised Solver using Couenne in AMPL IDE
Hi I am trying to solve a model using couenne in the AMPL IDE. Couenne seems to run and gives an optimisation value but then it prints the following statement;
"Error at _cmdno 2 executing "...
1
vote
1
answer
119
views
I am trying to solve Min Cost problem in AMPL, but my objective function is 0
I am new to AMPL and doing MC problem. I have included my code. I asked earlier to help with other errors, at this moment program is working, but optimal solution is 0 and giving a strange error. What ...
1
vote
1
answer
130
views
AMPL program giving zero optimal value
My objective functions optimal value is confirmed to be non-zero, but I am getting 0 for it while trying to run an ampl program. Can you please help?
The mod file contains my constraints and objective ...
1
vote
1
answer
38
views
Hello! I am trying to write a model to solve Min Cost Problem in AMPL, however I keep getting an error regarding exeprion on origin and dest
I am new to AMPL and trying to make a simple model of MC problem, but I have so many errors and I can't understand how to solve them.
I have attached bellow my model with a data in it.
Maybe someone ...
1
vote
1
answer
65
views
AMPL duplicate member "x" for set "y", how to fix it
I'm working with AMPL. In the ".mod" I have declared a set like this:
set path_intersections;
It consists of rows of two numbers, the first one is the number of the path, and the second one ...
1
vote
1
answer
39
views
AMPL: selecting variable matrix indices to be integers
If I declear var x {1..3}; is there a way to specify specific indices to be integer variables?
i.e. x[1] & x[3] are integer variables while x[2] is continuous.
var x{1..3};
x[1] integer;
x[3] ...
0
votes
1
answer
191
views
AMPL ERROR: I am getting this error, i have mentioned and attached mod and dat files
Below are my dat and mode files for ampl.
I am getting the following error:
hw3.dat, line 14 (offset 262):
b[1] already defined
context: 1 1 >>> ; <<<
hw3.dat, line 14 (offset 262):...
-1
votes
1
answer
65
views
How Can I Solve Syntax and Declaration Erros in my AMPL Code?
I'm new to developing code in AMPL. I started studying some tutorials and I'm trying to solve some exercises available on the internet.
I tried to develop a code for the problem shown at the end of ...
0
votes
1
answer
67
views
Using AMPL find the largest rectangle in a circle
So this is a pretty simple problem, given a circle of diameter 60 units, find the largest rectangle that fits in it. Using some pretty simple maths we know it'll have an area of 1800 units.
So I ...
0
votes
1
answer
66
views
Runing AMPL file with CPLEX
I have an AMPL file and CPLEX software and I dont know if I can run it with CPLEX if yes How can do it? do I have to install something with CPLEX
NB: I dont have AMPL software
1
vote
1
answer
673
views
amplpy: how to define data to a parameter associated with a set
I'm trying to use amplpy to link a python script to a ampl model, and the real desire is use a script to generate some parameters, and use the ampl to find the optimal values to some variables.
Worth ...
0
votes
2
answers
131
views
How to map indices of different sets in pyomo?
I have two sets in Pyomo, the first one is G=/GD1,GD2,GD3/, And the second one is N=/N1,N2,N3,...,N32,N33/. Naturally they have symbolic representation here for the sake of simplicity. I would like ...
0
votes
1
answer
145
views
Formulate linear constraint in AMPL
I am trying to solve the exercises from AMPL: A Modeling Language for Math Programming Package, but I am stuck on Exercise 1-4(e). My code so far looks like this:
.mod-file:
# Set of cars we can ...
0
votes
1
answer
131
views
How to add divisibility constraint in GNU mathprog
I want to add a constraint that a variable should be divisible by a particular integer.
I tried using mod operator but it cannot be used with variables:
s.t. c1 x1 mod 10 = 0
I get the following ...
0
votes
1
answer
249
views
Cplex definition of variables
Firstly I am newly with cplex, i want to define R as a set of two pairs (i,j) and then write the below constrains:
zij ∈ {0, 1}, ∀ i, j s.t.(i, j) ∈ R
fj − fi ≥ ...
1
vote
0
answers
122
views
How to optimize a problem using only linear constraints
I am new to AMPL. Currently I am trying to optimize a networking problem. I can only use CPLEX solver. Others like ILOG CP are forbidden.
Input:
Demands - set of demands that have to be fulfilled (...
0
votes
1
answer
324
views
ampl looping, repeat until loop , syntax error
I just started on ampl and tried some easy algorithm basics .
Why is something like this repeat until loop not working ?
param x=8 ;
repeat until x=0;
param x=x-1;
display x;
test.mod, line 3 (...
1
vote
1
answer
424
views
Amplpy: How to use output handler?
I am new in AMPL and Python and I am using amplpy to run an AMPL model, using lpopt solver.
I need to get the output result of the solver in a way that I can act over it, i.e. I need to know if the ...
0
votes
1
answer
65
views
How can i solve some AMPL Syntax problem with my code?
I'm learnig to use AMPL to solve some linear programing related problems; but i have a syntax error with a part of my code, and i dont know how to solve it.
#Archivo Mod
#Conjuntos
set T; #Conjunto ...
0
votes
0
answers
213
views
linear programming, how to define multiple variables have same value?
I am trying to have a constraint in my linear programming. I have 3 factories, and each factory has 3 production lines. I have to make sure that in a factory, all the production lines should work for ...
1
vote
1
answer
303
views
Why does my AMPL code keep giving this error?
I have been trying to get my generalized network flow problem in AMPL but I keep running into this error:
presolve: constraint flow_balance['c5'] cannot hold:
body >= 0 cannot be <= -2500; ...
0
votes
1
answer
49
views
Can anyone help someone brand new to AMPL?
Brand new to AMPL and don't understand the error at all. I've tried removing the variable definitions and get the error (no variables identified) so anyway here is the error message:
syntax error
...
1
vote
1
answer
374
views
Bonmin fails with error code -9 from ASL (AMPL solver library), what does that code even mean?
I am trying to solve a linear problem using Bonmin, the sample size is 5000 records. Ipopt and Cbc solved the same problem and data without any issues. Whereas, Bonmin always fails with the below ...