Borderbasix

sdpstuff.hpp
Go to the documentation of this file.
1 //ca n'est pas le bon test mais cela dezvrait mperlmettre de limiter la
2 //casse
3 
4 template<typename Base, typename typstock, typename typdump>
5 void computestockmon_d(typstock &stockmon, const Base &b, const typdump &dump, int maxdeg)
6 {
7  //typedef typename typdump::value_type::pol_t pol;
8  //typedef typename pol::monom_t mon;
9  typedef typename typstock::value_type mon;
10  //int taillequo=0,tmp=0;
11  // mon *who=NULL;
12  list<mon> current;
13  current.push_back(mon(1));
14  stockmon.push_back(mon(1));
15  //on a le degre max
16  //le quotient est connexe a 1 donc on part
17  //de 1 et on decrit le reste en multipliant par les variables
18  for(int i=0;i<maxdeg;i++)
19  {
20  list<mon> tmpcurrent=current;
21  //my_merge(stockmon,current);
22  current.erase(current.begin(),current.end());
23  for(int i=0;i<b.nbvar();i++)
24  {
25  for(typename list<mon>::iterator iter=tmpcurrent.begin();
26  iter!=tmpcurrent.end();iter++)
27  current.push_back((*iter)*mon(i,1));
28  }
29  //maintenant on tri;
30  for(typename list<mon>::iterator iter=current.begin();iter!=current.end();iter++)
31  if((IsinB(*iter,b))&&(!member(stockmon,*iter)))
32  {
33  stockmon.push_back(*iter);
34  }
35  else
36  {
37  current.erase(iter--);
38  }
39  }
40  return;
41 }
42 
43 template<typename typdump, typename Base, typename typserv>
44 int testsdp(typdump &dump, Base &b, typserv &serv)
45 {
46  int nb_degmoitie=0,nb_deg=0,currentdeg=0;
47  typename typdump::iterator iter
48  for(iter=dump.begin();
49  currentdeg<dump.size()/2;iter++,currentdeg++)
50  nb_degmoitie+=iter->sizemonquo;
51  for(;iter!=dump.size();iter++)
52  nb_deg+=iter->sizemonquo;
53  return (nb_degmoitie*nb_degmoitie)/2<nb_deg;
54 }
55 
56 template<typename T, typename typdump, typename Base, typename typserv>
57 void compute_normforms(T* tab, const typdump &dump, const Base &b
58  , const typserv &serv,int k)
59 {
60  //Il faut calculer toutes les formes normales de tous
61  //les produits de monomes
62  typedef Base::mon mon;
63  // ICI il ya une optimisatiopn qui consisterait a lire
64  // les monome de servmon dans l'ordre dans lequel ils apparaissent
65  //pour engendrer lismonbase
66  list<mon> listmonbase;
67  computestockmon_d(listmonbase,b,dump,k);
68  for(typename .....)
69  //engendrer les monomes dnt il faut les nf
70 
71  //calculer les nf
72 
73  //remplir le tableau
74 }
75 
76 template<typename typP, typename typdump, typename Base, typename typserv>
77 void sdprealrad(typP &newpol, const typdump & dump, const Base &b,
78  const typser v & serv,int k)
79 {
80  //il faut le nombre de variables
81  int nbvarsdp;
82  int tailledublock;//nb equations de formes normales
83  //
84  DSDP solver;
85  SDPCone mycone;
86  LPCone lpcone;//ineqalites lineaires
87  //ICI il reste a initialiser le solver
88  DSDPCreate(m,solver);
89  //DSDPSetDObjective(solver,numvar,doubleobjective);
90  //par defaut c 0 pour toutes les contraintes ce qu'il nous faut
91 
92  //DSDPCreateSDPCone(solver,1,&mycone);
93  SDPConeSetblockSize(mycone,0,tailledublock);
94  //ICI il faut calculer les differentes equations
95  compute_normforms(tableau,dump,b,serv,int k);
96  SDPConeSetADenseVecMat(mycone,numblock,numvar,dimension,alpha,
97  tableau,nnz);
98 
99  DSDPCreateLPCone(solver,&lpcone);
100  LPConeSetData(lpcone,n,nnzin,row,aval);
101 
102  DSDPSetup(solver);
103  DSDPSolve(solver);
104  DSDPComputeX(dsdp);
105  //
106  //ICI il faudrait recuperer X et trouver les nouvelles equations
107  //
108 
109  DSDPDestroy(dsdp);
110 }
void compute_normforms(T *tab, const typdump &dump, const Base &b, const typserv &serv, int k)
Definition: sdpstuff.hpp:57
MSKint32t MSKint32t MSKint32t MSKint32t MSKCONST MSKrealt MSKrealt MSKCONST MSKint32t MSKCONST MSKint32t MSKCONST MSKint32t MSKCONST MSKrealt * aval
Definition: mosek.h:3714
MSKint32t * numvar
Definition: mosek.h:3018
int member(const typMk &tmpMk, const typename typMk::value_type mon)
Definition: corealgo.hpp:1391
int nbvar()
Definition: types.hpp:37
int testsdp(typdump &dump, Base &b, typserv &serv)
Definition: sdpstuff.hpp:44
MSKint32t k
Definition: mosek.h:2713
int IsinB(const mon &m, const Base &b)
Definition: IsinB3.hpp:68
Mon mon
Definition: solver_bb_floating.cpp:136
Definition: types.hpp:14
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
void computestockmon_d(typstock &stockmon, const Base &b, const typdump &dump, int maxdeg)
Definition: sdpstuff.hpp:5
void sdprealrad(typP &newpol, const typdump &dump, const Base &b, const typser v &serv, int k)
Definition: sdpstuff.hpp:77
predicat::monom_t mon
Definition: types.hpp:19
Home  |  Download & InstallContributions