From: <fra...@ya...> - 2004-10-28 10:24:08
|
Hi Rémi, first of all, we encoded the simple APIs for optimisation (Michel was asking about them) yesterday. They should be published anytime, as soon as a new version (0.91 ?) is released (Guillaume, can you please do it ?) Concerning the example that you mention, it seems to work perfectly: you want to optimize v1+v2+v3 and you assign values by decreasing order, so the first solution found is the optimal: v1,v2,v3 are all set to the maximum of their domain, which is 10. I do not see what is wrong. François --- coletta <co...@li...> a écrit : > Le lun, 25/10/2004 à 14:08 +0200, Hadrien Cambazard > a écrit : > > > The api concerning minization and maximization in > not yet available on the > > Problem object. However, you can look at the > following code which give you > > an example of minimization. You only need to use > the Solver object and > > specify a couple of options : > > > > public static void main(String[] args) { > > Problem pb = new Problem(); > > IntVar fctObj = > pb.makeBoundIntVar("objectif",-10,1000); > > IntVar v1 = pb.makeEnumIntVar("v1",1,10); > > IntVar v2 = pb.makeEnumIntVar("v2",-3,10); > > IntVar v3 = pb.makeEnumIntVar("v3",1,10); > > > > pb.post(pb.eq(pb.sum(new > IntVar[]{v1,v2,v3}),fctObj)); > > > > > > Solver solver = pb.getSolver(); > > solver.setDoMaximize(false); > > solver.setObjective(fctObj); > > solver.setRestart(false); > > solver.setFirstSolution(true); > > solver.generateSearchSolver(pb); > > solver.launch(); > > } > > Hello guys, > > I'm sorry, but i don't seem to work :-( > By selecting another Value Ordering, for instance: > inserting the line "solver.setValIterator(new > DecreasingDomain());", > i obtain: > > $ java Test > ... solution with cost objectif:30 > Pb[4 vars, 1 cons] > objectif[30, 30] > v1{10} > v2{10} > v3{10} > > Do i miss something ? > > -- > Rémi > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide > on ITManagersJournal > Use IT products in your business? Tell us what you > think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! > Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Choco-users mailing list > Cho...@li... > https://lists.sourceforge.net/lists/listinfo/choco-users > Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com |