Questions tagged [mathprog]

GNU MathProg is a modeling language intended for describing linear mathematical programming models. MathProg can also be referred to as GMPL

GNU MathProg is a high-level language for creating mathematical programming models. MathProg is specific to GLPK, but resembles a subset of AMPL. MathProg can also be referred to as GMPL (GNU Mathematical Programming Language), the two terms being interchangeable.

See https://en.wikibooks.org/wiki/GLPK/GMPL_%28MathProg%29

70 questions
6
votes
1 answer

How can I write an if condition for my variable in GLPK?

Here is my full problem: Information: *Max. total investment: $125 *Pay-off is the sum of the units bought x pay-off/unit *Cost per investment: Buy-in cost + cost/unit x number of units if you buy at least one unit *The cost is sum of the costs per…
Figen Güngör
  • 12,169
  • 14
  • 66
  • 108
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

Can't figure out how to resolve reduce/reduce conflict

I'm trying to create grammar for GNU MathProg language from glpk package https://www3.nd.edu/~jeff/mathprog/glpk-4.47/doc/gmpl.pdf Unfortunately grammar I've written so far is ambiguous. I don't know how to tell bison which branch of parsing tree…
Lisu
  • 45
  • 4
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

Is it possible to convert a MathProg MIP file to a format recognised by SCIP?

I've been using GLPK to solve some mixed integer programming problems. Here's a sample input file in MathProg format: set REACTIONS; set REACTANTS; param Ys {i in REACTANTS, j in REACTIONS}; param Gamma {i in REACTANTS, j in REACTIONS}; param…
Kitserve
  • 115
  • 9
2
votes
1 answer

Syntax error with Glpk: MathProg model processing error

This is my model: set linhas; set colunas; param c{j in colunas}; param A{i in linhas,j in colunas}; param b{i in linhas}; var x{j in colunas}>=0; minimize FO: sum{j in colunas} c[j]*x[j]; s.t. R{i in linhas}: sum{j in colunas} A[i,j] =…
2
votes
1 answer

Sum the binary variables in GLPK

I am new in GLPK. This is some of my code: set I := setof{(i,r,p,d) in T} i; var Y{I,I}, binary; s.t. c1{i in I, j in I}: sum{Y[i,j]} = 6; I want to have only six values in Y that are 1. Can anyone tell me how to do it in proper way? Because s.t.…
Gregorius Edwadr
  • 399
  • 1
  • 3
  • 14
2
votes
2 answers

Issues with objective - GMPL

I'm trying to model an objective. It's a special case of assignment problem, where I want to minimize the workers needed for making all the jobs. So all jobs have to be done, but not all the workers have to do something. Constraints: s.t.…
2
votes
1 answer

Reading CSV data into subscripted set

I would like to ask for your assistance with a problem I'm dealing for about a week. I have been looking everywhere for the solution. Official doc is not accurate enough and says nothing on that matter. The problem is the following: This is a part…
Marek
  • 1,413
  • 2
  • 20
  • 36
2
votes
1 answer

Or Condition in Linear Programming with GLPSOL AMPL/MathProg

I want to write an optimization model which selects the lesser of the two tasks, depending upon some constraint. minimize obj: (doT1 * T1) + (doT2*T2) + (additional variables) Now, T1 and T2 represent duration of tasks, and doT1 represents flag to…
Asif Shiraz
  • 864
  • 1
  • 12
  • 27
2
votes
2 answers

GLPK Mathprog group of sets

I'm trying to code a model that can solve the Multiple Choice Knapsack Problem (MCKP) as described in Knapsack Problems involving dimensions, demands and multiple choice constraints: generalization and transformations between formulations (Found…
Alex Ketay
  • 918
  • 3
  • 10
  • 20
2
votes
0 answers

MathProg recursive function

I'm facing trouble in counting linked nodes in Mathprog while trying to solve a quite-big TSP problem: let's say I have set C := 0..645; # a set of nodes set A := {i in C, j in C: i!=j}; # a set of edges a distance function d(c1,c2) var…
2
votes
1 answer

Known values for variables in a linear program written in Mathprog

I have a linear program written in MathProg. My unknown binary variable is a two-dimensional array defined as: var x{i in V, l in L}, >=0, <=1; where V and L are sets of integers. The value of some variables, however, are known in advance and I…
Ari
  • 7,251
  • 11
  • 40
  • 70
1
vote
1 answer

MathProg (AMPL) - Variable Array Sized by Another Variable

I am writing my first GNU MathProg (AMPL) program to find the minimum switch (vertex) count instances of a HyperX topology (graph) for a given radix, number of hosts, and bisection bandwidth. This is a simple first program because all of the…
bestephe
  • 11
  • 3
1
vote
1 answer

Implementing a constraint based on previous variable's value in GNU Mathprog/AMPL

I have a binary program and one of my variables, x_it is defined on two sets, being I: Set of objects and T: Set of the weeks of the year, thus x_it is a binary variable standing for whether object i is assigned to something on week t. The…
oakenshield1
  • 851
  • 1
  • 11
  • 26
1
2 3 4 5