### MINLP propram

Posted:

**Fri Jun 26, 2020 10:12 pm**Hello, I am a new to MINLP and try to solve a simple problem. However, it turns out not that simple. Below is my code. It doesnot work. Could anyone let me know I should change the formulation so I can make it work? (It will very much appreciated if you could provide an example) Thank you very much for your help.

set k/k1*k2/

n/p1*p4/

;

Parameter p(n) 'price' / p1 50

p2 60

p3 70

p4 70/;

Variable pri_dif

price(n,k)

mean(k)

sum_price(k)

;

binary variable m(n,k)

;

Equations

Obj_cluster objective for clustering

assign_limit

kluster_mean

;

Obj_cluster..

pri_dif =E= sum((n,k),(abs(p(n)$m(n,k)- mean(k)$m(n,k)))**2)

;

kluster_mean(k)..

mean(k) =e= sum(n,p(n)$m(n,k))/sum(n,m(n,k));

;

assign_limit(n)..

sum(k,m(n,k))=e= 1

;

Model edc / all /

solve edc using minlp minimizing pri_dif;

set k/k1*k2/

n/p1*p4/

;

Parameter p(n) 'price' / p1 50

p2 60

p3 70

p4 70/;

Variable pri_dif

price(n,k)

mean(k)

sum_price(k)

;

binary variable m(n,k)

;

Equations

Obj_cluster objective for clustering

assign_limit

kluster_mean

;

Obj_cluster..

pri_dif =E= sum((n,k),(abs(p(n)$m(n,k)- mean(k)$m(n,k)))**2)

;

kluster_mean(k)..

mean(k) =e= sum(n,p(n)$m(n,k))/sum(n,m(n,k));

;

assign_limit(n)..

sum(k,m(n,k))=e= 1

;

Model edc / all /

solve edc using minlp minimizing pri_dif;