# how to implement parallel integer optimization with petsc?

Tomasz Jankowski tomjan at jay.au.poznan.pl
Sat Feb 4 13:06:54 CST 2006

```>       PETSc basically offers parallel linear algebra and nonlinear solvers.
> If you can phrase the algorithm in linear algebraic terms, then we can probably help.

unfortunetly I can't (sorry I'm not mathematicst) but I can phrase my
problem in AMPL language. please look at the two files which I have pasted
at the end of this email. mate-selection.mod contain optimization model in
AMPL. the second file mate-selection.dat contain the example data.

Please forgive me my previous email with unclear description of my problem
(its because of my english).once again I need to assert that I don't
expect the full recipe for implementation of my problem with PETSc.

I will realy appreciate if you give some sugesstion.

tom

(ps. if AMPL model is not good I provide my algorithm in algebraic terms)

---------mate-selection.mod----------------
set BULLS;
set COWS;

param ebv {COWS,BULLS} >= 0;
param cost {BULLS} > 0;
param f {COWS,BULLS} >= 0;
param l_cows > 0;
var Pairs {COWS,BULLS} binary;

maximize Total_Ebv:
sum {i in COWS, j in BULLS} ebv[i,j] * Pairs[i,j];

subject to Max_cows {i in COWS}: sum{j in BULLS} Pairs[i,j] = 1;
subject to Max_bulls {j in BULLS}: sum{i in COWS} Pairs[i,j] <= 2;
subject to F: (sum{i in COWS, j in BULLS} f[i,j] * Pairs[i,j])/l_cows <= 0.03;
subject to Cost: sum{ i in COWS, j in BULLS} Pairs[i,j] * cost[j] <=500;
---------------------------------------------

-----------------mate-selection.dat---------------------

data;

set BULLS := male0 male1 male2 male3 male4;
set COWS := female0 female1 female2;
param ebv:      male0   male1   male2   male3   male4:=
female0 290     410     298     400     471
female1 901     807     956     653     173
female2 185     453     733     316     367
;
param f:        male0   male1   male2   male3   male4:=
female0 0.076   0.048   0.068   0.064   0.064
female1 0.078   0.057   0.035   0.018   0.014
female2 0.068   0.042   0.062   0.076   0.059
;
param           cost:=
male0   72
male1   544
male2   822
male3   825
male4   127
;
param l_cows := 3;
end;

--------------------------------------------

```