Algorithm 1: The online LyDROO algorithm for solving (P1). input : Parameters V , {γi, ci}Ni=1, K, training interval δT , Mt update interval δM ; output: Control actions xt,ytKt=1; 1 Initialize the DNN with random parameters θ1 and empty replay memory, M1 ← 2N; 2 Empty initial data queue Qi(1) = 0 and energy queue Yi(1) = 0, for i = 1,··· ,N; 3 fort=1,2,...,Kdo 4 Observe the input ξt = ht, Qi(t), Yi(t)Ni=1 and update Mt using (8) if mod (t, δM ) = 0; 5 Generate a relaxed offloading action xˆt = Πθt ξt with the DNN; 6 Quantize xˆt into Mt binary actions xti|i = 1, · · · , Mt using the NOP method; 7 Compute Gxti,ξt by optimizing resource allocation yit in (P2) for each xti; 8 Select the best solution xt = arg max G xti , ξt and execute the joint action xt , yt ; { x ti } 9 Update the replay memory by adding (ξt,xt); 10 if mod (t, δT ) = 0 then 11 Uniformly sample a batch of data set {(ξτ , xτ ) | τ ∈ St } from the memory; 12 Train the DNN with {(ξτ , xτ ) | τ ∈ St} and update θt using the Adam algorithm; 13 end 14 t ← t + 1; 15 Update {Qi(t),Yi(t)}N based on xt−1,yt−1 and data arrival observation At−1N using (5) and (7). i=1 i i=1 16 end,算法的输入输出是什么
时间: 2024-01-20 07:03:18 浏览: 24
输入:参数V,{γi,ci}Ni=1,K,训练间隔δT,Mt更新间隔δM。
输出:控制动作xt,ytKt=1。
其中,V是一个参数集合,{γi,ci}是关于每个用户i的重要性权重和计算任务的数据量,K是迭代次数,δT是训练间隔,δM是Mt更新间隔。算法的输出是K次迭代后的控制动作xt,ytKt=1。
相关问题
algorithm identifier in public key not recognised: 1.2.156.10197.1.301如何解决
该错误通常表示Bouncy Castle库不支持该算法标识符。在这种情况下,您可以尝试更新Bouncy Castle库版本,或使用其他支持该算法的库。
如果您不想更改库,请检查公钥是否正确。如果公钥正确,则您可以尝试手动解析公钥并获取所需信息,而不是使用Bouncy Castle库中的默认方法。以下是一个示例代码,用于手动解析SM2公钥:
```
import java.io.BufferedReader;
import java.io.FileReader;
import java.math.BigInteger;
import java.security.Security;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
public class SM2PublicKeyReader {
public static void main(String[] args) throws Exception {
// 添加Bouncy Castle提供程序
Security.addProvider(new BouncyCastleProvider());
// 读取PEM文件
String pemFile = "sm2_public_key.pem";
BufferedReader reader = new BufferedReader(new FileReader(pemFile));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null) {
if (line.startsWith("-----BEGIN PUBLIC KEY-----")) {
continue;
}
if (line.startsWith("-----END PUBLIC KEY-----")) {
break;
}
sb.append(line.trim());
}
byte[] derContent = java.util.Base64.getDecoder().decode(sb.toString());
// 解析DER编码
ASN1Sequence publicKeyInfo = ASN1Sequence.getInstance(derContent);
ASN1Sequence algorithmIdentifier = ASN1Sequence.getInstance(publicKeyInfo.getObjectAt(0));
ASN1ObjectIdentifier algorithm = ASN1ObjectIdentifier.getInstance(algorithmIdentifier.getObjectAt(0));
ASN1Integer publicKeyX = ASN1Integer.getInstance(publicKeyInfo.getObjectAt(1));
ASN1Integer publicKeyY = ASN1Integer.getInstance(publicKeyInfo.getObjectAt(2));
// 获取公钥参数
ECDomainParameters ecDomainParameters = ECDomainParameters.getByOID(algorithm);
BigInteger x = publicKeyX.getValue();
BigInteger y = publicKeyY.getValue();
ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(ecDomainParameters.getCurve().createPoint(x, y), ecDomainParameters);
// 获取公钥
byte[] publicKeyBytes = ecPublicKeyParameters.getQ().getEncoded(true);
String publicKeyBase64 = java.util.Base64.getEncoder().encodeToString(publicKeyBytes);
System.out.println("Public key in base64: " + publicKeyBase64);
}
}
```
请注意,此代码仅适用于SM2公钥,并且假定PEM文件中只包含一个公钥。如果PEM文件中包含多个公钥或其他类型的密钥,则需要根据具体情况进行调整。
algorithm identifier in public key not recognised:1.2.156.10197.1.301
这个错误通常发生在使用Bouncy Castle库解析SM2公钥时,因为Bouncy Castle默认不支持SM2算法标识符。
要解决此问题,您可以使用以下代码将Bouncy Castle的Provider配置为支持SM2算法标识符:
```
Security.addProvider(new BouncyCastleProvider());
SM2ParameterSpec sm2Spec = new SM2ParameterSpec();
AlgorithmParameters parameters = AlgorithmParameters.getInstance("SM2", "BC");
parameters.init(sm2Spec);
```
在创建SM2的PublicKey对象之前,您需要先执行上述代码来初始化算法参数。这将告诉Bouncy Castle库如何解析SM2算法标识符,从而避免出现“algorithm identifier in public key not recognised”错误。
另外,还需要确保您的公钥PEM文件正确包含了SM2算法标识符,如下所示:
```
-----BEGIN PUBLIC KEY-----
MIICITCCAYoCCQD2yTo1T8ZQvzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJB
....
-----END PUBLIC KEY-----
```
其中,`-----BEGIN PUBLIC KEY-----`和`-----END PUBLIC KEY-----`是PEM文件的起始和结束标记。`MIICITCCAYoCCQD2yTo1T8ZQvzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJB`是经过Base64编码的SM2公钥数据,以ASN.1 DER编码格式存储。如果您的公钥PEM文件中没有正确包含SM2算法标识符,也可能会导致“algorithm identifier in public key not recognised”错误。