help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] How to create appropriate constraint file for a problem


From: Andrew Makhorin
Subject: Re: [Help-glpk] How to create appropriate constraint file for a problem
Date: Wed, 16 Dec 2009 06:26:45 +0300

> I have attached a separate file that shows an input deck that does
> this (it is a deck in the old MPS format, btw).

Reading problem data from `sampleinp.txt'...
Problem: QUAD01
sampleinp.txt:9: in fixed MPS format positions 62-72 must be blank
MPS file processing error

Commenting out the text in positions 62-72 with a dollar character
($) makes it suitable to be read in free mps format.

BTW, why not to use mathProg language or at least cplex lp format?

>  The problem setup will
> work for this case, but it is lacking an additional constraint that I
> want to impose... namely that the final ratio of the number of points
> in each segment to the total number on each edge should stay as close
> as possible to original ratio (the min values input originally)

> I can't seem to figure out how to impose this constraint ... just
> wondering if anyone else can enlighten me?

Let:
x[e,i] = number of points in segment i on edge e
y[e]   = sum x[e,i] = total number of points on edge e

Then the condition to be met is the following:
x[e,i] / y[e] is as close to ratio[e,i] as possible for all (e, i)

Probably it can be modeled as follows:
x[e,i] - ratio[e,i] * y[e] + s[e,i] - t[e,i] = 0  for all (e,i)
where s[e,i], t[e,i] >= 0.

Note that:
s[e,i] + t[e,i] = |x[e,i] - ratio[e,i] * y[e]|.

And the objective is to minimize the following sum:
sum (s[e,i] + t[e,i]) for all (e, i)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]