This commit is contained in:
Lendaia Mirai
2025-11-11 10:35:00 +01:00
parent 06af9a6078
commit 4e6c7e31d0
4 changed files with 550 additions and 9 deletions

View File

@@ -7,4 +7,10 @@
<RootNamespace>OE.ALGA</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project>

57
ALGA/Class2.cs Normal file
View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace OE.ALGA;
public class Employee
{
int Id { get; set; }
string Name { get; set; }
string Position { get; set; }
List<Project> Projects { get; set; } = new List<Project>();
}
public class Project
{
int Id { get; set; }
string ProjectName { get; set; }
DateOnly StartDate { get; set; }
DateOnly EndDate { get; set; }
List<Task> Tasks { get; set; } = new List<Task>();
}
public class Task
{
int Id { get; set; }
string TaskName { get; set; }
int HoursSpent { get; set; }
}
public class Workers : DbContext
{
public DbSet<Employee> Employees { get; set; }
public DbSet<Project> Projects { get; set; }
public DbSet<Task> Tasks { get; set; }
public Workers()
{
Database.EnsureDeleted();
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=workerdb;Integrated Security=True;MultipleActiveResultSets=true");
base.OnConfiguring(optionsBuilder);
}
}
public class Launch
{
static void ThatsAMain()
{
string json = File.ReadAllText("/home/mirai/alga/ALGA/workers.json");
List<Employee> employees = JsonConvert.DeserializeObject<List<Employee>>(json);
Workers context = new Workers();
context.Employees.AddRange(employees);
context.SaveChanges();
}
}

View File

@@ -21,21 +21,25 @@ namespace OE.ALGA.Optimalizalas
public int[,] TablazatFeltoltes()
{
int[,] F = new int[problema.N + 1, problema.Wmax + 1];
for (int i = 0; i < problema.N; i++)
for (int i = 0; i <= problema.N; i++)
{
for (int j = 0; j < problema.Wmax; j++)
F[i, 0] = 0;
}
for (int j = 1; j <= problema.Wmax; j++)
{
F[0, j] = 0;
}
for (int i = 1; i <= problema.N; i++)
{
for (int j = 1; j <= problema.Wmax; j++)
{
if (i == 0 || j == 0)
{
F[i, j] = 0;
}
else if (j < problema.W[i])
if (j <= problema.W[i - 1])
{
F[i, j] = F[i - 1, j];
}
else
{
int[] tomb = new int[] { (F[i - 1, j]), (F[i - 1, j - problema.W[i]] + Convert.ToInt32(problema.P[i])) };
int[] tomb = new int[] { (F[i - 1, j]), (F[i - 1, j - problema.W[i - 1]] + Convert.ToInt32(problema.P[i - 1])) };
F[i, j] = tomb.Max();
}
lepesszam++;
@@ -46,7 +50,11 @@ namespace OE.ALGA.Optimalizalas
public float OptimalisErtek()
{
tablazat = TablazatFeltoltes();
return tablazat[problema.N, problema.Wmax];
if (problema.N == 0 || problema.Wmax == 0)
{
return 0;
}
return tablazat[problema.N - 1, problema.Wmax - 1];
}
public bool[] OptimalisMegoldas()
{

470
ALGA/workers.json Normal file
View File

@@ -0,0 +1,470 @@
[
{
"name": "Kiss Péter",
"position": "Fejlesztő",
"projects": [
{
"projectName": "Webalkalmazás fejlesztés",
"startDate": "2023-01-15",
"endDate": "2023-03-20",
"tasks": [
{ "taskName": "Front-end implementáció", "hoursSpent": 40 },
{ "taskName": "Back-end implementáció", "hoursSpent": 60 }
]
},
{
"projectName": "Mobilalkalmazás fejlesztés",
"startDate": "2023-04-10",
"endDate": "2023-06-30",
"tasks": [
{ "taskName": "UI tervezés", "hoursSpent": 20 },
{ "taskName": "API integráció", "hoursSpent": 50 }
]
}
]
},
{
"name": "Nagy Anna",
"position": "Projektmenedzser",
"projects": [
{
"projectName": "Szoftver tesztelés",
"startDate": "2023-02-01",
"endDate": "2023-03-10",
"tasks": [
{ "taskName": "Tesztelési terv készítése", "hoursSpent": 15 },
{ "taskName": "Automatizált tesztek", "hoursSpent": 45 }
]
}
]
},
{
"name": "Szabó László",
"position": "Elemző",
"projects": [
{
"projectName": "Adatgyűjtés",
"startDate": "2023-01-20",
"endDate": "2023-04-05",
"tasks": [
{ "taskName": "Adattisztítás", "hoursSpent": 30 },
{ "taskName": "Adatvizualizáció", "hoursSpent": 25 }
]
}
]
},
{
"name": "Horváth Emese",
"position": "Marketing szakértő",
"projects": [
{
"projectName": "Kampánytervezés",
"startDate": "2023-03-01",
"endDate": "2023-05-15",
"tasks": [
{ "taskName": "Célcsoport elemzés", "hoursSpent": 10 },
{ "taskName": "Kampány kivitelezés", "hoursSpent": 35 }
]
}
]
},
{
"name": "Molnár Zoltán",
"position": "Backend fejlesztő",
"projects": [
{
"projectName": "Adatbázis optimalizáció",
"startDate": "2023-02-10",
"endDate": "2023-03-30",
"tasks": [
{ "taskName": "Lekérdezések optimalizálása", "hoursSpent": 25 },
{ "taskName": "Indexek készítése", "hoursSpent": 20 }
]
}
]
},
{
"name": "Kovács Gábor",
"position": "Frontend fejlesztő",
"projects": [
{
"projectName": "UI fejlesztés",
"startDate": "2023-01-05",
"endDate": "2023-02-15",
"tasks": [
{ "taskName": "HTML/CSS fejlesztés", "hoursSpent": 35 },
{ "taskName": "JavaScript implementáció", "hoursSpent": 30 }
]
}
]
},
{
"name": "Tóth Erika",
"position": "Tesztmérnök",
"projects": [
{
"projectName": "Szoftver minőségbiztosítás",
"startDate": "2023-04-01",
"endDate": "2023-06-01",
"tasks": [
{ "taskName": "Tesztelés", "hoursSpent": 50 },
{ "taskName": "Hibajavítás", "hoursSpent": 20 }
]
}
]
},
{
"name": "Varga András",
"position": "Projektmenedzser",
"projects": [
{
"projectName": "Agilis fejlesztés",
"startDate": "2023-01-15",
"endDate": "2023-04-20",
"tasks": [
{ "taskName": "Csapat koordinálás", "hoursSpent": 30 },
{ "taskName": "Időterv készítés", "hoursSpent": 25 }
]
}
]
},
{
"name": "Bognár Rita",
"position": "Adatbányász",
"projects": [
{
"projectName": "Piackutatás",
"startDate": "2023-03-10",
"endDate": "2023-05-20",
"tasks": [
{ "taskName": "Adatgyűjtés", "hoursSpent": 40 },
{ "taskName": "Elemzés", "hoursSpent": 30 }
]
}
]
},
{
"name": "Szilágyi Tamás",
"position": "DevOps mérnök",
"projects": [
{
"projectName": "Infrastruktúra automatizálás",
"startDate": "2023-02-15",
"endDate": "2023-03-30",
"tasks": [
{ "taskName": "CI/CD pipeline fejlesztés", "hoursSpent": 60 },
{ "taskName": "Deploy folyamatok optimalizálása", "hoursSpent": 30 }
]
}
]
},
{
"name": "Kiss Júlia",
"position": "Szoftverfejlesztő",
"projects": [
{
"projectName": "E-kereskedelmi platform fejlesztés",
"startDate": "2023-01-25",
"endDate": "2023-04-15",
"tasks": [
{ "taskName": "Backend logika", "hoursSpent": 45 },
{ "taskName": "Frontend integráció", "hoursSpent": 35 }
]
}
]
},
{
"name": "Tóth László",
"position": "Full Stack fejlesztő",
"projects": [
{
"projectName": "Mobilalkalmazás UI/UX fejlesztés",
"startDate": "2023-02-01",
"endDate": "2023-05-01",
"tasks": [
{ "taskName": "UI tervezés", "hoursSpent": 40 },
{ "taskName": "Backend integráció", "hoursSpent": 50 }
]
}
]
},
{
"name": "Farkas János",
"position": "Adatbiztonsági szakértő",
"projects": [
{
"projectName": "Biztonsági audit",
"startDate": "2023-03-05",
"endDate": "2023-06-10",
"tasks": [
{ "taskName": "Sebezhetőségek felderítése", "hoursSpent": 20 },
{ "taskName": "Javítási javaslatok", "hoursSpent": 30 }
]
}
]
},
{
"name": "Nagy Attila",
"position": "Tesztelő",
"projects": [
{
"projectName": "Mobilalkalmazás tesztelés",
"startDate": "2023-01-20",
"endDate": "2023-02-25",
"tasks": [
{ "taskName": "Automatizált tesztelés", "hoursSpent": 25 },
{ "taskName": "Kézi tesztelés", "hoursSpent": 40 }
]
}
]
},
{
"name": "Kovács Róbert",
"position": "Üzleti elemző",
"projects": [
{
"projectName": "Folyamat elemzés",
"startDate": "2023-01-10",
"endDate": "2023-04-10",
"tasks": [
{ "taskName": "Folyamat elemzése", "hoursSpent": 30 },
{ "taskName": "Dokumentáció", "hoursSpent": 15 }
]
}
]
}
]