This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using JuMP | |
abstract VariableDomain | |
immutable Continuous <: VariableDomain | |
lower::Float64 | |
upper::Float64 | |
end | |
Continuous() = Continuous(-Inf, Inf) | |
Continuous(;lowerbound=-Inf, upperbound=Inf) = Continuous(lowerbound, upperbound) | |
function setdomain!(m::JuMP.Model, x, c::Continuous) | |
m.colLower[x.col] = max(m.colLower[x.col], c.lower) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Minimize | |
- C2 | |
Subject To | |
R0: C0 + C1 >= 0 | |
R1: 2 C0 - C1 >= 0 | |
R2: C2 >= -2 | |
R3: C0 - C2 >= 0 | |
R4: - 1.000001 C0 + C1 - C2 >= 0 | |
Bounds | |
C0 <= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gurobipy import * | |
# This function mimics the JuMP functionality whereby it always | |
# sets the objective coefficients to the JuMP representation of | |
# what the coefficients should be... | |
def JuMPsolve(m, objective_coefficients): | |
# Set the objective coefficients | |
m.setAttr("Obj", m.getVars(), objective_coefficients) | |
# Update the model just to be safe | |
m.update() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maximize | |
C4 | |
Subject To | |
R0: C2 = 0.5 | |
R1: - 4.1 C0 + C1 = 0 | |
R2: 5.1 C0 - C2 + C3 >= -0.1 | |
R3: - 5.1 C0 + C2 + C3 >= 0.1 | |
R4: - 0.230438 C0 + C2 + C4 <= 3.9695627 | |
Bounds | |
-infinity <= C0 <= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uncomment lines 9, 79 in nl_params.jl | |
using JuMP, AmplNLWriter | |
m = Model(solver=IpoptNLSolver()) | |
@defVar(m, -1 <= x <= 1) | |
@setNLObjective(m, Max, min( x, -x, 0.5x-0.25 )) | |
solve(m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ipopt 3.12.2: Maximum CPU Time Exceeded. | |
Options | |
3 | |
1 | |
1 | |
0 | |
2503 | |
2503 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AmplNLWriter | |
using JuMP | |
function foo(want_to_work) | |
a, b= 1, 0.8 | |
m = Model(solver=IpoptNLSolver(Dict{ASCIIString, Any}("print_level"=>1))) | |
@defVar(m, 0 <= x <= 1) | |
@defVar(m, 0 <= y <= 1) |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>WinMerge File Compare Report</title> | |
<style type="text/css"> | |
<!-- | |
td,th {font-size: 12pt;} | |
.ln {text-align: right; background-color: lightgrey;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bonmin: Optimal | |
Options | |
3 | |
1 | |
1 | |
0 | |
418 | |
0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m1 = Model(solver=IpoptSolver(print_level=0)) | |
@defVar(m1, x1) | |
@defNLExpr(myexpr1[i=1:2], i * sin(x1)) | |
@addNLConstraint(m1, myexpr1[1] == 0.5) | |
solve(m1) | |
println("x1 = $(getValue(x1))") | |
println("Analytic: x = $(asin(0.5))") | |
# x1 = 0.5235987687270579 | |
# Analytic: x = 0.5235987755982989 |
NewerOlder