|
From: | Nicoco BERGER |
Subject: | Tr: Re: [Help-glpk] lpx_simplex don't maximise anything ! |
Date: | Mon, 10 Oct 2005 12:45:01 +0200 (CEST) |
--- Nicoco BERGER <address@hidden> a écrit : > Date: Mon, 10 Oct 2005 12:42:53 +0200 (CEST) > De: Nicoco BERGER <address@hidden> > Objet: Re: [Help-glpk] lpx_simplex don't maximise anything ! > À: Andrew Makhorin <address@hidden> > > Here is the test code (the code of the functions are attached to this mail) : > > -------------------------------------------------------- > lprec *lp; // variables utiles pour lpsolve > int Ncol = n, *colno = NULL, j, ret = 0; > REAL *row = NULL; > > vector<int>::iterator it ; > vector<int>* sol_coef_a_un = new vector<int>() ; > > lp = init_modele_lpsolve(n, w, cap) ; > > // a) obtenir la solution optimale selon le premier objectif à maximiser > > if(ret == 0) { > > // on définit l'objectif primaire > ret = set_objectif(lp, p_prim, Ncol) ; > } > > //cout << "après le premier objectif ret vaut "<< ret <<"\n" ; > > if(ret == 0) { > > //cout << "avant z_prim\n"; > //write_LP(lp, stdout); > > // on calcule la solution optimale (pour le premier objectif seul) > ret = solve(lp); > > if(ret == OPTIMAL) > ret = 0; > else > ret = 5; > } > > > > // the output : > > > // bloc test > write_LP(lp, stdout) ; > > affichage(*p_prim, "vector des coefficients : ") ; > cout << "\n" ; > ret = ajoute_contrainte(lp, n, p_prim, GE, max_prim) ; > > write_LP(lp, stdout) ; > // fin bloc test > --------------------------------------------------------- > > > Here is the output : > > ------------------------------------------ > /* Objective function */ > max: +5 x0 +2 x1 +3 x2; > > /* Constraints */ > +4 x0 +4 x1 +4 x2 <= 7; > > /* Variable bounds */ > x0 <= 1; > x1 <= 1; > x2 <= 1; > > /* Integer definitions */ > int x0,x1,x2; > > vector des coefficients : > taille : 3 > > > 5 2 3 > > /* Objective function */ > max: +5 x0 +2 x1 +3 x2; > > /* Constraints */ > +4 x0 +4 x1 +4 x2 <= 7; > +6.28716714841 x0 +1.59054145753 x1 +2.92201123928 x2 >= 5; <----- this is > not 5 x0 + > > 2 x1 + 3 x2 !! > > /* Variable bounds */ > x0 <= 1; > x1 <= 1; > x2 <= 1; > > /* Integer definitions */ > int x0,x1,x2; > -------------------------------------------------------------- > > > > Do you have an idea of where these 6.2871... 1.590... 2.9220... come from ? > > > > > > > > > ___________________________________________________________________________ > Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger > Téléchargez cette version sur http://fr.messenger.yahoo.com ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com
init_modele_lpsolve
Description: pat2126994515
ajoute_contrainte
Description: pat726757656
set_objectif
Description: pat1571261253
get_solution
Description: pat519052785
[Prev in Thread] | Current Thread | [Next in Thread] |