PROCESSING_ORDER

PROCESSING_ORDER属性决定XDC文件是否将由
Vivado Design Suite在约束处理期间,或正常处理,或延迟处理。
PROCESSING_ORDER可以是:早期、正常或晚期。
默认情况下,Vivado Design Suite在用户XDC文件之前读取IP核的XDC文件
在顶层设计的约束文件集中定义。以这种方式处理约束
允许IP定义核心所需的约束,同时允许您覆盖这些IP
稍后处理用户约束的约束。请参阅Vivado设计套件中的此链接
用户指南:使用约束(UG903)[参考文献19]了解更多信息。
约束文件的默认处理顺序为:
1.标记为“早期”的用户约束
2.IP约束标记为早期(默认)
3.标记为NORMAL的用户约束
4.标记为LATE的IP约束(包含时钟依赖关系)
5.标记为LATE的用户约束

标记有通用PROCESSING_ORDER的用户约束文件将在
它们在Vivado IDE中显示的约束集中定义的顺序。的顺序
可以通过更改Vivado IDE中文件的编译顺序来修改文件,或者
使用reorder_files命令。
架构支持
所有架构。
适用对象
•约束文件,XDC或Tcl,(get_Files)
价值观
•早期:在处理其他约束文件之前处理这些文件。
•NORMAL:在EARLY文件之后和LATE文件之前处理这些文件(默认)。
•延迟:在处理其他约束文件之后处理这些文件

Syntax
Verilog and VHDL Syntax
Not applicable
XDC Syntax
set_property PROCESSING_ORDER {EARLY | NORMAL | LATE} [get_files <filename> ]
Where
<filename> is the filename of an XDC or Tcl constraints file.
XDC Syntax Example
set_property PROCESSING_ORDER EARLY [get_files char_fifo_ooc.xdc]
import numpy as np from platypus import NSGAII, Problem, Real, Integer # 定义问题 class JobShopProblem(Problem): def __init__(self, jobs, machines, processing_times): num_jobs = len(jobs) num_machines = len(machines[0]) super().__init__(num_jobs, 1, 1) self.jobs = jobs self.machines = machines self.processing_times = processing_times self.types[:] = Integer(0, num_jobs - 1) self.constraints[:] = [lambda x: x[0] == 1] def evaluate(self, solution): job_order = np.argsort(np.array(solution.variables[:], dtype=int)) machine_available_time = np.zeros(len(self.machines)) job_completion_time = np.zeros(len(self.jobs)) for job_idx in job_order: job = self.jobs[job_idx] for machine_idx, processing_time in zip(job, self.processing_times[job_idx]): machine_available_time[machine_idx] = max(machine_available_time[machine_idx], job_completion_time[job_idx]) job_completion_time[job_idx] = machine_available_time[machine_idx] + processing_time solution.objectives[:] = [np.max(job_completion_time)] # 定义问题参数 jobs = [[0, 1], [2, 0], [1, 2]] machines = [[0, 1, 2], [1, 2, 0], [2, 0, 1]] processing_times = [[5, 4], [3, 5], [1, 3]] # 创建算法实例 problem = JobShopProblem(jobs, machines, processing_times) algorithm = NSGAII(problem) algorithm.population_size = 100 # 设置优化目标 problem.directions[:] = Problem.MINIMIZE # 定义算法参数 algorithm.population_size = 100 max_generations = 100 mutation_probability = 0.1 # 设置算法参数 algorithm.max_iterations = max_generations algorithm.mutation_probability = mutation_probability # 运行算法 algorithm.run(max_generations) # 输出结果 print("最小化的最大完工时间:", algorithm.result[0].objectives[0]) print("工件加工顺序和机器安排方案:", algorithm.result[0].variables[:]) 请检查上述代码
05-30
代码的语法没有问题,但是在定义问题时,约束条件中的 lambda 函数有误。应该将 x[0] == 1 改为 x[0] == 0,因为变量的范围是 0 到 num_jobs - 1。另外,应该在 lambda 函数前加上 @staticmethod,表示这是一个静态方法。修改后的代码如下: ``` import numpy as np from platypus import NSGAII, Problem, Real, Integer # 定义问题 class JobShopProblem(Problem): def __init__(self, jobs, machines, processing_times): num_jobs = len(jobs) num_machines = len(machines[0]) super().__init__(num_jobs, 1, 1) self.jobs = jobs self.machines = machines self.processing_times = processing_times self.types[:] = Integer(0, num_jobs - 1) self.constraints[:] = [self.check_order] @staticmethod def check_order(x): return x[0] == 0 def evaluate(self, solution): job_order = np.argsort(np.array(solution.variables[:], dtype=int)) machine_available_time = np.zeros(len(self.machines)) job_completion_time = np.zeros(len(self.jobs)) for job_idx in job_order: job = self.jobs[job_idx] for machine_idx, processing_time in zip(job, self.processing_times[job_idx]): machine_available_time[machine_idx] = max(machine_available_time[machine_idx], job_completion_time[job_idx]) job_completion_time[job_idx] = machine_available_time[machine_idx] + processing_time solution.objectives[:] = [np.max(job_completion_time)] # 定义问题参数 jobs = [[0, 1], [2, 0], [1, 2]] machines = [[0, 1, 2], [1, 2, 0], [2, 0, 1]] processing_times = [[5, 4], [3, 5], [1, 3]] # 创建算法实例 problem = JobShopProblem(jobs, machines, processing_times) algorithm = NSGAII(problem) algorithm.population_size = 100 # 设置优化目标 problem.directions[:] = Problem.MINIMIZE # 定义算法参数 algorithm.population_size = 100 max_generations = 100 mutation_probability = 0.1 # 设置算法参数 algorithm.max_iterations = max_generations algorithm.mutation_probability = mutation_probability # 运行算法 algorithm.run(max_generations) # 输出结果 print("最小化的最大完工时间:", algorithm.result[0].objectives[0]) print("工件加工顺序和机器安排方案:", algorithm.result[0].variables[:]) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cckkppll

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值