help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Help needed


From: Meketon, Marc
Subject: Re: [Help-glpk] Help needed
Date: Sun, 24 Jun 2012 14:20:54 -0500

In the model, do:

 

set indexes;

param values{indexes} ;

param index := min{k in indexes: values[k] != 0} k;

display index; # displays:  index = 5

 

and in the data section, do:

 

param : indexes : values :=

1 0

2 0

3 0

4 0

5 8

6 9

7 0

8 0

;

 

 

From: help-glpk-bounces+address@hidden [mailto:help-glpk-bounces+address@hidden On Behalf Of Victor Gutierrez
Sent: Sunday, June 24, 2012 1:56 PM
To: address@hidden
Subject: [Help-glpk] Help needed

 

Hi

I need to pre-process some data before an optimization problem begins.

I'm doing the following:

 

If I have the following array of parameters:

param values = [0 0 0 0 8 9 0 0]

I would like to have in one parameter the index k where the first element of the array "values" is different of zero, i.e. 

param index := 5     due to values[5] != 0

 

could you help me with this.

Thank you in advance

Victor

 



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]