Skip to content

Commit

Permalink
update test after added postOptmodul simplifyConstraints
Browse files Browse the repository at this point in the history
  • Loading branch information
vruge authored and OpenModelica-Hudson committed Jun 5, 2015
1 parent 9a21804 commit e5f7de7
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 34 deletions.
44 changes: 18 additions & 26 deletions openmodelica/cruntime/optimization/basic/CC.mos
Expand Up @@ -17,39 +17,31 @@ end CheckConstraintViolation;
");
getErrorString();

optimize(CheckConstraintViolation,numberOfIntervalls=200, tolerance = 1e-12, simflags="-lv LOG_IPOPT_ERROR -ipopt_max_iter 2");
echo(false);
res := optimize(CheckConstraintViolation,numberOfIntervalls=200, tolerance = 1e-12, simflags="-lv LOG_IPOPT -ipopt_max_iter 2");
messages:=res.messages;

echo(true);
res.resultFile;

if regexBool(messages, "EXIT: Problem has inconsistent variable bounds or constraint sides.") then
print("EXIT: Problem has inconsistent variable bounds or constraint sides.\n");
else
print("\nCheck test!\n");
exit(1);
end if;
getErrorString();


// Result:
// true
// ""
// true
// ""
// record SimulationResult
// resultFile = "CheckConstraintViolation_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 50, tolerance = 1e-12, method = 'optimization', fileNamePrefix = 'CheckConstraintViolation', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv LOG_IPOPT_ERROR -ipopt_max_iter 2'",
// messages = "
// Optimizer Variables
// ========================================================
// State[0]:x(start = 0, nominal = 1e-05, min = -Inf, max = +Inf, init = 0)
// Input[1]:u(start = 0, nominal = 1, min = -Inf, max = +Inf)
// --------------------------------------------------------
// number of nonlinear constraints: 2
// ========================================================
//
// max_iter = 2
// ******************************************************************************
// This program contains Ipopt, a library for large-scale nonlinear optimization.
// Ipopt is released as open source code under the Eclipse Public License (EPL).
// For more information visit http://projects.coin-or.org/Ipopt
// ******************************************************************************
// true
// "CheckConstraintViolation_res.mat"
// EXIT: Problem has inconsistent variable bounds or constraint sides.
//
// LOG_IPOPT_ERROR | info | max violation is 3 for the constraint $OMC$constarintTerm2(time = 0.00310102)
// LOG_IPOPT_ERROR | info | max violation is 3 for the constraint $OMC$constarintTerm2(time = 0.00310102)
// LOG_IPOPT_ERROR | info | max violation is 3 for the constraint $OMC$constarintTerm2(time = 0.00310102)
// stdout | warning | No optimal solution found!
// | | | | Use -lv=LOG_IPOPT for more information.
// "Warning: Alias variables $OMC$constarintTerm2 = x with invalid limits min 3.0 > max 0.0
// "
// end SimulationResult;
// ""
// endResult
16 changes: 8 additions & 8 deletions openmodelica/cruntime/optimization/basic/testDerInput.mos
Expand Up @@ -42,7 +42,7 @@ val(cost,1.0);
// Input[2]:w(start = 0, nominal = 2, min = -2, max = 2)
// Input[3]:z(start = 0, nominal = 2, min = -2, max = 2)
// --------------------------------------------------------
// number of nonlinear constraints: 4
// number of nonlinear constraints: 1
// ========================================================
//
// ******************************************************************************
Expand All @@ -53,13 +53,13 @@ val(cost,1.0);
//
// LOG_IPOPT_ERROR | info | max error is 0.00499703 for the approximation of the state x1(time = 3.2)
// LOG_IPOPT_ERROR | info | max error is 2.88615e-16 for the approximation of the state x1(time = 2.2)
// LOG_IPOPT_ERROR | info | max error is 3.33067e-16 for the approximation of the state x1(time = 4.2)
// LOG_IPOPT_ERROR | info | max error is 4.44089e-16 for the approximation of the state x1(time = 1.9)
// LOG_IPOPT_ERROR | info | max error is 3.55185e-16 for the approximation of the state x1(time = 2.1)
// LOG_IPOPT_ERROR | info | max error is 5.43836e-16 for the approximation of the state x1(time = 3.4)
// LOG_IPOPT_ERROR | info | max error is 3.10949e-16 for the approximation of the state x1(time = 1.9)
// LOG_IPOPT_ERROR | info | max error is 3.44343e-16 for the approximation of the state x1(time = 3.3)
// LOG_IPOPT_ERROR | info | max error is 6.38378e-16 for the approximation of the state x1(time = 3)
// LOG_IPOPT_ERROR | info | max error is 4.88541e-16 for the approximation of the state x1(time = 2.8)
// LOG_IPOPT_ERROR | info | max error is 3.77519e-16 for the approximation of the state x1(time = 2.3)
// LOG_IPOPT_ERROR | info | max error is 3.99637e-16 for the approximation of the state x1(time = 4.5)
// LOG_IPOPT_ERROR | info | max error is 5.27356e-16 for the approximation of the state x1(time = 3.4)
// LOG_IPOPT_ERROR | info | max error is 5.27356e-16 for the approximation of the state x1(time = 3.1)
// LOG_IPOPT_ERROR | info | max error is 4.10696e-16 for the approximation of the state x1(time = 2.9)
// LOG_IPOPT_ERROR | info | max error is 5.52509e-16 for the approximation of the state x1(time = 3.1)
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
Expand Down
83 changes: 83 additions & 0 deletions openmodelica/debugDumps/lateInline.mos
Expand Up @@ -1284,6 +1284,89 @@ buildModel(testOptdaedump); getErrorString();
// ========================================
//
//
// post-optimization module simplifyConstraints:
//
//
// unspecified partition
// ========================================
//
// Variables (2)
// ========================================
// 1: y:VARIABLE() .testOptdaedump, .Real type: Real []
// 2: x:VARIABLE() .testOptdaedump, .Real type: Real []
//
//
// Equations (2, 2)
// ========================================
// 1/1 (1): x = time ^ 3.0 + exp(time ^ 3.0) [binding]
// 2/2 (1): y = exp(time ^ 3.0) + x [binding]
//
//
// State Sets
// ========================================
//
//
// Matching
// ========================================
// 2 variables and equations
// var 1 is solved in eqn 2
// var 2 is solved in eqn 1
//
//
// StrongComponents
// ========================================
// {1:2}
// {2:1}
//
//
//
// BackendDAEType: simulation
//
//
// Known Variables (constants) (0)
// ========================================
//
//
// External Objects (0)
// ========================================
//
//
// Classes of External Objects (0)
// ========================================
//
//
// Alias Variables (0)
// ========================================
//
//
// Simple Equations (0, 0)
// ========================================
//
//
// Initial Equations (0, 0)
// ========================================
//
//
// Zero Crossings (0)
// ========================================
//
//
// Relations (0)
// ========================================
//
//
// Time Events (0)
// ========================================
//
//
// When Clauses (0)
// ========================================
//
//
// Constraints (0)
// ========================================
//
//
// post-optimization module CSE:
//
//
Expand Down
117 changes: 117 additions & 0 deletions openmodelica/debugDumps/optdaedump.mos
Expand Up @@ -1766,6 +1766,123 @@ buildModel(testOptdaedump); getErrorString();
// ========================================
//
//
// post-optimization module simplifyConstraints:
//
//
// unspecified partition
// ========================================
//
// Variables (9)
// ========================================
// 1: iC:VARIABLE() .testOptdaedump, .Real type: Real []
// 2: iL:STATE(1)() .testOptdaedump, .Real type: Real []
// 3: i2:VARIABLE() .testOptdaedump, .Real type: Real []
// 4: i1:VARIABLE() .testOptdaedump, .Real type: Real []
// 5: i0:VARIABLE() .testOptdaedump, .Real type: Real []
// 6: uC:DUMMY_STATE() .testOptdaedump, .Real type: Real []
// 7: uL:VARIABLE() .testOptdaedump, .Real type: Real []
// 8: u1:VARIABLE() .testOptdaedump, .Real type: Real []
// 9: $DER.uC:DUMMY_DER(fixed = false ) .testOptdaedump, .Real type: Real []
//
//
// Equations (9, 9)
// ========================================
// 1/1 (1): $DER.uC = -sin(time) [dynamic]
// 2/2 (1): u1 = R1 * i1 [dynamic]
// 3/3 (1): u1 = uC - uL [dynamic]
// 4/4 (1): uL = R2 * i2 [dynamic]
// 5/5 (1): uL = L * der(iL) [dynamic]
// 6/6 (1): iC = C * $DER.uC [dynamic]
// 7/7 (1): i0 = i1 + iC [dynamic]
// 8/8 (1): i1 = i2 + iL [dynamic]
// 9/9 (1): uC = cos(time) [dynamic]
//
//
// State Sets
// ========================================
//
//
// Matching
// ========================================
// 9 variables and equations
// var 1 is solved in eqn 6
// var 2 is solved in eqn 5
// var 3 is solved in eqn 8
// var 4 is solved in eqn 2
// var 5 is solved in eqn 7
// var 6 is solved in eqn 9
// var 7 is solved in eqn 4
// var 8 is solved in eqn 3
// var 9 is solved in eqn 1
//
//
// StrongComponents
// ========================================
// {9:6}
// {2, 8, 4, 3:8, 7, 3, 4} Size: 4 Jacobian Linear
// {5:2}
// {1:9}
// {6:1}
// {7:5}
//
//
//
// BackendDAEType: simulation
//
//
// Known Variables (constants) (5)
// ========================================
// 1: v0:VARIABLE() = 0.0 .testOptdaedump, .Real type: Real []
// 2: R1:PARAM() = 1.0 .testOptdaedump, .Real type: Real []
// 3: R2:PARAM() = 2.0 .testOptdaedump, .Real type: Real []
// 4: L:PARAM() = 0.5 .testOptdaedump, .Real type: Real []
// 5: C:PARAM() = 3.0 .testOptdaedump, .Real type: Real []
//
//
// External Objects (0)
// ========================================
//
//
// Classes of External Objects (0)
// ========================================
//
//
// Alias Variables (4)
// ========================================
// 1: u0:VARIABLE() = uC .testOptdaedump, .Real type: Real []
// 2: u2:VARIABLE() = uL .testOptdaedump, .Real type: Real []
// 3: v1:VARIABLE() = uC .testOptdaedump, .Real type: Real []
// 4: v2:VARIABLE() = uL .testOptdaedump, .Real type: Real []
//
//
// Simple Equations (0, 0)
// ========================================
//
//
// Initial Equations (0, 0)
// ========================================
//
//
// Zero Crossings (0)
// ========================================
//
//
// Relations (0)
// ========================================
//
//
// Time Events (0)
// ========================================
//
//
// When Clauses (0)
// ========================================
//
//
// Constraints (0)
// ========================================
//
//
// post-optimization module CSE:
//
//
Expand Down

0 comments on commit e5f7de7

Please sign in to comment.