help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] is there a function for count in MATHPROG?


From: Rafael Torres
Subject: [Help-glpk] is there a function for count in MATHPROG?
Date: Fri, 06 Apr 2012 14:54:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

I'm looking for a function that count number of objects that belong to a specific cluster but I dont know if such function exists.

For example I'm trying to count number of objects in variable Z[i] but with Cardinal function I get an error tha says "invalid preceding operator == " what does it mean?

Thanks in advance.


This is my code:

# PARAMETROS
param noitems          ; # numero de items
param nometodos        ; # numero de metodos
#param nocategorias    ; # numero de categorias

# CONJUNTOS
set ITEMS            := 1..noitems            ; # Items
set METODOS            :=    1..nometodos        ; # Metodos
set CATEGORIAS        ; # Categorias


# DATOS
param clasini{i in ITEMS , j in METODOS} , integer    ;
param nocategorias := card(CATEGORIAS);
param Porcentaje{k in 1.. nocategorias} ;

# VARIABLES DE DECISION
#var Z{ITEMS} in CATEGORIAS , integer     ;
var Z{i in ITEMS}  ;

# VARIABLES AUXILIARES PARA LINEALIZAR
var T{i in ITEMS, j in METODOS}  ;


# MODELO MATEMATICO
    # Funcion objetivo
    minimize distance: sum{i in ITEMS , j in METODOS} T[i,j]    ;

    # Restricciones
s.t. Positivo{i in ITEMS , j in METODOS }: Z[i] - clasini[i,j] <= T[i,j] ; s.t. Negativo{i in ITEMS , j in METODOS }: -Z[i] + clasini[i,j] <= T[i,j] ; s.t. Proporcion{k in 1..card(CATEGORIAS)}: card({i in ITEMS: k in Z[i]}) <= noitems*Porcentaje[k];
solve;

--
Rafael Torres





"La luna se puede tomar a cucharadas o como una cápsula cada dos horas..."
- Jaime Sabines -




reply via email to

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