Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion +combustiontoolbox/+core/@ChemicalSystem/findProducts.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

% If FLAG_BURCAT == false, then remove the species from Third millenium database (Burcat)
if ~FLAG_BURCAT
listSpecies_DB = findSpecies(listSpecies_DB, {}, 'any', {'_M'}, 'all');
listSpecies_DB = listSpecies_DB(~contains(listSpecies_DB, '_M'));

% If indexElements_DB is given, now have to been recalculated
if FLAG_IND
Expand Down
4 changes: 2 additions & 2 deletions +combustiontoolbox/+core/@Mixture/Mixture.m
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@

% Change units to bar
if ~strcmpi(ip.Results.units, 'bar')
p = Units.convert(p, ip.Results.units, 'bar');
p = combustiontoolbox.common.Units.convert(p, ip.Results.units, 'bar');
end

% Assign pressure
Expand Down Expand Up @@ -1930,4 +1930,4 @@ function mergeDuplicateSpecies(obj)

end

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@

% Get molecular weight species [kg/mol]
W = system.propertyVector;
W(indexCondensed_check) = set_prop_DB(system.listSpecies(indexCondensed_check), 'W', system.species);
W(indexCondensed_check) = system.propertiesMatrix(indexCondensed_check, system.ind_W)';

% Definitions
NC_max = NE - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@

% Get molecular weight species [kg/mol]
W = system.propertyVector;
W(indexCondensed_check) = set_prop_DB(system.listSpecies(indexCondensed_check), 'W', system.species);
W(indexCondensed_check) = system.propertiesMatrix(indexCondensed_check, system.ind_W)';

% Definitions
NC_max = NE - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

function value = get.position(obj)
% Get figure position
if ~isempty(obj.position)
if isempty(obj.position_)
value = combustiontoolbox.utils.display.getMonitorPositions(2);
obj.position_ = value;
return
Expand Down
2 changes: 1 addition & 1 deletion +combustiontoolbox/+utils/+display/getMonitorPositions.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
% Get screen device objects
devices = env.getScreenDevices();
% Get initial points
position = get_monitor_positions_MATLAB(varargin{:});
position = combustiontoolbox.utils.display.getMonitorPositionsMATLAB(varargin{:});
% Get screen size for the selected monitor
position = [position(1), position(2), ...
devices(monitor_id).getDisplayMode().getWidth(),...
Expand Down
41 changes: 20 additions & 21 deletions +combustiontoolbox/+utils/+optimization/simplexDual.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,32 @@
% b (float): Right-hand side vector of the equality constraints
%
% Returns:
% x (float): Optimal solution vector
% x_min (float): Minimum value of x
% Tuple containing
%
% * x (float): Optimal solution vector
% * x_min (float): Minimum value of x
%
% Example:
% [x, x_min] = simplexDual(A, b)

% Definitions
[m, n] = size(A);

[~, n] = size(A);
b = b(:);
sumA = sum(A, 2);

% Coefficients for the objective function max t -> min -t
c = [zeros(n, 1); -1];

% Set inequality constraints (x_j - t >= 0)
A_ineq = [-eye(n), ones(n, 1)];
b_ineq = zeros(n, 1);

% Set equality constraints (A * x = b)
A_eq = [A, zeros(m, 1)];
b_eq = b;

c = zeros(n + 1, 1);
c(end) = -1;

% Set equality constraints (A * z + sum(A, 2) * t = b)
A_eq = [A, sumA];

% Solve the linear programming problem using the simplex method
x = combustiontoolbox.utils.optimization.simplex([A_ineq; A_eq], [b_ineq; b_eq], c);
zt = combustiontoolbox.utils.optimization.simplex(A_eq, b, c);

% Remove t
x_min = x(end);
x(end) = [];
% Recover minimum value
x_min = max(zt(end), 0);

% Check
% [x, x_min] = combustiontoolbox.utils.optimization.simplexDualCheck(A_eq, b_eq, c, A_ineq, b_ineq);
end
% Recover solution (x = z + t)
x = zt(1:n) + x_min;
end
Loading