CourseWorkKnapsack/classes/KnapsackStatus.cs

27 lines
920 B
C#
Raw Normal View History

2024-05-20 02:52:44 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static ProjectKnapsack.classes.KnapsackParameters;
namespace ProjectKnapsack.classes;
public class KnapsackState
{
public List<Item> Items { get; }
public double CurrentWeight { get; }
public double CurrentValue { get; }
public int CurrentIndex { get; }
public int Capacity { get; set; } // Добавляем свойство для хранения вместимости рюкзака
public KnapsackState(List<Item> items, double currentWeight, double currentValue, int currentIndex, int capacity)
{
Items = new List<Item>(items);
CurrentWeight = currentWeight;
CurrentValue = currentValue;
CurrentIndex = currentIndex;
Capacity = capacity; // Инициализируем вместимость рюкзака
}
}