help-glpk
[Top][All Lists]
Advanced

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

RE: [Help-glpk] abs


From: Meketon, Marc
Subject: RE: [Help-glpk] abs
Date: Sat, 20 Nov 2010 07:21:23 -0600

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: help-glpk-bounces+address@hidden [mailto:help-glpk-bounces+address@hidden On Behalf Of name name
Sent: Saturday, November 20, 2010 7:29 AM
To: address@hidden
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.

reply via email to

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