Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.SolverFoundation.Services;
- using System;
- namespace Foundation
- {
- class Program
- {
- static void Main(string[] args)
- {
- // gifle: 50 lignes de code en+ par jour, 2 bugs en+ par jour
- // coup de pied: 100 lignes de code en+ par jour, 5 bugs en+ par jour
- // tazer: 200 lignes de code en+ par jour, 11 bugs en+ par jour
- var context = SolverContext.GetContext();
- var model = context.CreateModel();
- // Création des décisions que le système doit prendre (les résultats)
- var gifles = new Decision(Domain.IntegerNonnegative, "gifles");
- var pieds = new Decision(Domain.IntegerNonnegative, "pieds");
- var tazer = new Decision(Domain.IntegerNonnegative, "tazer");
- model.AddDecisions(gifles, pieds, tazer);
- var productivite = gifles * 50 + pieds * 100 + tazer * 200;
- var bugs = gifles * 2 + pieds * 5 + tazer * 11;
- var coups = gifles + pieds + tazer;
- model.AddGoal("productivite", GoalKind.Maximize, productivite);
- model.AddGoal("bugs", GoalKind.Minimize, bugs);
- model.AddGoal("coups", GoalKind.Minimize, coups);
- model.AddConstraints("conventionTaz", tazer <= 2);
- model.AddConstraints("conventionSyntouxe", coups <= 10);
- model.AddConstraints("qualite", bugs <= 50);
- var solution = context.Solve();
- solution.GetReport().WriteTo(Console.Out);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement