-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added show optimization, creation of SEGOMOE
- Loading branch information
1 parent
6634d0b
commit b50f8f1
Showing
15 changed files
with
317 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
import React from 'react'; | ||
import Plot from 'react-plotly.js'; | ||
import PropTypes from 'prop-types'; | ||
|
||
class OptView extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
const { | ||
optim, | ||
} = this.props; | ||
console.log("Kenoobii"); | ||
} | ||
render() { | ||
return ( | ||
<Plot | ||
data={[ | ||
{ | ||
x: Array.from(Array(this.props.optim.inputs['x'].length).keys()), | ||
y: this.props.optim.inputs['x'].map( x => x[0] ), | ||
type: 'scatter', | ||
mode: 'markers lines', | ||
name: 'x[0]', | ||
marker: {color: 'orange'} | ||
}, | ||
{ | ||
x: Array.from(Array(this.props.optim.inputs['x'].length).keys()), | ||
y: this.props.optim.inputs['x'].map( x => x[1] ), | ||
type: 'scatter', | ||
mode: 'markers lines', | ||
name: 'x[1]', | ||
marker: {color: 'red'}, | ||
}, | ||
{ | ||
x: Array.from(Array(this.props.optim.inputs['y'].length).keys()), | ||
y: this.props.optim.inputs['y'].map( y => y[0] ), | ||
type: 'scatter', | ||
mode: 'markers lines', | ||
name: 'y', | ||
marker: {color: 'green'}, | ||
} | ||
]} | ||
layout={{ | ||
width: 800, | ||
height: 500, | ||
title: 'Visual representation of the input points', | ||
xaxis: {title: "point's number"}, | ||
yaxis: {title: "variable's values"} | ||
}} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
OptView.propTypes = { | ||
optim: PropTypes.object.isRequired, | ||
}; | ||
export default OptView; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { useState} from 'react' | ||
import ReactDOM from 'react-dom' | ||
import OptView from 'optview'; | ||
|
||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const node = document.getElementById('optimization_plot') | ||
const optimization_data = JSON.parse(node.getAttribute('optimization_data')) | ||
ReactDOM.render( | ||
<OptView optim={optimization_data}/>, | ||
document.getElementById("optimization_plot"), | ||
) | ||
}) |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<%= form_for(optimization, url: (optimization.new_record? ? optimizations_path : optimization_path(@optimization)), :html => { :multipart => true, :role => "form" }) do |f| %> | ||
<% if @optimization.errors.any? %> | ||
<% @optimization.errors.full_messages.each do |message| %> | ||
<div class="alert <%= bootstrap_class_for :error %>" role="alert"> | ||
<a href="#" data-dismiss="alert" class="close">×</a> | ||
<%= message %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="row"> | ||
<div class=" col-4"> | ||
|
||
<div class="form-group"> | ||
<%= f.label :kind %> | ||
<%= f.select :kind , Optimization::OPTIMIZER_KINDS.each_key, {}, {class: "form-control"} %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :n_obj %> | ||
<%= f.number_field :n_obj, class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.label :xlimits %> | ||
<%= f.text_field :xlimits, class: "form-control" %> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<%= f.submit "Submit", class: "btn btn-primary submit" %> | ||
<%= f.submit "Cancel", class: "btn btn-secondary", name: "cancel_button" %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
Oops, something went wrong.