Typically you define two non-negative variables, say rPlus and rNegative whose 
difference is (1-y) and [with the correct objective function] whose sum is the 
absolute value of (1-y).

The code is something like:

var rPlus >=0;
var rNegative >=0;

maximize obj - (rPlus + rNegative);

subject to AbsoluteValueTypeConstraint
  1-y = rPlus - rNegative;

Note that rPlus+rNegative is the absolute value of (1-y) when that sum is 
minimized.
________________________________
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
name name
Sent: Saturday, November 20, 2010 7:29 AM
To: [email protected]
Subject: [Help-glpk] abs

Hello,
I want to calculate

var y,>=0;

maximize obj:
abs(1-y);

fa:
...
fb:
...

solve;
...
data;
...
I get the argument for abs has invalide type, could you tell me how I could do 
this?

Is it possible to solve the maximization probleme several times?

something like this


var y,>=0;
{k in 1 .. 20} :
/* To get the solution for k=1, solution for k=2 ...*/
maximize obj:
abs(1-y);

fa:
...
fb:
...

solve;
...
data;
...

And the last question
How can I compile an model model.mod where the data is in a file model.dat

Thank you a lot
Onor

----------------------------------------------------------------------------
This e-mail and any attachments may be confidential or legally privileged. If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein. Please inform us of the erroneous delivery by return e-mail.

Thank you for your cooperation.
----------------------------------------------------------------------------

________________________________
This e-mail and any attachments may be confidential or legally privileged. If 
you received this message in error or are not the intended recipient, you 
should destroy the e-mail message and any attachments or copies, and you are 
prohibited from retaining, distributing, disclosing or using any information 
contained herein. Please inform us of the erroneous delivery by return e-mail. 
Thank you for your cooperation.
_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to