Commit 6c8ee1f6 authored by Maxime POULAIN's avatar Maxime POULAIN
Browse files

add demonstration and test 10 seq

parent 63ff1dcc
#include "MainForm.h"
#include <stdlib.h>
#include "bierwirth_t.h"
#include "bierwirthManager.h"
#include "graph_t.h"
#include "gestion_graphe.h"
#include "solution.h"
#include "utils.h"
#include <iostream>
#include <vector>
void test10Seq(void) {
using namespace std;
graph_t graph;
graph = gestionGraph::lecture_fichier("la01.txt");
solution_t sol;
bierwirth_t v[30];
for (int i = 0; i < 30; i++)
{
v[i]=bierwirthManager::generateVector(graph.nb_pieces, graph.nb_machines);
cout << to_string(i) << " : " << solution::evaluer(v[i], graph).cost << " -> " << solution::rechercheLocale(v[i], graph, 1000).cost << endl;
}
}
int main() {
srand(21465);
srand(2145);
test10Seq();
MainForm form;
form.ShowDialog();
......
......@@ -14,7 +14,7 @@ solution_t solution::rechercheLocale(bierwirth_t& v, graph_t& graph, int maxIter
bierwirth_t vInput = v;
bierwirth_t vOpti = v;
int iteration = 0;
while (iteration < maxIteration && (jFather.piece != -1 && jFather.rang != -1)) {
while (iteration < maxIteration && (jFather.piece != -1 && jFather.rang != -1)) {
if (graph.mach[j.piece][j.rang] == graph.mach[jFather.piece][jFather.rang]) {
bierwirthManager::permutation(vInput, vOpti, j, jFather, graph.nb_pieces, graph.nb_machines);
solutionOpti = evaluer(vOpti, graph);
......@@ -168,9 +168,9 @@ solution_t solution::genNeighbour(bierwirth_t& v, int size, int n, int m)
int rand2 = rand() % size;
for (int i = 0; i < size; ++i)
for (int i = 0; i < size; ++i)
{
(new_solution.v)[i] = v[i];
}
......@@ -187,7 +187,7 @@ int solution::sameH(solution_t sol, int* hash, int size)
int sum = 0;
int val;
for (int i = 0; i < sol.sol_size; i++)
for (int i = 0; i < sol.sol_size; i++)
{
tmp = sol.ST[i];
sum += tmp * tmp;
......@@ -196,7 +196,7 @@ int solution::sameH(solution_t sol, int* hash, int size)
val = hash[h];
if (val == 0)
if (val == 0)
{
hash[h] = 1;
}
......
 MainForm.cpp
 Entry.cpp
C:\Users\poula\Downloads\oad-tp2\Code\View\utils.h(15,2): warning C4091: 'static ': ignored on left of 'utils' when no variable is declared
bierwirthManager.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
View.vcxproj -> C:\Users\poula\Downloads\oad-tp2\Code\x64\Debug\View.exe
......@@ -3,3 +3,4 @@ C:\Users\poula\Documents\Travail\ZZ2\S3\Aide Décision\TP\TP2\oad-tp2\Code\View\
C:\Users\poula\Documents\Travail\ZZ2\S3\Aide Décision\TP\TP2\oad-tp2\Code\View\x64\Debug\View.vcxproj.GenerateResource.cache
C:\Users\poula\Downloads\oad-tp2\Code\View\x64\Debug\View.MainForm.resources
C:\Users\poula\Downloads\oad-tp2\Code\View\x64\Debug\View.vcxproj.GenerateResource.cache
C:\Users\poula\Downloads\oad-tp2\Code\View\x64\Debug\View.vcxproj.AssemblyReference.cache
No preview for this file type
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment