engineerinr
engineerinr

Reputation: 21

Optimizing a dataset with constraints (no function)

I have a dataset of roughly 500,000 entries and I want to find out which row is the best combination, given a set of constraints.

I have looked at various linear programming methods, but one of my variables has been generated from the others using a neural network. After failing to incorporate the neural network to any linear programming command, now I have resigned to selecting the best row instead, from a dataset generated by using the neural network.

Here is an extract of my dataset:

        [Speed]   [BoostP]   [InletT] [ExhaustT] [FuelFlow]   [Lambda]   [Torque]
[1]        0.25    1.53144    2.29048   -0.39812   -0.65421   -0.19841    0.52364
[2]        0.50   -2.26588    0.54588    2.65987    0.05721   -0.78777    0.53268
[3]        0.25    0.14583    0.89634    0.98554   -0.33293    0.48981    0.51389
[4]        0.25   -0.21985    0.84242    0.66724    0.12758   -0.89856    0.48713
[5]        0.25    0.52630    0.79399    0.73567    0.13699    0.69841    0.56812
[6]        0.75    0.87531    0.84658    0.98555    2.98945    0.26843    0.52487
[7]        0.25    0.96512    0.88127    2.35642    0.98254    1.89546    0.50320
[8]        0.25   -0.05984    0.65542    4.58643   -0.56988   -2.65412    0.59856

The objective of my study is to find out which combination returns the highest torque with reduced fuel consumption, that is, minimizing the following function:

f<-(2/(1+Torque))+0.25*FuelFlow+0.05*ExhaustT

The constraints I have are as follows:

Speed=0.25
ExhaustT<=2.5
-0.5<=Lambda<=1.5

Which R package can achieve this? Also, if anyone knows how to call a neural network from within a LP, I'd much rather use that method. Thank you!

Upvotes: 2

Views: 179

Answers (1)

Erdem Akkas
Erdem Akkas

Reputation: 2070

Use data.table for speed:

df<-read.table(text="Speed   BoostP   InletT ExhaustT FuelFlow   Lambda   Torque
[1]        0.25    1.53144    2.29048   -0.39812   -0.65421   -0.19841    0.52364
           [2]        0.50   -2.26588    0.54588    2.65987    0.05721   -0.78777    0.53268
           [3]        0.25    0.14583    0.89634    0.98554   -0.33293    0.48981    0.51389
           [4]        0.25   -0.21985    0.84242    0.66724    0.12758   -0.89856    0.48713
           [5]        0.25    0.52630    0.79399    0.73567    0.13699    0.69841    0.56812
           [6]        0.75    0.87531    0.84658    0.98555    2.98945    0.26843    0.52487
           [7]        0.25    0.96512    0.88127    2.35642    0.98254    1.89546    0.50320
           [8]        0.25   -0.05984    0.65542    4.58643   -0.56988   -2.65412    0.59856",header=T)

library(data.table)
setDT(df)
df[Speed==0.25 & ExhaustT<=0.25 & Lambda>=-0.5 & Lambda<=1.5, 
   Result := (2/(1+Torque)) + 0.25*FuelFlow + 0.05*ExhaustT] 

df[which.min(Result)]
Speed  BoostP  InletT ExhaustT FuelFlow   Lambda  Torque   Result
1:  0.25 1.53144 2.29048 -0.39812 -0.65421 -0.19841 0.52364 1.129188

Upvotes: 1

Related Questions