请先看上一篇:二、coudBalance 资源分配案例-优快云博客
接下来我将给大家介绍第二种建模(可能有第三种,就交给大家自己去研究了)
一、开始建模。
①、资源对象
/**
* @author Xiao Mi feng
* Created with IntelliJ IDEA
* @date 2024-01-27 16:47
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ComputerTwo extends AbstractPersistable {
/**
* cpu功率
*/
private Integer cpuPower;
/**
* 内存容量
*/
private Integer memoryCapacity;
/**
* 网络容量
*/
private Integer networkCapacity;
/**
* 维护费用
*/
private Integer cost;
}
/**
* @author Xiao Mi feng
* Created with IntelliJ IDEA
* @date 2024-01-27 16:48
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ProcessesTwo extends AbstractPersistable {
/**
* 该进程需要的cpu
*/
private Integer cpu;
/**
* 该进程需要的内存
*/
private Integer ram;
}
②、问题解决对象
/**
* @author Xiao Mi feng
* Created with IntelliJ IDEA
* @date 2024-01-27 10:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@PlanningEntity
@SuperBuilder
public class Co