Solved

How to exclude "na" values in Min-/Max-Operators?

  • 27 May 2020
  • 6 replies
  • 168 views

Hello together,

I have declared a parameter as an Min-Operator, which have to indicate the minimal objective function value for each k across all j. 

Background: In each k at least one j is infeasible (objective function value = “na”) as certain restrictions are violated. As a result, the problem occurs that the Min-Operator outputs "na" as the minimum value for each k.

The Min-Operator’s definition is as follows: 

     Index domain: k

          min(j,Parameter(j,k))

Does anybody now how to exclude “na” in the Min-Operator’s definition? Thank you in advance!

Best regards

David

icon

Best answer by Marcel Hunting 4 June 2020, 10:01

Hi @David Kik In the index domain of that constraint you can use

(j,k) | (Parameter(j,k) <> inf) and (Parameter(j,k) <> na)

such that the constraint will not be generated if Parameter(j,k) equals 'inf' or 'na'.

View original

6 replies

Userlevel 3

Hi @David Kik, you can use

min(j | Parameter(j,k) <> na,Parameter(j,k))

to exclude 'na’. Note that this will evaluate to 'inf’ if all Parameter(j,k) are equal to 'na’.

Hi @Marcel Hunting. Your suggestion works so far. Thanks a lot!

However, as you have already noted, the problem occurs that for a given k, all parameters (j,k) are equal to 'na' which results in 'inf' for this k. Consequently, this leads to a incorrect result. 

How can I exclude in my constraint (see below) that the resulting 'inf' is excluded and only positive values are considered for parameter (j,k)?

Constraint:

Auxiliary Variable >= Parameter(j,k) * Decision Variable (j,k)

 

Best,

David

Hi @David Kik, you can use

 min(j | Parameter(j,k) <> na,Parameter(j,k))

to exclude 'na’. Note that this will evaluate to 'inf’ if all Parameter(j,k) are equal to 'na’.

 

Hi @Marcel Hunting. Your suggestion works so far. Thanks a lot!

However, as you have already noted, the problem occurs that for a given k, all parameters (j,k) are equal to 'na' which results in 'inf' for this k. Consequently, this leads to a incorrect result. 

How can I exclude in my constraint (see below) that the resulting 'inf' is excluded and only positive values are considered for parameter (j,k)?

Constraint:

Auxiliary Variable >= Parameter(j,k) * Decision Variable (j,k)

 

Best,

David

Userlevel 3

Hi @David Kik In the index domain of that constraint you can use

(j,k) | (Parameter(j,k) <> inf) and (Parameter(j,k) <> na)

such that the constraint will not be generated if Parameter(j,k) equals 'inf' or 'na'.

Hi @David Kik 

 

Has Marcel’s suggestions helped you with your question?

 

Best

@Marcel Hunting Thank you!

 

@Andrew yes, a lot!

 

Best

David

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator