27 lines
920 B
C#
27 lines
920 B
C#
|
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; // Инициализируем вместимость рюкзака
|
|||
|
}
|
|||
|
}
|